class PaysonAPI::V1::Funding

Constants

FORMAT_STRING

Attributes

constraint[R]

Public Class Methods

parse(data) click to toggle source
# 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) click to toggle source
# 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

Public Instance Methods

constraint=(value) click to toggle source
# File lib/payson_api/v1/funding.rb, line 9
def constraint=(value)
  raise "Unknown funding constraint: #{value}" unless PaysonAPI::V1::FUNDING_CONSTRAINTS.include?(value)

  @constraint = value
end