Class: DwollaV2::Token

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dwolla_v2/token.rb

Constant Summary collapse

HTTP_METHODS =
[:get, :post, :put, :patch, :delete]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, params) ⇒ Token

Returns a new instance of Token.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dwolla_v2/token.rb', line 12

def initialize client, params
  @client = client
  @access_token  = get_param params, :access_token
  @refresh_token = get_param params, :refresh_token
  @expires_in    = get_param params, :expires_in
  @scope         = get_param params, :scope
  @app_id        = get_param params, :app_id
  @account_id    = get_param params, :account_id
  conn
  freeze
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def access_token
  @access_token
end

#account_idObject (readonly)

Returns the value of attribute account_id.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def 
  @account_id
end

#app_idObject (readonly)

Returns the value of attribute app_id.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def app_id
  @app_id
end

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def client
  @client
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def expires_in
  @expires_in
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def refresh_token
  @refresh_token
end

#scopeObject (readonly)

Returns the value of attribute scope.



7
8
9
# File 'lib/dwolla_v2/token.rb', line 7

def scope
  @scope
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/dwolla_v2/token.rb', line 24

def [] key
  instance_variable_get :"@#{key}"
end

#inspectObject



46
47
48
49
50
# File 'lib/dwolla_v2/token.rb', line 46

def inspect
  Util.pretty_inspect self.class.name,
    client: client, access_token: access_token, refresh_token: refresh_token,
    expires_in: expires_in, scope: scope, app_id: app_id, account_id: 
end

#stringify_keysObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/dwolla_v2/token.rb', line 28

def stringify_keys
  {
    "access_token"  => access_token,
    "refresh_token" => refresh_token,
    "expires_in"    => expires_in,
    "scope"         => scope,
    "app_id"        => app_id,
    "account_id"    => 
  }.reject {|k,v| v.nil? }
end