class Io::Flow::V0::Models::ReturnPolicy

A global return policy allows the user to select 1 or more items by query and to globally mark those items as non-returnable

Attributes

description[R]
id[R]
q[R]
query[R]
statistics[R]
status[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 64190
def to_json
  JSON.dump(to_hash)
end