Class: Io::Flow::V0::Clients::DimensionEstimates
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::DimensionEstimates
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_id(organization, id) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
- #get_by_id(organization, id) ⇒ Object
- #get_versions(organization, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ DimensionEstimates
constructor
A new instance of DimensionEstimates.
- #post(organization, dimension_estimate_form) ⇒ Object
- #put_by_id(organization, id, dimension_estimate_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ DimensionEstimates
Returns a new instance of DimensionEstimates.
3976 3977 3978 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3976 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
4028 4029 4030 4031 4032 4033 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4028 def delete_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/dimension-estimates/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3980 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/dimension-estimates").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::DimensionEstimate.new(x) } end |
#get_by_id(organization, id) ⇒ Object
4013 4014 4015 4016 4017 4018 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4013 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/dimension-estimates/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::DimensionEstimate.new(r) end |
#get_versions(organization, incoming = {}) ⇒ Object
4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4000 def get_versions(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "journal_timestamp" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/dimension-estimates/versions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::DimensionEstimateVersion.new(x) } end |
#post(organization, dimension_estimate_form) ⇒ Object
3993 3994 3995 3996 3997 3998 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3993 def post(organization, dimension_estimate_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = dimension_estimate_form; x.is_a?(::Io::Flow::V0::Models::DimensionEstimateForm) ? x : ::Io::Flow::V0::Models::DimensionEstimateForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/dimension-estimates").with_json(dimension_estimate_form.to_json).post ::Io::Flow::V0::Models::DimensionEstimate.new(r) end |
#put_by_id(organization, id, dimension_estimate_form) ⇒ Object
4020 4021 4022 4023 4024 4025 4026 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4020 def put_by_id(organization, id, dimension_estimate_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = dimension_estimate_form; x.is_a?(::Io::Flow::V0::Models::DimensionEstimateForm) ? x : ::Io::Flow::V0::Models::DimensionEstimateForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/dimension-estimates/#{CGI.escape(id)}").with_json(dimension_estimate_form.to_json).put ::Io::Flow::V0::Models::DimensionEstimate.new(r) end |