patch_ruby 1.16.1 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc5be57ebe9bda719991c78a7e8112692b22b95d8ca2940ed9332ef451dc6a5d
4
- data.tar.gz: b62cc2d7aec1b071a272d55928b7edf428a46a3af5527ebde46d0b779e5567dd
3
+ metadata.gz: 3312ae1bca095a1ee4b912f2267748f57818ef9be2c10febd7bf5f8095bf15a4
4
+ data.tar.gz: dc08f9414555d65f420a2b8bae74a44c582b15a9702f40bd1e8a875cb094d637
5
5
  SHA512:
6
- metadata.gz: acdea515811b0cdbf21e612d9d380ffc6e2988cb0a8e47f06ef830813103578b2ea067414c1a1eb55464db931b7c816e5a724b3341ab802f848e939c9329f3a9
7
- data.tar.gz: 5d3daed43098b3bbb5a5d6f5eefa69d14a667bf000ae5cbe4de6e7f5e06e62b6867a78f468c85c0b0c7f17c6268a6981e23397f58a6f0cfd26add5a250466c28
6
+ metadata.gz: fdf4400660c261231c72654cdead5108cfe90ff6d02457b9057ae7bb8537c55f19e2edb7004604b5d9a39474d5da9222bc8ffded005e808b0c0ab718186eec15
7
+ data.tar.gz: 4680eafea0b29e4eef4a8e393c56d4b0c9ad12828fa255535035e5fa786a86ef5237cfe0bb715270e3a2b376241d2e42294eb36444da17e17452d7e606d218f9
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.18.0] - 2022-03-22
9
+ ### Changed
10
+
11
+ - Adds optional `state` field to `order` creation
12
+
13
+ ## [1.17.0] - 2022-01-11
14
+
15
+ ### Changed
16
+
17
+ - Set the order allocatations array as optional.
18
+
8
19
  ## [1.16.1] - 2022-01-07
9
20
 
