Class: DwollaV2::Token
- Inherits:
-
Object
- Object
- DwollaV2::Token
- Extended by:
- Forwardable
- Defined in:
- lib/dwolla_v2/token.rb
Constant Summary collapse
- HTTP_METHODS =
[:get, :post, :put, :patch, :delete]
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#refresh_token ⇒ Object
readonly
Returns the value of attribute refresh_token.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(client, params) ⇒ Token
constructor
A new instance of Token.
- #inspect ⇒ Object
- #stringify_keys ⇒ Object
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_token ⇒ Object (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_id ⇒ Object (readonly)
Returns the value of attribute account_id.
7 8 9 |
# File 'lib/dwolla_v2/token.rb', line 7 def account_id @account_id end |
#app_id ⇒ Object (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 |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/dwolla_v2/token.rb', line 7 def client @client end |
#expires_in ⇒ Object (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_token ⇒ Object (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 |
#scope ⇒ Object (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 |
#inspect ⇒ Object
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: account_id end |
#stringify_keys ⇒ Object
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" => account_id }.reject {|k,v| v.nil? } end |