patch_ruby 1.13.0 → 1.15.2

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: 3e0f99b9d07fa162edae9b17a6391f12bd47b8ebe600c554d9a563453b8e0e7a
4
- data.tar.gz: 541bc276ca90a671cc9e823d3a9c0320faf1dcaaf95c78ad28599a5bc9956ea6
3
+ metadata.gz: 3c1030fc4a287d8dc68aefe8ba6e240506b31a22f8066202cf1ada2104159f4f
4
+ data.tar.gz: 931c2ff23b6323b3410dbebb6c9f65c1e9e77af9bfb498061b264a6b346c35c3
5
5
  SHA512:
6
- metadata.gz: 753deee059cd95468bb42ae4f0b3d1658e2a7bbbc0447d9f3565921232a7551848876dab16afcd4e720381d618e37cfa2d108cc02085858bf604afd62c7612ed
7
- data.tar.gz: 882c8eb7b5ca22f529d216627cbde573f188d2878ee230140d13ce6e5c7cea10d8959331355ffe33fc9327ef2979a4aab5c18e8532e66d70dc28822236fe2b2f
6
+ metadata.gz: 4399537cffce6cf8beafe1050ecf655b23ca1e8229b19c025d411f96346a23cc425f98289ae02addb496ff624b1d8f2e6fc8bf87ccf604c2081653d2be5041e2
7
+ data.tar.gz: b8798208043ec070f062cf91c6ec0fb7a4c0a4d0ad6b039b8ca61cd1b6d35d2e732cb6aeea100cc278369661b50aefed046506befa63bf86d7daef498da63ccb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ 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.15.2] - 2021-11-08
9
+
10
+ ### Added
11
+
12
+ - Adds highlights to project responses
13
+
14
+ ## [1.15.1] - 2021-11-04
15
+
16
+ ### Added
17
+
18
+ - Adds verifier to project responses
19
+
20
+ ## [1.15.0] - 2021-10-04
21
+
22
+ ### Added
23
+
24
+ - Added the ability to fetch project technology types via `Patch::TechnologyType.retrieve_technology_types()`
25
+
26
+ ## [1.14.0] - 2021-09-21
27
+
28
+ ### Added
29
+
30
+ - Adds mechanism, tagline, state, latitude, longitude, and technology_type to project responses
31
+
8
32
  ## [1.13.0] - 2021-09-10
9
33
 
10
34
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.13.0)
4
+ patch_ruby (1.15.2)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -18,7 +18,7 @@ GEM
18
18
  coderay (1.1.3)
19
19
  concurrent-ruby (1.1.9)
20
20
  diff-lcs (1.4.4)
21
- ethon (0.14.0)
21
+ ethon (0.15.0)
22
22
  ffi (>= 1.15.0)
23
23
  factory_bot (6.2.0)
24
24
  activesupport (>= 5.0.0)
@@ -70,6 +70,7 @@ GEM
70
70
  zeitwerk (2.4.2)
71
71
 
72
72
  PLATFORMS
73
+ arm64-darwin-20
73
74
  x86_64-darwin-20
74
75
 
75
76
  DEPENDENCIES
data/README.md CHANGED
@@ -53,9 +53,6 @@ end
53
53
 
54
54
  In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate.
55
55
 
56
- In Patch, orders represent a purchase of carbon offsets or negative emissions by mass.
57
- Place orders directly if you know the amount of carbon dioxide you would like to sequester.
58
- If you do not know how much to purchase, use an estimate.
59
56
  You can also create an order with a maximum desired price, and we'll allocate enough mass to
60
57
  fulfill the order for you.
61
58
 
@@ -218,7 +215,13 @@ page = 1 # Pass in which page of preferences you'd like
218
215
  Patch::Preference.retrieve_preferences(page: page)
219
216
  ```
220
217
 
221
- ## Development
218
+ ## Contributing
219
+
220
+ 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!
221
+
222
+ On the other hand, contributions to the README, as well as new test cases are always very welcome!
223
+
224
+ ### Testing locally
222
225
 
223
226
  To build the gem locally, run:
224
227
 
@@ -232,20 +235,16 @@ This will create a .gem file. To install the local gem:
232
235
  gem install patch_ruby-1.x.x.gem
233
236
  ```
234
237
 
235
- Install dependencies:
236
-
237
- ```bash
238
- bundle install
239
- ```
238
+ ### Running tests
240
239
 
241
- Set up required environment variables:
240
+ Set up the required environment variable.
242
241
 
243
242
  ```bash
244
243
  export SANDBOX_API_KEY=<SANDBOX API KEY>
245
244
  ```
246
245
 
247
- Run tests:
246
+ then run the tests:
248
247
 
