Class: Io::Flow::V0::Models::ExclusionRuleStatistic

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

Returns a new instance of ExclusionRuleStatistic.



28908
28909
28910
28911
28912
28913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28908

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:state, :number_items], 'ExclusionRuleStatistic')
  @state = (x = opts.delete(:state); x.is_a?(::Io::Flow::V0::Models::ExclusionRuleState) ? x : ::Io::Flow::V0::Models::ExclusionRuleState.apply(x))
  @number_items = HttpClient::Preconditions.assert_class('number_items', opts.delete(:number_items), Integer)
end

Instance Attribute Details

#number_itemsObject (readonly)

Returns the value of attribute number_items.



28906
28907
28908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28906

def number_items
  @number_items
end

#stateObject (readonly)

Returns the value of attribute state.



28906
28907
28908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28906

def state
  @state
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28919
28920
28921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28919

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

#to_hashObject



28923
28924
28925
28926
28927
28928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28923

def to_hash
  {
    :state => state.value,
    :number_items => number_items
  }
end

#to_jsonObject



28915
28916
28917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28915

def to_json
  JSON.dump(to_hash)
end