Class: Io::Flow::V0::Models::ItemMargin
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemMargin
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Defines a fixed and percent margin to apply to items matching a query.
Instance Attribute Summary collapse
-
#fixed ⇒ Object
readonly
Returns the value of attribute fixed.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ItemMargin
constructor
A new instance of ItemMargin.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ItemMargin
19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19240 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :name, :q, :fixed, :percent, :position], 'ItemMargin') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String) @fixed = HttpClient::Preconditions.assert_class('fixed', HttpClient::Helper.to_big_decimal(opts.delete(:fixed)), BigDecimal) @percent = HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(opts.delete(:percent)), BigDecimal) @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer) end |
Instance Attribute Details
#fixed ⇒ Object (readonly)
Returns the value of attribute fixed.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def fixed @fixed end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def name @name end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def percent @percent end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def position @position end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
19238 19239 19240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19238 def q @q end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19256 19257 19258 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19256 def copy(incoming={}) ItemMargin.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19260 def to_hash { :id => id, :key => key, :name => name, :q => q, :fixed => fixed, :percent => percent, :position => position } end |
#to_json ⇒ Object
19252 19253 19254 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19252 def to_json JSON.dump(to_hash) end |