Class: MoneyMover::Dwolla::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/money_mover/dwolla/token.rb

Direct Known Subclasses

ApplicationToken

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}, ach_config = Config.new, client = Client.new) ⇒ Token

Returns a new instance of Token.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/money_mover/dwolla/token.rb', line 6

def initialize(attrs={}, ach_config = Config.new, client = Client.new)
  @_links = attrs[:_links]
  @account_id = attrs[:account_id]
  @expires_in = attrs[:expires_in]
  @refresh_expires_in = attrs[:refresh_expires_in]
  @access_token = attrs[:access_token]
  @refresh_token = attrs[:refresh_token]
  @token_type = attrs[:token_type]
  @scope = attrs[:scope]

  @ach_config = ach_config
  @client = client
end

Instance Attribute Details

Returns the value of attribute _links.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def _links
  @_links
end

#access_tokenObject (readonly)

Returns the value of attribute access_token.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def access_token
  @access_token
end

#account_idObject (readonly)

Returns the value of attribute account_id.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def 
  @account_id
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def expires_in
  @expires_in
end

#refresh_expires_inObject (readonly)

Returns the value of attribute refresh_expires_in.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def refresh_expires_in
  @refresh_expires_in
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def refresh_token
  @refresh_token
end

#scopeObject (readonly)

Returns the value of attribute scope.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def scope
  @scope
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



4
5
6
# File 'lib/money_mover/dwolla/token.rb', line 4

def token_type
  @token_type
end

Instance Method Details

#request_new_token!Object



20
21
22
23
# File 'lib/money_mover/dwolla/token.rb', line 20

def request_new_token!
  response = @client.post @client.token_url, create_params
  Token.new response.body
end