Class: Io::Flow::V0::Models::OrderServiceChangeForm

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. To help with orders with multiple deliveries, we will require verification of both the current service level (from) and the new service level (to).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderServiceChangeForm

Returns a new instance of OrderServiceChangeForm.



41947
41948
41949
41950
41951
41952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41947

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:from_service_id, :to_service_id], 'OrderServiceChangeForm')
  @from_service_id = HttpClient::Preconditions.assert_class('from_service_id', opts.delete(:from_service_id), String)
  @to_service_id = HttpClient::Preconditions.assert_class('to_service_id', opts.delete(:to_service_id), String)
end

Instance Attribute Details

#from_service_idObject (readonly)

Returns the value of attribute from_service_id.



41945
41946
41947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41945

def from_service_id
  @from_service_id
end

#to_service_idObject (readonly)

Returns the value of attribute to_service_id.



41945
41946
41947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41945

def to_service_id
  @to_service_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41958
41959
41960
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41958

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

#to_hashObject



41962
41963
41964
41965
41966
41967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41962

def to_hash
  {
    :from_service_id => from_service_id,
    :to_service_id => to_service_id
  }
end

#to_jsonObject



41954
41955
41956
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41954

def to_json
  JSON.dump(to_hash)
end