lib/vkontakte_api/client.rb in vkontakte_api-0.1 vs lib/vkontakte_api/client.rb in vkontakte_api-0.2
- old
+ new
@@ -1,16 +1,22 @@
module VkontakteApi
+ # A class representing a connection to VK. It holds an access token.
class Client
+ # An access token needed by authorized requests.
attr_reader :access_token
+ # A new API client.
+ # @param [String] access_token An access token.
def initialize(access_token = nil)
@access_token = access_token
end
+ # Is a `VkontakteApi::Client` instance authorized.
def authorized?
!@access_token.nil?
end
+ # All unknown methods are delegated to a `VkontakteApi::Resolver` instance.
def method_missing(method_name, *args, &block)
args = args.first || {}
VkontakteApi::Resolver.new(:access_token => @access_token).send(method_name, args, &block)
end
end