class SmartVkApi::Methods::Proxy

Attributes

scope[RW]
vk[RW]

Public Class Methods

camelcase(method_name) click to toggle source
# File lib/smart_vk_api/methods.rb, line 15
def self.camelcase(method_name)
  result = method_name.to_s.split('_').map(&:capitalize).join
  result[0] = result[0].downcase
  result
end
new(vk, scope) click to toggle source
# File lib/smart_vk_api/methods.rb, line 21
def initialize(vk, scope)
  self.vk = vk
  self.scope = scope
end

Public Instance Methods

method_missing(method_name, *arguments, &block) click to toggle source
# File lib/smart_vk_api/methods.rb, line 26
def method_missing(method_name, *arguments, &block)
  method_name = Proxy.camelcase(method_name)
  vk.call("#{scope}.#{method_name}", arguments.first)
end
respond_to?(method_name, include_private = false) click to toggle source
# File lib/smart_vk_api/methods.rb, line 31
def respond_to?(method_name, include_private = false)
  true # we should respond to any method using Proxy
end