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.



38602
38603
38604
38605
38606
38607
38608
38609
38610
38611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38602

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:tags, :payment_method, :display_position, :programs], '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)) })
  @issuers = (x = opts.delete(:issuers); x.nil? ? nil : HttpClient::Preconditions.assert_class('issuers', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentMethodIssuer) ? x : ::Io::Flow::V0::Models::PaymentMethodIssuer.new(x)) })
  @programs = HttpClient::Preconditions.assert_class('programs', opts.delete(:programs), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::InstallmentProgramSummary) ? x : ::Io::Flow::V0::Models::InstallmentProgramSummary.new(x)) }
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def content
  @content
end

#display_positionObject (readonly)

Returns the value of attribute display_position.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def display_position
  @display_position
end

#issuersObject (readonly)

Returns the value of attribute issuers.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def issuers
  @issuers
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def payment_method
  @payment_method
end

#programsObject (readonly)

Returns the value of attribute programs.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def programs
  @programs
end

#tagsObject (readonly)

Returns the value of attribute tags.



38600
38601
38602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38600

def tags
  @tags
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38617
38618
38619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38617

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

#to_hashObject



38621
38622
38623
38624
38625
38626
38627
38628
38629
38630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38621

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 },
    :issuers => issuers.nil? ? nil : issuers.map { |o| o.to_hash },
    :programs => programs.map { |o| o.to_hash }
  }
end

#to_jsonObject



38613
38614
38615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38613

def to_json
  JSON.dump(to_hash)
end