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.
4080 4081 4082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4080 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
4132 4133 4134 4135 4136 4137 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4132 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
4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4084 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
4117 4118 4119 4120 4121 4122 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4117 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
4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4104 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
4097 4098 4099 4100 4101 4102 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4097 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
4124 4125 4126 4127 4128 4129 4130 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4124 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 |