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.
64179 64180 64181 64182 64183 64184 64185 64186 64187 64188 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64179 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.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def id @id end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def q @q end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def query @query end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def statistics @statistics end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
64177 64178 64179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64177 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
64194 64195 64196 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64194 def copy(incoming={}) ReturnPolicy.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
64198 64199 64200 64201 64202 64203 64204 64205 64206 64207 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64198 def to_hash { :id => id, :q => q, :query => query.to_hash, :status => status.value, :description => description, :statistics => statistics.to_hash } end |
#to_json ⇒ Object
64190 64191 64192 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64190 def to_json JSON.dump(to_hash) end |