Sha256: 11c75c786cf01c9abeabfb1c2a707d6d7492f776be70e1735c5502a56302adf4

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

module VkontakteApi
  # A class representing a connection to VK. It holds the access token.
  class Client
    include Resolver
    
    # An access token needed by authorized requests.
    attr_reader :token
    
    # A new API client.
    # @param [String, OAuth2::AccessToken] token An access token.
    def initialize(token = nil)
      if token.respond_to?(:token)
        # token is an OAuth2::AccessToken
        @token = token.token
      else
        # token is a String or nil
        @token = token
      end
    end
    
    # Is a `VkontakteApi::Client` instance authorized.
    def authorized?
      !@token.nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vkontakte_api-1.0.rc lib/vkontakte_api/client.rb