Class: Io::Flow::V0::Models::OrderOptions

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

Overview

Optional behaviors to enable for this order

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderOptions

Returns a new instance of OrderOptions.



48709
48710
48711
48712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48709

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @storage = (x = (x = opts.delete(:storage); x.nil? ? "persist" : x); x.is_a?(::Io::Flow::V0::Models::OrderStorage) ? x : ::Io::Flow::V0::Models::OrderStorage.apply(x))
end

Instance Attribute Details

#storageObject (readonly)

Returns the value of attribute storage.



48707
48708
48709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48707

def storage
  @storage
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48718
48719
48720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48718

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

#to_hashObject



48722
48723
48724
48725
48726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48722

def to_hash
  {
    :storage => storage.value
  }
end

#to_jsonObject



48714
48715
48716
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48714

def to_json
  JSON.dump(to_hash)
end