Class: Makeleaps::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/makeleaps/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Client

Returns a new instance of Client.



15
16
17
# File 'lib/makeleaps/client.rb', line 15

def initialize(username, password)
  @auth_request = Makeleaps::Request::BasicAuth.new(username, password)
end

Instance Attribute Details

#partner_midObject

Returns the value of attribute partner_mid.



9
10
11
# File 'lib/makeleaps/client.rb', line 9

def partner_mid
  @partner_mid
end

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/makeleaps/client.rb', line 10

def request
  @request
end

Instance Method Details

#connect!Object



19
20
21
22
# File 'lib/makeleaps/client.rb', line 19

def connect!
  @token_store ||= @auth_request.authenticate!
  @request = Makeleaps::Request::Generic.new(@token_store.access_token)
end

#disconnect!Object



24
25
26
27
# File 'lib/makeleaps/client.rb', line 24

def disconnect!
  @auth_request.revoke!(@token_store.access_token)
  @token_store = nil
end