class Io::Flow::Reference::V0::Models::PaymentMethod

Represents a single payment method - e.g VISA or Paypal - and any associated metadata required for processing

Attributes

id[R]
images[R]
name[R]
regions[R]
type[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_reference_v0_client.rb, line 709
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::Reference::V0::Models::PaymentMethodType) ? x : ::Io::Flow::Reference::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::Reference::V0::Models::PaymentMethodImages) ? x : ::Io::Flow::Reference::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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_reference_v0_client.rb, line 723
def copy(incoming={})
  PaymentMethod.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_reference_v0_client.rb, line 727
def to_hash
  {
    :id => id,
    :type => type.value,
    :name => name,
    :images => images.to_hash,
    :regions => regions
  }
end
to_json() click to toggle source
# File lib/flow_reference_v0_client.rb, line 719
def to_json
  JSON.dump(to_hash)
end