Sha256: 5b4a751924ece315f5faa79f96f35b6938f3de45fbf50d370860052d5cfcb905

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vkontakte_api-0.2.1 lib/vkontakte_api/client.rb
vkontakte_api-0.2 lib/vkontakte_api/client.rb