Class: Io::Flow::V0::Models::FulfillmentItemQuantity

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Fulfillment status of item quantities

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FulfillmentItemQuantity

Returns a new instance of FulfillmentItemQuantity.



40930
40931
40932
40933
40934
40935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40930

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

Instance Attribute Details

#quantityObject (readonly)

Returns the value of attribute quantity.



40928
40929
40930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40928

def quantity
  @quantity
end

#statusObject (readonly)

Returns the value of attribute status.



40928
40929
40930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40928

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40941
40942
40943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40941

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

#to_hashObject



40945
40946
40947
40948
40949
40950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40945

def to_hash
  {
    :status => status.value,
    :quantity => quantity
  }
end

#to_jsonObject



40937
40938
40939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40937

def to_json
  JSON.dump(to_hash)
end