Class: PaysonAPI::V1::Funding
- Inherits:
-
Object
- Object
- PaysonAPI::V1::Funding
- Defined in:
- lib/payson_api/v1/funding.rb
Constant Summary collapse
- FORMAT_STRING =
'fundingList.fundingConstraint(%d).%s'
Instance Attribute Summary collapse
-
#constraint ⇒ Object
Returns the value of attribute constraint.
Class Method Summary collapse
Instance Attribute Details
#constraint ⇒ Object
Returns the value of attribute constraint.
7 8 9 |
# File 'lib/payson_api/v1/funding.rb', line 7 def constraint @constraint end |
Class Method Details
.parse(data) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/payson_api/v1/funding.rb', line 25 def self.parse(data) [].tap do |fundings| i = 0 while data[format(FORMAT_STRING, i, 'constraint')] fundings << new.tap do |f| f.constraint = data[format(FORMAT_STRING, i, 'constraint')] end i += 1 end end end |
.to_hash(fundings) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/payson_api/v1/funding.rb', line 15 def self.to_hash(fundings) {}.tap do |hash| fundings.each_with_index do |funding, index| hash.merge!({ format(FORMAT_STRING, index, 'constraint') => funding.constraint }) end end end |