Class: Io::Flow::V0::Models::PaymentMethod
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentMethod
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a single payment method - e.g VISA or Paypal - and any associated metadata required for processing
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#regions ⇒ Object
readonly
Returns the value of attribute regions.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
21367 21368 21369 21370 21371 21372 21373 21374 21375 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21367 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :type, :name, :images, :regions], 'PaymentMethod') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::PaymentMethodType) ? x : ::Io::Flow::V0::Models::PaymentMethodType.apply(x)) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @images = (x = opts.delete(:images); x.is_a?(::Io::Flow::V0::Models::PaymentMethodImages) ? x : ::Io::Flow::V0::Models::PaymentMethodImages.new(x)) @regions = HttpClient::Preconditions.assert_class('regions', opts.delete(:regions), Array).map { |v| HttpClient::Preconditions.assert_class('regions', v, String) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
21365 21366 21367 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21365 def id @id end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
21365 21366 21367 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21365 def images @images end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21365 21366 21367 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21365 def name @name end |
#regions ⇒ Object (readonly)
Returns the value of attribute regions.
21365 21366 21367 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21365 def regions @regions end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
21365 21366 21367 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21365 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
21381 21382 21383 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21381 def copy(incoming={}) PaymentMethod.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
21385 21386 21387 21388 21389 21390 21391 21392 21393 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21385 def to_hash { :id => id, :type => type.value, :name => name, :images => images.to_hash, :regions => regions } end |
#to_json ⇒ Object
21377 21378 21379 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21377 def to_json JSON.dump(to_hash) end |