Class: Io::Flow::V0::Models::OrderServiceChange

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

Overview

Manual change for a shipping method used for an order. Currently only available to orders with a single calculated delivery.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderServiceChange

Returns a new instance of OrderServiceChange.



41913
41914
41915
41916
41917
41918
41919
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41913

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :from, :to], 'OrderServiceChange')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @from = (x = opts.delete(:from); x.is_a?(::Io::Flow::V0::Models::CarrierService) ? x : ::Io::Flow::V0::Models::CarrierService.new(x))
  @to = (x = opts.delete(:to); x.is_a?(::Io::Flow::V0::Models::CarrierService) ? x : ::Io::Flow::V0::Models::CarrierService.new(x))
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



41911
41912
41913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41911

def from
  @from
end

#idObject (readonly)

Returns the value of attribute id.



41911
41912
41913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41911

def id
  @id
end

#toObject (readonly)

Returns the value of attribute to.



41911
41912
41913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41911

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41925
41926
41927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41925

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

#to_hashObject



41929
41930
41931
41932
41933
41934
41935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41929

def to_hash
  {
    :id => id,
    :from => from.to_hash,
    :to => to.to_hash
  }
end

#to_jsonObject



41921
41922
41923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41921

def to_json
  JSON.dump(to_hash)
end