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.



58227
58228
58229
58230
58231
58232
58233
58234
58235
58236
58237
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58227

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.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def brands
  @brands
end

#idObject (readonly)

Returns the value of attribute id.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def images
  @images
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def merchant_of_record
  @merchant_of_record
end

#nameObject (readonly)

Returns the value of attribute name.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def name
  @name
end

#possible_actionsObject (readonly)

Returns the value of attribute possible_actions.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def possible_actions
  @possible_actions
end

#typeObject (readonly)

Returns the value of attribute type.



58225
58226
58227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58225

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58243
58244
58245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58243

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

#to_hashObject



58247
58248
58249
58250
58251
58252
58253
58254
58255
58256
58257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58247

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



58239
58240
58241
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58239

def to_json
  JSON.dump(to_hash)
end