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



22609
22610
22611
22612
22613
22614
22615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22609

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)
end

Instance Attribute Details

#display_positionObject (readonly)

Returns the value of attribute display_position.



22607
22608
22609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22607

def display_position
  @display_position
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



22607
22608
22609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22607

def payment_method
  @payment_method
end

#tagsObject (readonly)

Returns the value of attribute tags.



22607
22608
22609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22607

def tags
  @tags
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22621
22622
22623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22621

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

#to_hashObject



22625
22626
22627
22628
22629
22630
22631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22625

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

#to_jsonObject



22617
22618
22619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22617

def to_json
  JSON.dump(to_hash)
end