Class: Io::Flow::V0::Models::OrderRulesSummary

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

Returns a new instance of OrderRulesSummary.



53999
54000
54001
54002
54003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53999

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:applied], 'OrderRulesSummary')
  @applied = HttpClient::Preconditions.assert_class('applied', opts.delete(:applied), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderRuleReference) ? x : ::Io::Flow::V0::Models::OrderRuleReference.new(x)) }
end

Instance Attribute Details

#appliedObject (readonly)

Returns the value of attribute applied.



53997
53998
53999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53997

def applied
  @applied
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



54009
54010
54011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54009

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

#to_hashObject



54013
54014
54015
54016
54017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54013

def to_hash
  {
    :applied => applied.map { |o| o.to_hash }
  }
end

#to_jsonObject



54005
54006
54007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54005

def to_json
  JSON.dump(to_hash)
end