Class: Io::Flow::V0::Models::ReturnPolicy
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ReturnPolicy
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A global return policy allows the user to select 1 or more items by query and to globally mark those items as non-returnable
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#statistics ⇒ Object
readonly
Returns the value of attribute statistics.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ReturnPolicy
constructor
A new instance of ReturnPolicy.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ReturnPolicy
Returns a new instance of ReturnPolicy.
49419 49420 49421 49422 49423 49424 49425 49426 49427 49428 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49419 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :q, :query, :status, :statistics], 'ReturnPolicy') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String) @query = (x = opts.delete(:query); x.is_a?(::Io::Flow::V0::Models::Query) ? x : ::Io::Flow::V0::Models::Query.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ReturnItemStatus) ? x : ::Io::Flow::V0::Models::ReturnItemStatus.apply(x)) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) @statistics = (x = opts.delete(:statistics); x.is_a?(::Io::Flow::V0::Models::ReturnPolicyStatistic) ? x : ::Io::Flow::V0::Models::ReturnPolicyStatistic.new(x)) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def id @id end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def q @q end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def query @query end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def statistics @statistics end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
49417 49418 49419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49417 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
49434 49435 49436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49434 def copy(incoming={}) ReturnPolicy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
49438 49439 49440 49441 49442 49443 49444 49445 49446 49447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49438 def to_hash { :id => id, :q => q, :query => query.to_hash, :status => status.value, :description => description, :statistics => statistics.to_hash } end |
#to_json ⇒ Object
49430 49431 49432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49430 def to_json JSON.dump(to_hash) end |