Class: Io::Flow::V0::Models::PaymentMethodRule

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

Returns a new instance of PaymentMethodRule.



23363
23364
23365
23366
23367
23368
23369
23370
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23363

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:tags, :payment_method, :display_position], 'PaymentMethodRule')
  @tags = HttpClient::Preconditions.assert_class('tags', opts.delete(:tags), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodTag) ? x : ::Io::Flow::V0::Models::PaymentMethodTag.from_json(x)) }
  @payment_method = (x = opts.delete(:payment_method); x.is_a?(::Io::Flow::V0::Models::PaymentMethod) ? x : ::Io::Flow::V0::Models::PaymentMethod.new(x))
  @display_position = HttpClient::Preconditions.assert_class('display_position', opts.delete(:display_position), Integer)
  @content = (x = opts.delete(:content); x.nil? ? nil : HttpClient::Preconditions.assert_class('content', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodRuleContent) ? x : ::Io::Flow::V0::Models::PaymentMethodRuleContent.new(x)) })
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



23361
23362
23363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23361

def content
  @content
end

#display_positionObject (readonly)

Returns the value of attribute display_position.



23361
23362
23363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23361

def display_position
  @display_position
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



23361
23362
23363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23361

def payment_method
  @payment_method
end

#tagsObject (readonly)

Returns the value of attribute tags.



23361
23362
23363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23361

def tags
  @tags
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23376
23377
23378
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23376

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

#to_hashObject



23380
23381
23382
23383
23384
23385
23386
23387
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23380

def to_hash
  {
    :tags => tags.map { |o| o.to_hash },
    :payment_method => payment_method.to_hash,
    :display_position => display_position,
    :content => content.nil? ? nil : content.map { |o| o.to_hash }
  }
end

#to_jsonObject



23372
23373
23374
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23372

def to_json
  JSON.dump(to_hash)
end