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.



53838
53839
53840
53841
53842
53843
53844
53845
53846
53847
53848
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53838

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.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def brands
  @brands
end

#idObject (readonly)

Returns the value of attribute id.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def images
  @images
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def merchant_of_record
  @merchant_of_record
end

#nameObject (readonly)

Returns the value of attribute name.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def name
  @name
end

#possible_actionsObject (readonly)

Returns the value of attribute possible_actions.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def possible_actions
  @possible_actions
end

#typeObject (readonly)

Returns the value of attribute type.



53836
53837
53838
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53836

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53854
53855
53856
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53854

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

#to_hashObject



53858
53859
53860
53861
53862
53863
53864
53865
53866
53867
53868
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53858

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



53850
53851
53852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53850

def to_json
  JSON.dump(to_hash)
end