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.



51157
51158
51159
51160
51161
51162
51163
51164
51165
51166
51167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51157

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)) })
  @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 = (x = opts.delete(:programs); x.nil? ? nil : HttpClient::Preconditions.assert_class('programs', x, Array).map { |v| HttpClient::Preconditions.assert_class('programs', HttpClient::Helper.to_object(v), Hash) })
  @q = (x = opts.delete(:q); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Query) ? x : ::Io::Flow::V0::Models::Query.new(x)))
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def content
  @content
end

#display_positionObject (readonly)

Returns the value of attribute display_position.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def display_position
  @display_position
end

#issuersObject (readonly)

Returns the value of attribute issuers.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def issuers
  @issuers
end

#payment_methodObject (readonly)

Returns the value of attribute payment_method.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def payment_method
  @payment_method
end

#programsObject (readonly)

Returns the value of attribute programs.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def programs
  @programs
end

#qObject (readonly)

Returns the value of attribute q.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def q
  @q
end

#tagsObject (readonly)

Returns the value of attribute tags.



51155
51156
51157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def tags
  @tags
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51173
51174
51175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51173

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

#to_hashObject



51177
51178
51179
51180
51181
51182
51183
51184
51185
51186
51187
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51177

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.nil? ? nil : programs,
    :q => q.nil? ? nil : q.to_hash
  }
end

#to_jsonObject



51169
51170
51171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51169

def to_json
  JSON.dump(to_hash)
end