Class: Io::Flow::V0::Models::PaymentPaymentMethod

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 = {}) ⇒ PaymentPaymentMethod

Returns a new instance of PaymentPaymentMethod.



51464
51465
51466
51467
51468
51469
51470
51471
51472
51473
51474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51464

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :type, :brands, :merchant_of_record, :images, :possible_actions], 'PaymentPaymentMethod')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::PaymentType) ? x : ::Io::Flow::V0::Models::PaymentType.apply(x))
  @brands = HttpClient::Preconditions.assert_class('brands', opts.delete(:brands), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodBrand) ? x : ::Io::Flow::V0::Models::PaymentMethodBrand.new(x)) }
  @merchant_of_record = (x = opts.delete(:merchant_of_record); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x))
  @images = (x = opts.delete(:images); x.is_a?(::Io::Flow::V0::Models::PaymentMethodImages) ? x : ::Io::Flow::V0::Models::PaymentMethodImages.new(x))
  @possible_actions = HttpClient::Preconditions.assert_class('possible_actions', opts.delete(:possible_actions), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentActionType) ? x : ::Io::Flow::V0::Models::PaymentActionType.apply(x)) }
end

Instance Attribute Details

#brandsObject (readonly)

Returns the value of attribute brands.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def brands
  @brands
end

#idObject (readonly)

Returns the value of attribute id.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def images
  @images
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def merchant_of_record
  @merchant_of_record
end

#nameObject (readonly)

Returns the value of attribute name.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def name
  @name
end

#possible_actionsObject (readonly)

Returns the value of attribute possible_actions.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def possible_actions
  @possible_actions
end

#typeObject (readonly)

Returns the value of attribute type.



51462
51463
51464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51462

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51480
51481
51482
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51480

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

#to_hashObject



51484
51485
51486
51487
51488
51489
51490
51491
51492
51493
51494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51484

def to_hash
  {
    :id => id,
    :name => name,
    :type => type.value,
    :brands => brands.map { |o| o.to_hash },
    :merchant_of_record => merchant_of_record.value,
    :images => images.to_hash,
    :possible_actions => possible_actions.map { |o| o.value }
  }
end

#to_jsonObject



51476
51477
51478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51476

def to_json
  JSON.dump(to_hash)
end