Class: Io::Flow::V0::Models::ItemShippingPricing

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

Overview

Available shipping price(s) a customer sees. This can be used for targetted ads on Google or to display shipping price(s) on a PDP.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemShippingPricing

Returns a new instance of ItemShippingPricing.



37445
37446
37447
37448
37449
37450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37445

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:min], 'ItemShippingPricing')
  @min = (x = opts.delete(:min); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



37443
37444
37445
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37443

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



37443
37444
37445
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37443

def min
  @min
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37456
37457
37458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37456

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

#to_hashObject



37460
37461
37462
37463
37464
37465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37460

def to_hash
  {
    :min => min.to_hash,
    :max => max.nil? ? nil : max.to_hash
  }
end

#to_jsonObject



37452
37453
37454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37452

def to_json
  JSON.dump(to_hash)
end