10
21
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.16.1)
4
+ patch_ruby (1.18.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -22,7 +22,7 @@ GEM
22
22
  ffi (>= 1.15.0)
23
23
  factory_bot (6.2.0)
24
24
  activesupport (>= 5.0.0)
25
- ffi (1.15.4)
25
+ ffi (1.15.5)
26
26
  i18n (1.8.10)
27
27
  concurrent-ruby (~> 1.0)
28
28
  jaro_winkler (1.5.4)
@@ -71,6 +71,7 @@ GEM
71
71
 
72
72
  PLATFORMS
73
73
  arm64-darwin-20
74
+ arm64-darwin-21
74
75
  x86_64-darwin-20
75
76
 
76
77
  DEPENDENCIES
data/README.md CHANGED
@@ -188,33 +188,6 @@ Patch::Project.retrieve_projects(type: type)
188
188
  minimum_available_mass = 100
189
189
  Patch::Project.retrieve_projects(minimum_available_mass: minimum_available_mass)
190
190
  ```
191
-
192
- ### Preferences
193
-
194
- Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.patch.io/projects).
195
-
196
- [API Reference](https://docs.patch.io/#/?id=preferences)
197
-
198
- #### Examples
199
-
200
- ```ruby
201
- # Create a preference
202
- project_id = 'pro_test_1234' # Pass in the project_id for your preference
203
- Patch::Preference.create_preference(project_id: project_id)
204
-
205
- # Retrieve a preference
206
- preference_id = 'pre_test_1234' # Pass in the preferences's id
207
- Patch::Preference.retrieve_preference(preference_id)
208
-
209
- # Delete a preference
210
- preference_id = 'pre_test_1234' # Pass in the preferences's id
211
- Patch::Preference.delete_preference(preference_id)
212
-
213
- # Retrieve a list of preferences
214
- page = 1 # Pass in which page of preferences you'd like
215
- Patch::Preference.retrieve_preferences(page: page)
216
- ```
217
-
218
191
  ## Contributing
219
192
 
220
193
  While we value open-source contributions to this SDK, the core of this library is generated programmatically. Complex additions made directly to the library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
@@ -92,7 +92,7 @@ module Patch
92
92
  end
93
93
 
94
94
  # Creates an order
95
- # Creates an order in the `placed` state. To create a `draft` order, create an estimate first.
95
+ # Creates an order in the `placed` or `draft` state.
96
96
  # @param create_order_request [CreateOrderRequest]
97
97
  # @param [Hash] opts the optional parameters
98
98
  # @return [OrderResponse]
@@ -103,7 +103,7 @@ module Patch
103
103
  end
104
104
 
105
105
  # Creates an order
106
- # Creates an order in the `placed` state. To create a `draft` order, create an estimate first.
106
+ # Creates an order in the `placed` or `draft` state.
107
107
  # @param create_order_request [CreateOrderRequest]
108
108
  # @param [Hash] opts the optional parameters
109
109
  # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
@@ -31,7 +31,7 @@ module Patch
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "patch-ruby/1.16.1"
34
+ @user_agent = "patch-ruby/1.18.0"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -23,13 +23,38 @@ module Patch
23
23
 
24
24
  attr_accessor :metadata
25
25
 
26
+ attr_accessor :state
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
26
50
  # Attribute mapping from ruby-style variable name to JSON key.
27
51
  def self.attribute_map
28
52
  {
29
53
  :'mass_g' => :'mass_g',
30
54
  :'total_price_cents_usd' => :'total_price_cents_usd',
31
55
  :'project_id' => :'project_id',
32
- :'metadata' => :'metadata'
56
+ :'metadata' => :'metadata',
57
+ :'state' => :'state'
33
58
  }
34
59
  end
35
60
 
@@ -44,7 +69,8 @@ module Patch
44
69
  :'mass_g' => :'Integer',
45
70
  :'total_price_cents_usd' => :'Integer',
46
71
  :'project_id' => :'String',
47
- :'metadata' => :'Object'
72
+ :'metadata' => :'Object',
73
+ :'state' => :'String'
48
74
  }
49
75
  end
50
76
 
@@ -96,6 +122,10 @@ module Patch
96
122
  if attributes.key?(:'metadata')
97
123
  self.metadata = attributes[:'metadata']
98
124
  end
125
+
126
+ if attributes.key?(:'state')
127
+ self.state = attributes[:'state']
128
+ end
99
129
  end
100
130
 
101
131
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -123,6 +153,8 @@ module Patch
123
153
  return false if !@mass_g.nil? && @mass_g > 100000000000
124
154
  return false if !@mass_g.nil? && @mass_g < 0
125
155
  return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
156
+ state_validator = EnumAttributeValidator.new('String', ["draft", "placed"])
157
+ return false unless state_validator.valid?(@state)
126
158
  true
127
159
  end
128
160
 
@@ -150,6 +182,16 @@ module Patch
150
182
  @total_price_cents_usd = total_price_cents_usd
151
183
  end
152
184
 
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] state Object to be assigned
187
+ def state=(state)
188
+ validator = EnumAttributeValidator.new('String', ["draft", "placed"])
189
+ unless validator.valid?(state)
190
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @state = state
193
+ end
194
+
153
195
  # Checks equality by comparing each attribute.
154
196
  # @param [Object] Object to be compared
155
197
  def ==(o)
@@ -158,7 +200,8 @@ module Patch
158
200
  mass_g == o.mass_g &&
159
201
  total_price_cents_usd == o.total_price_cents_usd &&
160
202
  project_id == o.project_id &&
161
- metadata == o.metadata
203
+ metadata == o.metadata &&
204
+ state == o.state
162
205
  end
163
206
 
164
207
  # @see the `==` method
@@ -170,7 +213,7 @@ module Patch
170
213
  # Calculates hash code according to all attributes.
171
214
  # @return [Integer] Hash code
172
215
  def hash
173
- [mass_g, total_price_cents_usd, project_id, metadata].hash
216
+ [mass_g, total_price_cents_usd, project_id, metadata, state].hash
174
217
  end
175
218
 
176
219
  # Builds the object from hash
@@ -39,7 +39,7 @@ module Patch
39
39
  # The Patch Fee in cents USD for this order.
40
40
  attr_accessor :patch_fee_cents_usd
41
41
 
42
- # An array containing the inventory allocations for this order.
42
+ # DEPRECATED. An array containing the inventory allocations for this order.
43
43
  attr_accessor :allocations
44
44
 
45
45
  # The url of this order in the public registry.
@@ -223,10 +223,6 @@ module Patch
223
223
  invalid_properties.push('invalid value for "allocation_state", allocation_state cannot be nil.')
224
224
  end
225
225
 
226
- if @allocations.nil?
227
- invalid_properties.push('invalid value for "allocations", allocations cannot be nil.')
228
- end
229
-
230
226
  if @metadata.nil?
231
227
  invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
232
228
  end
@@ -248,7 +244,6 @@ module Patch
248
244
  return false if @allocation_state.nil?
249
245
  allocation_state_validator = EnumAttributeValidator.new('String', ["pending", "allocated"])
250
246
  return false unless allocation_state_validator.valid?(@allocation_state)
251
- return false if @allocations.nil?
252
247
  return false if @metadata.nil?
253
248
  true
254
249
  end
@@ -27,7 +27,7 @@ module Patch
27
27
  # The description of the project.
28
28
  attr_accessor :description
29
29
 
30
- # Deprecated. Favor the technology_type field instead.
30
+ # DEPRECATED. Favor the technology_type field instead.
31
31
  attr_accessor :type
32
32
 
33
33
  # The mechanism of the project. Either removal or avoidance.
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '1.16.1'
14
+ VERSION = '1.18.0'
15
15
  end
@@ -84,7 +84,17 @@ RSpec.describe 'Orders Integration' do
84
84
  .to all(have_key(:user))
85
85
  end
86
86
 
87
- it 'supports place and cancel for orders created via an estimate' do
87
+ it 'supports creation in draft state' do
88
+ create_order_response =
89
+ Patch::Order.create_order(mass_g: 100, state: "draft")
90
+
91
+ expect(create_order_response.success).to eq true
92
+ expect(create_order_response.data.id).not_to be_nil
93
+ expect(create_order_response.data.mass_g).to eq(100)
94
+ expect(create_order_response.data.state).to eq("draft")
95
+ end
96
+
97
+ xit 'supports place and cancel for orders created via an estimate' do
88
98
  create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
89
99
  order_to_place_id = create_estimate_to_place_response.data.order.id
90
100
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patch Technology
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -95,7 +95,6 @@ files:
95
95
  - lib/patch_ruby.rb
96
96
  - lib/patch_ruby/api/estimates_api.rb
97
97
  - lib/patch_ruby/api/orders_api.rb
98
- - lib/patch_ruby/api/preferences_api.rb
99
98
  - lib/patch_ruby/api/projects_api.rb
100
99
  - lib/patch_ruby/api/technology_types_api.rb
101
100
  - lib/patch_ruby/api_client.rb
@@ -199,48 +198,48 @@ signing_key:
199
198
  specification_version: 4
200
199
  summary: Ruby wrapper for the Patch API
201
200
  test_files:
202
- - spec/api/orders_api_spec.rb
203
- - spec/api/projects_api_spec.rb
204
201
  - spec/api/technology_types_api_spec.rb
202
+ - spec/api/orders_api_spec.rb
205
203
  - spec/api/estimates_api_spec.rb
204
+ - spec/api/projects_api_spec.rb
206
205
  - spec/api_client_spec.rb
207
206
  - spec/configuration_spec.rb
208
207
  - spec/constants.rb
209
- - spec/factories/allocations.rb
210
- - spec/factories/meta_index_objects.rb
208
+ - spec/factories/project_list_responses.rb
211
209
  - spec/factories/error_responses.rb
212
- - spec/factories/create_mass_estimate_requests.rb
213
210
  - spec/factories/sdgs.rb
214
- - spec/factories/order_responses.rb
215
- - spec/factories/order_list_responses.rb
216
- - spec/factories/estimates.rb
211
+ - spec/factories/meta_index_objects.rb
212
+ - spec/factories/create_mass_estimate_requests.rb
217
213
  - spec/factories/project_responses.rb
218
- - spec/factories/projects.rb
214
+ - spec/factories/estimates.rb
215
+ - spec/factories/parent_technology_type.rb
219
216
  - spec/factories/technology_type.rb
217
+ - spec/factories/order_responses.rb
220
218
  - spec/factories/estimate_responses.rb
219
+ - spec/factories/allocations.rb
221
220
  - spec/factories/estimate_list_responses.rb
222
221
  - spec/factories/orders.rb
223
- - spec/factories/parent_technology_type.rb
222
+ - spec/factories/projects.rb
223
+ - spec/factories/order_list_responses.rb
224
224
  - spec/factories/create_order_requests.rb
225
- - spec/factories/project_list_responses.rb
226
- - spec/integration/projects_spec.rb
227
- - spec/integration/orders_spec.rb
228
225
  - spec/integration/projects/technology_types_spec.rb
226
+ - spec/integration/orders_spec.rb
227
+ - spec/integration/projects_spec.rb
229
228
  - spec/integration/estimates_spec.rb
230
- - spec/models/allocation_spec.rb
229
+ - spec/models/project_spec.rb
231
230
  - spec/models/order_response_spec.rb
232
231
  - spec/models/error_response_spec.rb
233
- - spec/models/create_order_request_spec.rb
234
- - spec/models/project_list_response_spec.rb
235
- - spec/models/estimate_list_response_spec.rb
236
- - spec/models/project_spec.rb
237
- - spec/models/estimate_response_spec.rb
238
- - spec/models/order_list_response_spec.rb
239
- - spec/models/order_spec.rb
240
232
  - spec/models/project_response_spec.rb
241
233
  - spec/models/meta_index_object_spec.rb
242
- - spec/models/estimate_spec.rb
243
234
  - spec/models/create_mass_estimate_request_spec.rb
235
+ - spec/models/estimate_list_response_spec.rb
236
+ - spec/models/allocation_spec.rb
237
+ - spec/models/create_order_request_spec.rb
238
+ - spec/models/order_list_response_spec.rb
239
+ - spec/models/project_list_response_spec.rb
240
+ - spec/models/estimate_spec.rb
241
+ - spec/models/order_spec.rb
242
+ - spec/models/estimate_response_spec.rb
244
243
  - spec/patch_ruby_spec.rb
245
244
  - spec/spec_helper.rb
246
245
  - spec/support/shared/generated_classes.rb
@@ -1,284 +0,0 @@
1
- =begin
2
- #Patch API V1
3
-
4
- #The core API used to integrate with Patch's service
5
-
6
- The version of the OpenAPI document: v1
7
- Contact: developers@usepatch.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.1
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module Patch
16
- class PreferencesApi
17
- OPERATIONS = [
18
- :create_preference,
19
- :delete_preference,
20
- :retrieve_preference,
21
- :retrieve_preferences,
22
- ]
23
-
24
- attr_accessor :api_client
25
-
26
- def initialize(api_client = ApiClient.default)
27
- @api_client = api_client
28
- end
29
- # creates a project preference
30
- # Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to.
31
- # @param create_preference_request [CreatePreferenceRequest]
32
- # @param [Hash] opts the optional parameters
33
- # @return [PreferenceResponse]
34
- def create_preference(create_preference_request = {}, opts = {})
35
- _create_preference_request = Patch::CreatePreferenceRequest.new(create_preference_request)
36
- data, _status_code, _headers = create_preference_with_http_info(_create_preference_request, opts)
37
- data
38
- end
39
-
40
- # creates a project preference
41
- # Creates a project preference for the given organization. If you have a &#x60;preference&#x60; in place, all of your orders will be directed to the project the preference points to.
42
- # @param create_preference_request [CreatePreferenceRequest]
43
- # @param [Hash] opts the optional parameters
44
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
45
- def create_preference_with_http_info(create_preference_request, opts = {})
46
- if @api_client.config.debugging
47
- @api_client.config.logger.debug 'Calling API: PreferencesApi.create_preference ...'
48
- end
49
- # verify the required parameter 'create_preference_request' is set
50
- if @api_client.config.client_side_validation && create_preference_request.nil?
51
- fail ArgumentError, "Missing the required parameter 'create_preference_request' when calling PreferencesApi.create_preference"
52
- end
53
- # resource path
54
- local_var_path = '/v1/preferences'
55
-
56
- # query parameters
57
- query_params = opts[:query_params] || {}
58
-
59
- # header parameters
60
- header_params = opts[:header_params] || {}
61
- # HTTP header 'Accept' (if needed)
62
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
- # HTTP header 'Content-Type'
64
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
65
-
66
- # form parameters
67
- form_params = opts[:form_params] || {}
68
-
69
- # http body (model)
70
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_preference_request)
71
-
72
- # return_type
73
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
74
-
75
- # auth_names
76
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
77
-
78
- new_options = opts.merge(
79
- :operation => :"PreferencesApi.create_preference",
80
- :header_params => header_params,
81
- :query_params => query_params,
82
- :form_params => form_params,
83
- :body => post_body,
84
- :auth_names => auth_names,
85
- :return_type => return_type
86
- )
87
-
88
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
89
- if @api_client.config.debugging
90
- @api_client.config.logger.debug "API called: PreferencesApi#create_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
- end
92
- return data, status_code, headers
93
- end
94
-
95
- # Deletes an organization's preference for a project
96
- # Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one.
97
- # @param id [String]
98
- # @param [Hash] opts the optional parameters
99
- # @return [PreferenceResponse]
100
- def delete_preference(id, opts = {})
101
-
102
- data, _status_code, _headers = delete_preference_with_http_info(id, opts)
103
- data
104
- end
105
-
106
- # Deletes an organization&#39;s preference for a project
107
- # Deletes the given &#x60;preference&#x60;. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one.
108
- # @param id [String]
109
- # @param [Hash] opts the optional parameters
110
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
111
- def delete_preference_with_http_info(id, opts = {})
112
- if @api_client.config.debugging
113
- @api_client.config.logger.debug 'Calling API: PreferencesApi.delete_preference ...'
114
- end
115
- # verify the required parameter 'id' is set
116
- if @api_client.config.client_side_validation && id.nil?
117
- fail ArgumentError, "Missing the required parameter 'id' when calling PreferencesApi.delete_preference"
118
- end
119
- # resource path
120
- local_var_path = '/v1/preferences/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
121
-
122
- # query parameters
123
- query_params = opts[:query_params] || {}
124
-
125
- # header parameters
126
- header_params = opts[:header_params] || {}
127
- # HTTP header 'Accept' (if needed)
128
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
129
-
130
- # form parameters
131
- form_params = opts[:form_params] || {}
132
-
133
- # http body (model)
134
- post_body = opts[:debug_body]
135
-
136
- # return_type
137
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
138
-
139
- # auth_names
140
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
141
-
142
- new_options = opts.merge(
143
- :operation => :"PreferencesApi.delete_preference",
144
- :header_params => header_params,
145
- :query_params => query_params,
146
- :form_params => form_params,
147
- :body => post_body,
148
- :auth_names => auth_names,
149
- :return_type => return_type
150
- )
151
-
152
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
153
- if @api_client.config.debugging
154
- @api_client.config.logger.debug "API called: PreferencesApi#delete_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
- end
156
- return data, status_code, headers
157
- end
158
-
159
- # Retrieve the preference
160
- # Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization.
161
- # @param id [String]
162
- # @param [Hash] opts the optional parameters
163
- # @return [PreferenceResponse]
164
- def retrieve_preference(id, opts = {})
165
-
166
- data, _status_code, _headers = retrieve_preference_with_http_info(id, opts)
167
- data
168
- end
169
-
170
- # Retrieve the preference
171
- # Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization.
172
- # @param id [String]
173
- # @param [Hash] opts the optional parameters
174
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
175
- def retrieve_preference_with_http_info(id, opts = {})
176
- if @api_client.config.debugging
177
- @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preference ...'
178
- end
179
- # verify the required parameter 'id' is set
180
- if @api_client.config.client_side_validation && id.nil?
181
- fail ArgumentError, "Missing the required parameter 'id' when calling PreferencesApi.retrieve_preference"
182
- end
183
- # resource path
184
- local_var_path = '/v1/preferences/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
185
-
186
- # query parameters
187
- query_params = opts[:query_params] || {}
188
-
189
- # header parameters
190
- header_params = opts[:header_params] || {}
191
- # HTTP header 'Accept' (if needed)
192
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
193
-
194
- # form parameters
195
- form_params = opts[:form_params] || {}
196
-
197
- # http body (model)
198
- post_body = opts[:debug_body]
199
-
200
- # return_type
201
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
202
-
203
- # auth_names
204
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
205
-
206
- new_options = opts.merge(
207
- :operation => :"PreferencesApi.retrieve_preference",
208
- :header_params => header_params,
209
- :query_params => query_params,
210
- :form_params => form_params,
211
- :body => post_body,
212
- :auth_names => auth_names,
213
- :return_type => return_type
214
- )
215
-
216
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
217
- if @api_client.config.debugging
218
- @api_client.config.logger.debug "API called: PreferencesApi#retrieve_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
219
- end
220
- return data, status_code, headers
221
- end
222
-
223
- # Retrieves a list of preferences
224
- # Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization.
225
- # @param [Hash] opts the optional parameters
226
- # @option opts [Integer] :page
227
- # @return [PreferenceListResponse]
228
- def retrieve_preferences(opts = {})
229
-
230
- data, _status_code, _headers = retrieve_preferences_with_http_info(opts)
231
- data
232
- end
233
-
234
- # Retrieves a list of preferences
235
- # Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization.
236
- # @param [Hash] opts the optional parameters
237
- # @option opts [Integer] :page
238
- # @return [Array<(PreferenceListResponse, Integer, Hash)>] PreferenceListResponse data, response status code and response headers
239
- def retrieve_preferences_with_http_info(opts = {})
240
- if @api_client.config.debugging
241
- @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preferences ...'
242
- end
243
- # resource path
244
- local_var_path = '/v1/preferences'
245
-
246
- # query parameters
247
- query_params = opts[:query_params] || {}
248
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
249
-
250
- # header parameters
251
- header_params = opts[:header_params] || {}
252
- # HTTP header 'Accept' (if needed)
253
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
254
-
255
- # form parameters
256
- form_params = opts[:form_params] || {}
257
-
258
- # http body (model)
259
- post_body = opts[:debug_body]
260
-
261
- # return_type
262
- return_type = opts[:debug_return_type] || 'PreferenceListResponse'
263
-
264
- # auth_names
265
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
266
-
267
- new_options = opts.merge(
268
- :operation => :"PreferencesApi.retrieve_preferences",
269
- :header_params => header_params,
270
- :query_params => query_params,
271
- :form_params => form_params,
272
- :body => post_body,
273
- :auth_names => auth_names,
274
- :return_type => return_type
275
- )
276
-
277
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
278
- if @api_client.config.debugging
279
- @api_client.config.logger.debug "API called: PreferencesApi#retrieve_preferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
280
- end
281
- return data, status_code, headers
282
- end
283
- end
284
- end