Class: Giftrocket::FundingSource
- Inherits:
-
Object
- Object
- Giftrocket::FundingSource
- Includes:
- HTTParty
- Defined in:
- lib/giftrocket/funding_source.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#method ⇒ Object
Returns the value of attribute method.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ FundingSource
constructor
A new instance of FundingSource.
Constructor Details
#initialize(attributes) ⇒ FundingSource
Returns a new instance of FundingSource.
9 10 11 12 13 14 |
# File 'lib/giftrocket/funding_source.rb', line 9 def initialize(attributes) attributes = attributes.with_indifferent_access self.id = attributes[:id] self.method = attributes[:method] self. = attributes[:meta] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/giftrocket/funding_source.rb', line 7 def id @id end |
#meta ⇒ Object
Returns the value of attribute meta.
7 8 9 |
# File 'lib/giftrocket/funding_source.rb', line 7 def end |
#method ⇒ Object
Returns the value of attribute method.
7 8 9 |
# File 'lib/giftrocket/funding_source.rb', line 7 def method @method end |
Class Method Details
.list ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/giftrocket/funding_source.rb', line 16 def self.list response = get '/', query: Giftrocket., format: 'json' if response.success? response_json = JSON.parse(response.body).with_indifferent_access response_json[:funding_sources].map do |funding_souce_attributes| Giftrocket::FundingSource.new(funding_souce_attributes) end else raise Giftrocket::Error.new(response) end end |