Class: Io::Flow::V0::Models::ConsumerInvoicePayment

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ConsumerInvoicePayment

Returns a new instance of ConsumerInvoicePayment.



27602
27603
27604
27605
27606
27607
27608
27609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27602

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:date, :description, :value], 'ConsumerInvoicePayment')
  @date = HttpClient::Preconditions.assert_class('date', HttpClient::Helper.to_date_time_iso8601(opts.delete(:date)), DateTime)
  @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String)
  @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x)))
end

Instance Attribute Details

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



27600
27601
27602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27600

def billing_address
  @billing_address
end

#dateObject (readonly)

Returns the value of attribute date.



27600
27601
27602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27600

def date
  @date
end

#descriptionObject (readonly)

Returns the value of attribute description.



27600
27601
27602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27600

def description
  @description
end

#valueObject (readonly)

Returns the value of attribute value.



27600
27601
27602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27600

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27615
27616
27617
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27615

def copy(incoming={})
  ConsumerInvoicePayment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



27619
27620
27621
27622
27623
27624
27625
27626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27619

def to_hash
  {
    :date => date,
    :description => description,
    :value => value.to_hash,
    :billing_address => billing_address.nil? ? nil : billing_address.to_hash
  }
end

#to_jsonObject



27611
27612
27613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27611

def to_json
  JSON.dump(to_hash)
end