249
248
  ```bash
250
- bundle exec rspec
249
+ make test
251
250
  ```
@@ -0,0 +1,84 @@
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 TechnologyTypesApi
17
+ OPERATIONS = [
18
+ :retrieve_technology_types,
19
+ ]
20
+
21
+ attr_accessor :api_client
22
+
23
+ def initialize(api_client = ApiClient.default)
24
+ @api_client = api_client
25
+ end
26
+ # Retrieves the list of technology_types
27
+ # Retrieves a list of all technology_types.
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [TechnologyTypeListResponse]
30
+ def retrieve_technology_types(opts = {})
31
+
32
+ data, _status_code, _headers = retrieve_technology_types_with_http_info(opts)
33
+ data
34
+ end
35
+
36
+ # Retrieves the list of technology_types
37
+ # Retrieves a list of all technology_types.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(TechnologyTypeListResponse, Integer, Hash)>] TechnologyTypeListResponse data, response status code and response headers
40
+ def retrieve_technology_types_with_http_info(opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug 'Calling API: TechnologyTypesApi.retrieve_technology_types ...'
43
+ end
44
+ # resource path
45
+ local_var_path = '/v1/projects/technology_types'
46
+
47
+ # query parameters
48
+ query_params = opts[:query_params] || {}
49
+
50
+ # header parameters
51
+ header_params = opts[:header_params] || {}
52
+ # HTTP header 'Accept' (if needed)
53
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
54
+
55
+ # form parameters
56
+ form_params = opts[:form_params] || {}
57
+
58
+ # http body (model)
59
+ post_body = opts[:debug_body]
60
+
61
+ # return_type
62
+ return_type = opts[:debug_return_type] || 'TechnologyTypeListResponse'
63
+
64
+ # auth_names
65
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
66
+
67
+ new_options = opts.merge(
68
+ :operation => :"TechnologyTypesApi.retrieve_technology_types",
69
+ :header_params => header_params,
70
+ :query_params => query_params,
71
+ :form_params => form_params,
72
+ :body => post_body,
73
+ :auth_names => auth_names,
74
+ :return_type => return_type
75
+ )
76
+
77
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug "API called: TechnologyTypesApi#retrieve_technology_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ end
81
+ return data, status_code, headers
82
+ end
83
+ end
84
+ end
@@ -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.13.0"
34
+ @user_agent = "patch-ruby/1.15.2"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -0,0 +1,264 @@
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 'date'
14
+ require 'time'
15
+
16
+ module Patch
17
+ class Highlight
18
+ # A unique identifier for each highlight.
19
+ attr_accessor :slug
20
+
21
+ # A short string that spotlights a characteristic about the project.
22
+ attr_accessor :title
23
+
24
+ # A URL for the corresponding icon.
25
+ attr_accessor :icon_url
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'slug' => :'slug',
31
+ :'title' => :'title',
32
+ :'icon_url' => :'icon_url'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'slug' => :'String',
45
+ :'title' => :'String',
46
+ :'icon_url' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+
57
+ # Allows models with corresponding API classes to delegate API operations to those API classes
58
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
59
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
60
+ def self.method_missing(message, *args, &block)
61
+ if Object.const_defined?('Patch::HighlightsApi::OPERATIONS') && Patch::HighlightsApi::OPERATIONS.include?(message)
62
+ Patch::HighlightsApi.new.send(message, *args)
63
+ else
64
+ super
65
+ end
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::Highlight` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::Highlight`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'slug')
84
+ self.slug = attributes[:'slug']
85
+ end
86
+
87
+ if attributes.key?(:'title')
88
+ self.title = attributes[:'title']
89
+ end
90
+
91
+ if attributes.key?(:'icon_url')
92
+ self.icon_url = attributes[:'icon_url']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ if @slug.nil?
101
+ invalid_properties.push('invalid value for "slug", slug cannot be nil.')
102
+ end
103
+
104
+ if @title.nil?
105
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
106
+ end
107
+
108
+ if @icon_url.nil?
109
+ invalid_properties.push('invalid value for "icon_url", icon_url cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if @slug.nil?
119
+ return false if @title.nil?
120
+ return false if @icon_url.nil?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ slug == o.slug &&
130
+ title == o.title &&
131
+ icon_url == o.icon_url
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [slug, title, icon_url].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = Patch.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+ end
264
+ end
@@ -30,7 +30,7 @@ module Patch
30
30
  # The current state of the order.
31
31
  attr_accessor :state
32
32
 
33
- # The current state of the allocated carbon offsets of the order.
33
+ # DEPRECATED. Indicates if the order has been fully allocated to projects.
34
34
  attr_accessor :allocation_state
35
35
 
36
36
  # The total price in cents USD of the carbon offsets purchased through this order.