patch_ruby 1.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -1
- data/Gemfile.lock +3 -3
- data/README.md +41 -17
- data/lib/patch_ruby.rb +2 -0
- data/lib/patch_ruby/api/estimates_api.rb +65 -0
- data/lib/patch_ruby/api/orders_api.rb +2 -2
- data/lib/patch_ruby/configuration.rb +2 -2
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +253 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +5 -5
- data/lib/patch_ruby/models/create_order_request.rb +5 -5
- data/lib/patch_ruby/models/order.rb +18 -8
- data/lib/patch_ruby/models/project.rb +3 -3
- data/lib/patch_ruby/version.rb +1 -1
- data/patch_ruby.gemspec +1 -1
- data/spec/configuration_spec.rb +3 -3
- data/spec/integration/estimates_spec.rb +20 -0
- data/spec/integration/orders_spec.rb +9 -5
- data/spec/patch_ruby_spec.rb +18 -0
- metadata +33 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf4569e76d9ab3e100909b2e1ef6baab9bec5fdccf509cbda298bef9424cf49
|
4
|
+
data.tar.gz: 391d81d9dd2d6bd9e761c21f28ca1bb07685ef67da8b9eef138c5c41e49012d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b179c02c365df62a4f35ebb7215b5fa4fefbc143fbd76d2fc387f745d47c0d51af43af719a941f7a106903f81f060eb8af29854de811293022dc37342a4e58a3
|
7
|
+
data.tar.gz: bc742b04409a703f3fbc9d539743379dd4c35e921d6bc6ca13b938e98fb800b30223cdf5ccce169ee7870c93e02e726cdf48250d82955aa9f4c26bf3e7e4ca07
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,32 @@ 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.6.0] - 2021-07-14
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Order responses return a `registry_url` field
|
13
|
+
- Add support for Bitcoin estimates
|
14
|
+
|
15
|
+
## [1.5.2] - 2021-03-30
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Updated the value validation for certain parameters to match the API
|
20
|
+
- Added the `renewables` type
|
21
|
+
|
22
|
+
## [1.5.1] - 2021-03-02
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- Fixed a `NameError` that was thrown when `Patch::Sdg` was called. Specs have been added to ensure this does not happen again.
|
27
|
+
|
28
|
+
## [1.5.0] - 2021-03-01
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
|
32
|
+
- Changed base URL from https://api.usepatch.com to https://api.patch.io
|
33
|
+
|
8
34
|
## [1.4.0] - 2021-02-15
|
9
35
|
|
10
36
|
### Added
|
@@ -20,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
20
46
|
|
21
47
|
### Added
|
22
48
|
|
23
|
-
- Adds support for creating carbon emission estimates for flights, shipping, and vehicles. See the [docs](https://docs.
|
49
|
+
- Adds support for creating carbon emission estimates for flights, shipping, and vehicles. See the [docs](https://docs.patch.io/#/?id=estimates) for more information.
|
24
50
|
|
25
51
|
## [1.2.5] - 2020-01-08
|
26
52
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
patch_ruby (1.
|
4
|
+
patch_ruby (1.5.2)
|
5
5
|
json (~> 2.1, >= 2.1.0)
|
6
6
|
typhoeus (~> 1.0, >= 1.0.1)
|
7
7
|
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
ffi (>= 1.3.0)
|
24
24
|
factory_bot (6.1.0)
|
25
25
|
activesupport (>= 5.0.0)
|
26
|
-
ffi (1.
|
26
|
+
ffi (1.15.0)
|
27
27
|
i18n (1.8.7)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
json (2.5.1)
|
@@ -86,4 +86,4 @@ DEPENDENCIES
|
|
86
86
|
rubocop
|
87
87
|
|
88
88
|
BUNDLED WITH
|
89
|
-
2.
|
89
|
+
2.2.14
|
data/README.md
CHANGED
@@ -1,31 +1,37 @@
|
|
1
1
|
# Patch Ruby SDK
|
2
|
+
|
2
3
|
![Test](https://github.com/patch-technology/patch-ruby/workflows/Test/badge.svg)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/patch_ruby.svg)](https://badge.fury.io/rb/patch_ruby)
|
4
5
|
[![Discord](https://img.shields.io/discord/733029448558837792)](https://discord.gg/AU8543D)
|
5
6
|
|
6
|
-
The official Ruby gem for the [Patch API](https://www.
|
7
|
+
The official Ruby gem for the [Patch API](https://www.patch.io)
|
7
8
|
|
8
9
|
## Documentation
|
9
|
-
|
10
|
+
|
11
|
+
For a complete API reference, check out [Patch's API Reference.](https://docs.patch.io/)
|
10
12
|
|
11
13
|
## Installation
|
12
14
|
|
13
15
|
Add the gem to your Gemfile:
|
16
|
+
|
14
17
|
```ruby
|
15
18
|
gem 'patch_ruby'
|
16
19
|
```
|
17
20
|
|
18
21
|
Then run:
|
22
|
+
|
19
23
|
```shell
|
20
24
|
bundle
|
21
25
|
```
|
22
26
|
|
23
27
|
Or install it directly with
|
28
|
+
|
24
29
|
```shell
|
25
30
|
gem install patch_ruby
|
26
31
|
```
|
27
32
|
|
28
33
|
### Requirements
|
34
|
+
|
29
35
|
- Ruby 1.9+
|
30
36
|
|
31
37
|
## Usage
|
@@ -33,6 +39,7 @@ gem install patch_ruby
|
|
33
39
|
### Configuration
|
34
40
|
|
35
41
|
After installing the gem, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard:
|
42
|
+
|
36
43
|
```ruby
|
37
44
|
require 'patch_ruby'
|
38
45
|
|
@@ -43,6 +50,7 @@ end
|
|
43
50
|
```
|
44
51
|
|
45
52
|
### Orders
|
53
|
+
|
46
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.
|
47
55
|
|
48
56
|
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass.
|
@@ -51,9 +59,10 @@ If you do not know how much to purchase, use an estimate.
|
|
51
59
|
You can also create an order with a maximum desired price, and we'll allocate enough mass to
|
52
60
|
fulfill the order for you.
|
53
61
|
|
54
|
-
[API Reference](https://docs.
|
62
|
+
[API Reference](https://docs.patch.io/#/?id=orders)
|
55
63
|
|
56
64
|
#### Examples
|
65
|
+
|
57
66
|
```ruby
|
58
67
|
# Create an order - you can create an order
|
59
68
|
# providing either mass_g or total_price_cents_usd, but not both
|
@@ -92,11 +101,13 @@ Patch::Order.retrieve_orders(page: page)
|
|
92
101
|
```
|
93
102
|
|
94
103
|
### Estimates
|
104
|
+
|
95
105
|
Estimates allow API users to get a quote for the cost of compensating a certain amount of CO2. When creating an estimate, an order in the `draft` state will also be created, reserving the allocation of a project for 5 minutes. If you don't place your draft order within those 5 minutes, the order will automatically be cancelled.
|
96
106
|
|
97
|
-
[API Reference](https://docs.
|
107
|
+
[API Reference](https://docs.patch.io/#/?id=estimates)
|
98
108
|
|
99
109
|
#### Examples
|
110
|
+
|
100
111
|
```ruby
|
101
112
|
# Create a mass estimate
|
102
113
|
mass = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
|
@@ -128,6 +139,10 @@ Patch::Estimate.create_vehicle_estimate(
|
|
128
139
|
year: year
|
129
140
|
)
|
130
141
|
|
142
|
+
# Create a flight estimate
|
143
|
+
transaction_value_btc_sats = 1000; # [Optional] Pass in the transaction value in satoshis
|
144
|
+
Patch::Estimate.create_bitcoin_estimate(transaction_value_btc_sats: transaction_value_btc_sats)
|
145
|
+
|
131
146
|
## You can also specify a project-id field (optional) to be used instead of the preferred one
|
132
147
|
project_id = 'pro_test_1234' # Pass in the project's ID
|
133
148
|
Patch::Estimate.create_mass_estimate(mass_g: mass, project_id: project_id)
|
@@ -142,6 +157,7 @@ Patch::Estimate.retrieve_estimates(page: page)
|
|
142
157
|
```
|
143
158
|
|
144
159
|
### Projects
|
160
|
+
|
145
161
|
Projects are the ways Patch takes CO2 out of the air. They can represent reforestation, enhanced weathering, direct air carbon capture, etc. When you place an order via Patch, it is allocated to a project.
|
146
162
|
|
147
163
|
When fetching Projects, you can add filters to the query to narrow the result. Currently supported filters are:
|
@@ -150,9 +166,10 @@ When fetching Projects, you can add filters to the query to narrow the result. C
|
|
150
166
|
- `type`
|
151
167
|
- `minimum_available_mass`
|
152
168
|
|
153
|
-
[API Reference](https://docs.
|
169
|
+
[API Reference](https://docs.patch.io/#/?id=projects)
|
154
170
|
|
155
171
|
#### Examples
|
172
|
+
|
156
173
|
```ruby
|
157
174
|
# Retrieve a project
|
158
175
|
project_id = 'pro_test_1234' # Pass in the project's ID
|
@@ -176,11 +193,13 @@ Patch::Project.retrieve_projects(minimum_available_mass: minimum_available_mass)
|
|
176
193
|
```
|
177
194
|
|
178
195
|
### Preferences
|
179
|
-
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.usepatch.com/projects).
|
180
196
|
|
181
|
-
|
197
|
+
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).
|
198
|
+
|
199
|
+
[API Reference](https://docs.patch.io/#/?id=preferences)
|
182
200
|
|
183
201
|
#### Examples
|
202
|
+
|
184
203
|
```ruby
|
185
204
|
# Create a preference
|
186
205
|
project_id = 'pro_test_1234' # Pass in the project_id for your preference
|
@@ -202,26 +221,31 @@ Patch::Preference.retrieve_preferences(page: page)
|
|
202
221
|
## Development
|
203
222
|
|
204
223
|
To build the gem locally, run:
|
205
|
-
|
206
|
-
|
224
|
+
|
225
|
+
```bash
|
226
|
+
gem build patch_ruby.gemspec
|
207
227
|
```
|
208
228
|
|
209
229
|
This will create a .gem file. To install the local gem:
|
210
|
-
|
211
|
-
|
230
|
+
|
231
|
+
```bash
|
232
|
+
gem install patch_ruby-1.x.x.gem
|
212
233
|
```
|
213
234
|
|
214
235
|
Install dependencies:
|
215
|
-
|
216
|
-
|
236
|
+
|
237
|
+
```bash
|
238
|
+
bundle install
|
217
239
|
```
|
218
240
|
|
219
241
|
Set up required environment variables:
|
220
|
-
|
221
|
-
|
242
|
+
|
243
|
+
```bash
|
244
|
+
export SANDBOX_API_KEY=<SANDBOX API KEY>
|
222
245
|
```
|
223
246
|
|
224
247
|
Run tests:
|
225
|
-
|
226
|
-
|
248
|
+
|
249
|
+
```bash
|
250
|
+
bundle exec rspec
|
227
251
|
```
|
data/lib/patch_ruby.rb
CHANGED
@@ -18,6 +18,7 @@ require 'patch_ruby/configuration'
|
|
18
18
|
|
19
19
|
# Models
|
20
20
|
require 'patch_ruby/models/allocation'
|
21
|
+
require 'patch_ruby/models/create_bitcoin_estimate_request'
|
21
22
|
require 'patch_ruby/models/create_mass_estimate_request'
|
22
23
|
require 'patch_ruby/models/create_order_request'
|
23
24
|
require 'patch_ruby/models/create_preference_request'
|
@@ -36,6 +37,7 @@ require 'patch_ruby/models/preference_response'
|
|
36
37
|
require 'patch_ruby/models/project'
|
37
38
|
require 'patch_ruby/models/project_list_response'
|
38
39
|
require 'patch_ruby/models/project_response'
|
40
|
+
require 'patch_ruby/models/sdg'
|
39
41
|
require 'patch_ruby/models/standard'
|
40
42
|
|
41
43
|
# APIs
|
@@ -15,6 +15,7 @@ require 'cgi'
|
|
15
15
|
module Patch
|
16
16
|
class EstimatesApi
|
17
17
|
OPERATIONS = [
|
18
|
+
:create_bitcoin_estimate,
|
18
19
|
:create_flight_estimate,
|
19
20
|
:create_mass_estimate,
|
20
21
|
:create_shipping_estimate,
|
@@ -28,6 +29,70 @@ module Patch
|
|
28
29
|
def initialize(api_client = ApiClient.default)
|
29
30
|
@api_client = api_client
|
30
31
|
end
|
32
|
+
# Create a bitcoin estimate given a timestamp and transaction value
|
33
|
+
# Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
34
|
+
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [EstimateResponse]
|
37
|
+
def create_bitcoin_estimate(create_bitcoin_estimate_request, opts = {})
|
38
|
+
data, _status_code, _headers = create_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, opts)
|
39
|
+
data
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create a bitcoin estimate given a timestamp and transaction value
|
43
|
+
# Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
44
|
+
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
|
45
|
+
# @param [Hash] opts the optional parameters
|
46
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
47
|
+
def create_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, opts = {})
|
48
|
+
if @api_client.config.debugging
|
49
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_bitcoin_estimate ...'
|
50
|
+
end
|
51
|
+
# verify the required parameter 'create_bitcoin_estimate_request' is set
|
52
|
+
if @api_client.config.client_side_validation && create_bitcoin_estimate_request.nil?
|
53
|
+
fail ArgumentError, "Missing the required parameter 'create_bitcoin_estimate_request' when calling EstimatesApi.create_bitcoin_estimate"
|
54
|
+
end
|
55
|
+
# resource path
|
56
|
+
local_var_path = '/v1/estimates/crypto/btc'
|
57
|
+
|
58
|
+
# query parameters
|
59
|
+
query_params = opts[:query_params] || {}
|
60
|
+
|
61
|
+
# header parameters
|
62
|
+
header_params = opts[:header_params] || {}
|
63
|
+
# HTTP header 'Accept' (if needed)
|
64
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
65
|
+
# HTTP header 'Content-Type'
|
66
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
67
|
+
|
68
|
+
# form parameters
|
69
|
+
form_params = opts[:form_params] || {}
|
70
|
+
|
71
|
+
# http body (model)
|
72
|
+
post_body = opts[:body] || @api_client.object_to_http_body(create_bitcoin_estimate_request)
|
73
|
+
|
74
|
+
# return_type
|
75
|
+
return_type = opts[:return_type] || 'EstimateResponse'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:auth_names] || ['bearer_auth']
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:header_params => header_params,
|
82
|
+
:query_params => query_params,
|
83
|
+
:form_params => form_params,
|
84
|
+
:body => post_body,
|
85
|
+
:auth_names => auth_names,
|
86
|
+
:return_type => return_type
|
87
|
+
)
|
88
|
+
|
89
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
90
|
+
if @api_client.config.debugging
|
91
|
+
@api_client.config.logger.debug "API called: EstimatesApi#create_bitcoin_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
92
|
+
end
|
93
|
+
return data, status_code, headers
|
94
|
+
end
|
95
|
+
|
31
96
|
# Create a flight estimate given the distance traveled in meters
|
32
97
|
# Creates a flight estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
33
98
|
# @param create_flight_estimate_request [CreateFlightEstimateRequest]
|
@@ -28,7 +28,7 @@ module Patch
|
|
28
28
|
@api_client = api_client
|
29
29
|
end
|
30
30
|
# Cancel an order
|
31
|
-
# Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled.
|
31
|
+
# Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled.
|
32
32
|
# @param id [String]
|
33
33
|
# @param [Hash] opts the optional parameters
|
34
34
|
# @return [OrderResponse]
|
@@ -38,7 +38,7 @@ module Patch
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# Cancel an order
|
41
|
-
# Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` state can be cancelled.
|
41
|
+
# Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled.
|
42
42
|
# @param id [String]
|
43
43
|
# @param [Hash] opts the optional parameters
|
44
44
|
# @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers
|
@@ -127,7 +127,7 @@ module Patch
|
|
127
127
|
|
128
128
|
def initialize
|
129
129
|
@scheme = 'https'
|
130
|
-
@host = 'api.
|
130
|
+
@host = 'api.patch.io'
|
131
131
|
@base_path = ''
|
132
132
|
@api_key = {}
|
133
133
|
@api_key_prefix = {}
|
@@ -212,7 +212,7 @@ module Patch
|
|
212
212
|
variables: {
|
213
213
|
defaultHost: {
|
214
214
|
description: "No description provided",
|
215
|
-
default_value: "api.
|
215
|
+
default_value: "api.patch.io",
|
216
216
|
}
|
217
217
|
}
|
218
218
|
}
|
@@ -0,0 +1,253 @@
|
|
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: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Patch
|
16
|
+
class CreateBitcoinEstimateRequest
|
17
|
+
attr_accessor :timestamp
|
18
|
+
|
19
|
+
attr_accessor :transaction_value_btc_sats
|
20
|
+
|
21
|
+
attr_accessor :project_id
|
22
|
+
|
23
|
+
attr_accessor :create_order
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'timestamp' => :'timestamp',
|
29
|
+
:'transaction_value_btc_sats' => :'transaction_value_btc_sats',
|
30
|
+
:'project_id' => :'project_id',
|
31
|
+
:'create_order' => :'create_order'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'timestamp' => :'String',
|
39
|
+
:'transaction_value_btc_sats' => :'Integer',
|
40
|
+
:'project_id' => :'String',
|
41
|
+
:'create_order' => :'Boolean'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Set with nullable attributes.
|
46
|
+
def self.openapi_nullable
|
47
|
+
nullable_properties = Set.new
|
48
|
+
|
49
|
+
nullable_properties.add("timestamp")
|
50
|
+
|
51
|
+
nullable_properties.add("transaction_value_btc_sats")
|
52
|
+
|
53
|
+
nullable_properties.add("project_id")
|
54
|
+
|
55
|
+
nullable_properties.add("create_order")
|
56
|
+
|
57
|
+
nullable_properties
|
58
|
+
end
|
59
|
+
|
60
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
61
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
62
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
63
|
+
def self.method_missing(message, *args, &block)
|
64
|
+
if Object.const_defined?('Patch::CreateBitcoinEstimateRequestsApi::OPERATIONS') && Patch::CreateBitcoinEstimateRequestsApi::OPERATIONS.include?(message)
|
65
|
+
Patch::CreateBitcoinEstimateRequestsApi.new.send(message, *args)
|
66
|
+
else
|
67
|
+
super
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateBitcoinEstimateRequest` initialize method"
|
76
|
+
end
|
77
|
+
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateBitcoinEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
85
|
+
|
86
|
+
if attributes.key?(:'timestamp')
|
87
|
+
self.timestamp = attributes[:'timestamp']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'transaction_value_btc_sats')
|
91
|
+
self.transaction_value_btc_sats = attributes[:'transaction_value_btc_sats']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'project_id')
|
95
|
+
self.project_id = attributes[:'project_id']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'create_order')
|
99
|
+
self.create_order = attributes[:'create_order']
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
104
|
+
# @return Array for valid properties with the reasons
|
105
|
+
def list_invalid_properties
|
106
|
+
invalid_properties = Array.new
|
107
|
+
invalid_properties
|
108
|
+
end
|
109
|
+
|
110
|
+
# Check to see if the all the properties in the model are valid
|
111
|
+
# @return true if the model is valid
|
112
|
+
def valid?
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Checks equality by comparing each attribute.
|
117
|
+
# @param [Object] Object to be compared
|
118
|
+
def ==(o)
|
119
|
+
return true if self.equal?(o)
|
120
|
+
self.class == o.class &&
|
121
|
+
timestamp == o.timestamp &&
|
122
|
+
transaction_value_btc_sats == o.transaction_value_btc_sats &&
|
123
|
+
project_id == o.project_id &&
|
124
|
+
create_order == o.create_order
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[timestamp, transaction_value_btc_sats, project_id, create_order].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def self.build_from_hash(attributes)
|
143
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.openapi_types.each_pair do |key, type|
|
152
|
+
if type =~ /\AArray<(.*)>/i
|
153
|
+
# check to ensure the input is an array given that the attribute
|
154
|
+
# is documented as an array but the input is not
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
157
|
+
end
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
|
163
|
+
self
|
164
|
+
end
|
165
|
+
|
166
|
+
# Deserializes the data based on type
|
167
|
+
# @param string type Data type
|
168
|
+
# @param string value Value to be deserialized
|
169
|
+
# @return [Object] Deserialized data
|
170
|
+
def _deserialize(type, value)
|
171
|
+
case type.to_sym
|
172
|
+
when :DateTime
|
173
|
+
DateTime.parse(value)
|
174
|
+
when :Date
|
175
|
+
Date.parse(value)
|
176
|
+
when :String
|
177
|
+
value.to_s
|
178
|
+
when :Integer
|
179
|
+
value.to_i
|
180
|
+
when :Float
|
181
|
+
value.to_f
|
182
|
+
when :Boolean
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
184
|
+
true
|
185
|
+
else
|
186
|
+
false
|
187
|
+
end
|
188
|
+
when :Object
|
189
|
+
# generic object (usually a Hash), return directly
|
190
|
+
value
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each do |k, v|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
else # model
|
203
|
+
Patch.const_get(type).build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the object in the form of hash
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_hash
|
222
|
+
hash = {}
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
224
|
+
value = self.send(attr)
|
225
|
+
if value.nil?
|
226
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
227
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
228
|
+
end
|
229
|
+
|
230
|
+
hash[param] = _to_hash(value)
|
231
|
+
end
|
232
|
+
hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Outputs non-array value in the form of hash
|
236
|
+
# For object, use to_hash. Otherwise, just return the value
|
237
|
+
# @param [Object] value Any valid value
|
238
|
+
# @return [Hash] Returns the value in the form of hash
|
239
|
+
def _to_hash(value)
|
240
|
+
if value.is_a?(Array)
|
241
|
+
value.compact.map { |v| _to_hash(v) }
|
242
|
+
elsif value.is_a?(Hash)
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
245
|
+
end
|
246
|
+
elsif value.respond_to? :to_hash
|
247
|
+
value.to_hash
|
248
|
+
else
|
249
|
+
value
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -98,8 +98,8 @@ module Patch
|
|
98
98
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
99
99
|
end
|
100
100
|
|
101
|
-
if @mass_g <
|
102
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
101
|
+
if @mass_g < 0
|
102
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
103
103
|
end
|
104
104
|
|
105
105
|
invalid_properties
|
@@ -110,7 +110,7 @@ module Patch
|
|
110
110
|
def valid?
|
111
111
|
return false if @mass_g.nil?
|
112
112
|
return false if @mass_g > 2000000000
|
113
|
-
return false if @mass_g <
|
113
|
+
return false if @mass_g < 0
|
114
114
|
true
|
115
115
|
end
|
116
116
|
|
@@ -125,8 +125,8 @@ module Patch
|
|
125
125
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
126
126
|
end
|
127
127
|
|
128
|
-
if mass_g <
|
129
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
128
|
+
if mass_g < 0
|
129
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
130
130
|
end
|
131
131
|
|
132
132
|
@mass_g = mass_g
|
@@ -100,8 +100,8 @@ module Patch
|
|
100
100
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
101
101
|
end
|
102
102
|
|
103
|
-
if !@mass_g.nil? && @mass_g <
|
104
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
103
|
+
if !@mass_g.nil? && @mass_g < 0
|
104
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
105
105
|
end
|
106
106
|
|
107
107
|
if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
@@ -115,7 +115,7 @@ module Patch
|
|
115
115
|
# @return true if the model is valid
|
116
116
|
def valid?
|
117
117
|
return false if !@mass_g.nil? && @mass_g > 2000000000
|
118
|
-
return false if !@mass_g.nil? && @mass_g <
|
118
|
+
return false if !@mass_g.nil? && @mass_g < 0
|
119
119
|
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
120
120
|
true
|
121
121
|
end
|
@@ -127,8 +127,8 @@ module Patch
|
|
127
127
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
128
128
|
end
|
129
129
|
|
130
|
-
if !mass_g.nil? && mass_g <
|
131
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
130
|
+
if !mass_g.nil? && mass_g < 0
|
131
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
132
132
|
end
|
133
133
|
|
134
134
|
@mass_g = mass_g
|
@@ -38,6 +38,9 @@ module Patch
|
|
38
38
|
# An array containing the inventory allocations for this order.
|
39
39
|
attr_accessor :allocations
|
40
40
|
|
41
|
+
# The url of this order in the public registry.
|
42
|
+
attr_accessor :registry_url
|
43
|
+
|
41
44
|
# An optional JSON object containing metadata for this order.
|
42
45
|
attr_accessor :metadata
|
43
46
|
|
@@ -74,6 +77,7 @@ module Patch
|
|
74
77
|
:'price_cents_usd' => :'price_cents_usd',
|
75
78
|
:'patch_fee_cents_usd' => :'patch_fee_cents_usd',
|
76
79
|
:'allocations' => :'allocations',
|
80
|
+
:'registry_url' => :'registry_url',
|
77
81
|
:'metadata' => :'metadata'
|
78
82
|
}
|
79
83
|
end
|
@@ -89,6 +93,7 @@ module Patch
|
|
89
93
|
:'price_cents_usd' => :'String',
|
90
94
|
:'patch_fee_cents_usd' => :'String',
|
91
95
|
:'allocations' => :'Array<Allocation>',
|
96
|
+
:'registry_url' => :'String',
|
92
97
|
:'metadata' => :'Object'
|
93
98
|
}
|
94
99
|
end
|
@@ -164,6 +169,10 @@ module Patch
|
|
164
169
|
end
|
165
170
|
end
|
166
171
|
|
172
|
+
if attributes.key?(:'registry_url')
|
173
|
+
self.registry_url = attributes[:'registry_url']
|
174
|
+
end
|
175
|
+
|
167
176
|
if attributes.key?(:'metadata')
|
168
177
|
self.metadata = attributes[:'metadata']
|
169
178
|
end
|
@@ -185,8 +194,8 @@ module Patch
|
|
185
194
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
186
195
|
end
|
187
196
|
|
188
|
-
if @mass_g <
|
189
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
197
|
+
if @mass_g < 0
|
198
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
190
199
|
end
|
191
200
|
|
192
201
|
if @production.nil?
|
@@ -218,10 +227,10 @@ module Patch
|
|
218
227
|
return false if @id.nil?
|
219
228
|
return false if @mass_g.nil?
|
220
229
|
return false if @mass_g > 2000000000
|
221
|
-
return false if @mass_g <
|
230
|
+
return false if @mass_g < 0
|
222
231
|
return false if @production.nil?
|
223
232
|
return false if @state.nil?
|
224
|
-
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
|
233
|
+
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "complete", "cancelled"])
|
225
234
|
return false unless state_validator.valid?(@state)
|
226
235
|
return false if @allocation_state.nil?
|
227
236
|
allocation_state_validator = EnumAttributeValidator.new('String', ["pending", "partially_allocated", "allocated"])
|
@@ -242,8 +251,8 @@ module Patch
|
|
242
251
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
243
252
|
end
|
244
253
|
|
245
|
-
if mass_g <
|
246
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
254
|
+
if mass_g < 0
|
255
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
247
256
|
end
|
248
257
|
|
249
258
|
@mass_g = mass_g
|
@@ -252,7 +261,7 @@ module Patch
|
|
252
261
|
# Custom attribute writer method checking allowed values (enum).
|
253
262
|
# @param [Object] state Object to be assigned
|
254
263
|
def state=(state)
|
255
|
-
validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
|
264
|
+
validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "complete", "cancelled"])
|
256
265
|
unless validator.valid?(state)
|
257
266
|
fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
|
258
267
|
end
|
@@ -282,6 +291,7 @@ module Patch
|
|
282
291
|
price_cents_usd == o.price_cents_usd &&
|
283
292
|
patch_fee_cents_usd == o.patch_fee_cents_usd &&
|
284
293
|
allocations == o.allocations &&
|
294
|
+
registry_url == o.registry_url &&
|
285
295
|
metadata == o.metadata
|
286
296
|
end
|
287
297
|
|
@@ -294,7 +304,7 @@ module Patch
|
|
294
304
|
# Calculates hash code according to all attributes.
|
295
305
|
# @return [Integer] Hash code
|
296
306
|
def hash
|
297
|
-
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, metadata].hash
|
307
|
+
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
|
298
308
|
end
|
299
309
|
|
300
310
|
# Builds the object from hash
|
@@ -26,7 +26,7 @@ module Patch
|
|
26
26
|
# The description of the project.
|
27
27
|
attr_accessor :description
|
28
28
|
|
29
|
-
# The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil.
|
29
|
+
# The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil.
|
30
30
|
attr_accessor :type
|
31
31
|
|
32
32
|
# The country of origin of the project.
|
@@ -246,7 +246,7 @@ module Patch
|
|
246
246
|
return false if @production.nil?
|
247
247
|
return false if @name.nil?
|
248
248
|
return false if @description.nil?
|
249
|
-
type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
|
249
|
+
type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
250
250
|
return false unless type_validator.valid?(@type)
|
251
251
|
return false if @country.nil?
|
252
252
|
return false if @developer.nil?
|
@@ -258,7 +258,7 @@ module Patch
|
|
258
258
|
# Custom attribute writer method checking allowed values (enum).
|
259
259
|
# @param [Object] type Object to be assigned
|
260
260
|
def type=(type)
|
261
|
-
validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
|
261
|
+
validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
262
262
|
unless validator.valid?(type)
|
263
263
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
264
264
|
end
|
data/lib/patch_ruby/version.rb
CHANGED
data/patch_ruby.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.platform = Gem::Platform::RUBY
|
22
22
|
s.authors = ["Patch Technology"]
|
23
23
|
s.email = ["developers@usepatch.com"]
|
24
|
-
s.homepage = "https://www.
|
24
|
+
s.homepage = "https://www.patch.io"
|
25
25
|
s.summary = "Ruby wrapper for the Patch API"
|
26
26
|
s.description = "Ruby wrapper for the Patch API"
|
27
27
|
s.license = 'MIT'
|
data/spec/configuration_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe Patch::Configuration do
|
|
18
18
|
before(:each) do
|
19
19
|
# uncomment below to setup host and base_path
|
20
20
|
# require 'URI'
|
21
|
-
# uri = URI.parse("https://api.
|
21
|
+
# uri = URI.parse("https://api.patch.io")
|
22
22
|
# Patch.configure do |c|
|
23
23
|
# c.host = uri.host
|
24
24
|
# c.base_path = uri.path
|
@@ -28,14 +28,14 @@ describe Patch::Configuration do
|
|
28
28
|
describe '#base_url' do
|
29
29
|
it 'should have the default value' do
|
30
30
|
# uncomment below to test default value of the base path
|
31
|
-
# expect(config.base_url).to eq("https://api.
|
31
|
+
# expect(config.base_url).to eq("https://api.patch.io")
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should remove trailing slashes' do
|
35
35
|
[nil, '', '/', '//'].each do |base_path|
|
36
36
|
config.base_path = base_path
|
37
37
|
# uncomment below to test trailing slashes
|
38
|
-
# expect(config.base_url).to eq("https://api.
|
38
|
+
# expect(config.base_url).to eq("https://api.patch.io")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -79,4 +79,24 @@ RSpec.describe 'Estimates Integration' do
|
|
79
79
|
expect(create_estimate_response.data.type).to eq 'shipping'
|
80
80
|
expect(create_estimate_response.data.mass_g).to eq 12_431
|
81
81
|
end
|
82
|
+
|
83
|
+
it 'supports creating bitcoin estimates with partial information' do
|
84
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate({ create_order: false })
|
85
|
+
|
86
|
+
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
87
|
+
expect(bitcoin_estimate.data.mass_g).to be >= 2_000
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'supports creating bitcoin estimates with a transaction amount' do
|
91
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate(
|
92
|
+
transaction_value_btc_sats: 10_000
|
93
|
+
)
|
94
|
+
|
95
|
+
bitcoin_estimate_2 = Patch::Estimate.create_bitcoin_estimate(
|
96
|
+
transaction_value_btc_sats: 100_000
|
97
|
+
)
|
98
|
+
|
99
|
+
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
100
|
+
expect(bitcoin_estimate.data.mass_g).to be < bitcoin_estimate_2.data.mass_g
|
101
|
+
end
|
82
102
|
end
|
@@ -40,11 +40,13 @@ RSpec.describe 'Orders Integration' do
|
|
40
40
|
|
41
41
|
create_order_response = Patch::Order.create_order(mass_g: order_mass_g, project_id: project_id)
|
42
42
|
|
43
|
+
order = create_order_response.data
|
43
44
|
expect(create_order_response.success).to eq true
|
44
|
-
expect(
|
45
|
-
expect(
|
46
|
-
expect(
|
47
|
-
expect(
|
45
|
+
expect(order.id).not_to be_nil
|
46
|
+
expect(order.mass_g).to eq(order_mass_g)
|
47
|
+
expect(order.price_cents_usd.to_i).to be_between(expected_price - 2, expected_price + 2)
|
48
|
+
expect(order.patch_fee_cents_usd).not_to be_empty
|
49
|
+
expect(order.registry_url).not_to be_empty
|
48
50
|
end
|
49
51
|
|
50
52
|
it 'supports create with a total price' do
|
@@ -65,12 +67,14 @@ RSpec.describe 'Orders Integration' do
|
|
65
67
|
order = create_order_response.data
|
66
68
|
|
67
69
|
expect(order.id).not_to be_nil
|
68
|
-
expect(order.mass_g).to
|
70
|
+
expect(order.mass_g).to be > 450_000
|
71
|
+
expect(order.mass_g).to be < 460_000
|
69
72
|
expect(order.price_cents_usd).not_to be_empty
|
70
73
|
expect(order.patch_fee_cents_usd).not_to be_empty
|
71
74
|
expect(
|
72
75
|
order.price_cents_usd.to_i + order.patch_fee_cents_usd.to_i
|
73
76
|
).to eq(total_price_cents_usd)
|
77
|
+
expect(order.registry_url).not_to be_empty
|
74
78
|
end
|
75
79
|
|
76
80
|
it 'supports create with metadata' do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
describe Patch do
|
2
|
+
context 'Models' do
|
3
|
+
it 'defines all models' do
|
4
|
+
constants.each do |constant|
|
5
|
+
expect { Patch.const_get(constant) }.not_to raise_error
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def constants
|
11
|
+
# Given a file path return the constant of that path, for example:
|
12
|
+
# 'lib/patch_ruby/models/project_response.rb' -> ProjectResponse
|
13
|
+
Dir.glob("lib/patch_ruby/models/*.rb").map do |file|
|
14
|
+
parsed_filename = file.split('/').last.split('.').first
|
15
|
+
constant = parsed_filename.split('_').map(&:capitalize).join('')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
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.
|
4
|
+
version: 1.6.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: 2021-
|
11
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/patch_ruby/api_error.rb
|
93
93
|
- lib/patch_ruby/configuration.rb
|
94
94
|
- lib/patch_ruby/models/allocation.rb
|
95
|
+
- lib/patch_ruby/models/create_bitcoin_estimate_request.rb
|
95
96
|
- lib/patch_ruby/models/create_mass_estimate_request.rb
|
96
97
|
- lib/patch_ruby/models/create_order_request.rb
|
97
98
|
- lib/patch_ruby/models/create_preference_request.rb
|
@@ -161,9 +162,10 @@ files:
|
|
161
162
|
- spec/models/project_list_response_spec.rb
|
162
163
|
- spec/models/project_response_spec.rb
|
163
164
|
- spec/models/project_spec.rb
|
165
|
+
- spec/patch_ruby_spec.rb
|
164
166
|
- spec/spec_helper.rb
|
165
167
|
- spec/support/shared/generated_classes.rb
|
166
|
-
homepage: https://www.
|
168
|
+
homepage: https://www.patch.io
|
167
169
|
licenses:
|
168
170
|
- MIT
|
169
171
|
metadata: {}
|
@@ -187,52 +189,53 @@ signing_key:
|
|
187
189
|
specification_version: 4
|
188
190
|
summary: Ruby wrapper for the Patch API
|
189
191
|
test_files:
|
190
|
-
- spec/api/
|
192
|
+
- spec/api/preferences_api_spec.rb
|
191
193
|
- spec/api/projects_api_spec.rb
|
192
194
|
- spec/api/estimates_api_spec.rb
|
193
|
-
- spec/api/
|
195
|
+
- spec/api/orders_api_spec.rb
|
194
196
|
- spec/api_client_spec.rb
|
195
197
|
- spec/configuration_spec.rb
|
196
198
|
- spec/constants.rb
|
197
|
-
- spec/factories/project_responses.rb
|
198
|
-
- spec/factories/create_preference_requests.rb
|
199
|
-
- spec/factories/meta_index_objects.rb
|
200
|
-
- spec/factories/project_list_responses.rb
|
201
|
-
- spec/factories/orders.rb
|
202
199
|
- spec/factories/order_list_responses.rb
|
203
|
-
- spec/factories/order_responses.rb
|
204
200
|
- spec/factories/preferences.rb
|
205
|
-
- spec/factories/
|
206
|
-
- spec/factories/error_responses.rb
|
201
|
+
- spec/factories/project_responses.rb
|
207
202
|
- spec/factories/estimates.rb
|
203
|
+
- spec/factories/preference_responses.rb
|
208
204
|
- spec/factories/estimate_list_responses.rb
|
209
|
-
- spec/factories/
|
210
|
-
- spec/factories/
|
211
|
-
- spec/factories/
|
212
|
-
- spec/factories/
|
205
|
+
- spec/factories/create_preference_requests.rb
|
206
|
+
- spec/factories/project_list_responses.rb
|
207
|
+
- spec/factories/error_responses.rb
|
208
|
+
- spec/factories/meta_index_objects.rb
|
213
209
|
- spec/factories/preference_list_responses.rb
|
210
|
+
- spec/factories/projects.rb
|
214
211
|
- spec/factories/create_mass_estimate_requests.rb
|
215
|
-
- spec/
|
216
|
-
- spec/
|
212
|
+
- spec/factories/order_responses.rb
|
213
|
+
- spec/factories/allocations.rb
|
214
|
+
- spec/factories/orders.rb
|
215
|
+
- spec/factories/create_order_requests.rb
|
216
|
+
- spec/factories/estimate_responses.rb
|
217
217
|
- spec/integration/orders_spec.rb
|
218
|
+
- spec/integration/preferences_spec.rb
|
219
|
+
- spec/integration/estimates_spec.rb
|
218
220
|
- spec/integration/projects_spec.rb
|
219
|
-
- spec/models/order_list_response_spec.rb
|
220
|
-
- spec/models/allocation_spec.rb
|
221
|
-
- spec/models/order_response_spec.rb
|
222
|
-
- spec/models/preference_list_response_spec.rb
|
223
221
|
- spec/models/create_preference_request_spec.rb
|
222
|
+
- spec/models/preference_spec.rb
|
223
|
+
- spec/models/estimate_response_spec.rb
|
224
|
+
- spec/models/error_response_spec.rb
|
224
225
|
- spec/models/estimate_list_response_spec.rb
|
226
|
+
- spec/models/create_mass_estimate_request_spec.rb
|
225
227
|
- spec/models/project_spec.rb
|
228
|
+
- spec/models/order_spec.rb
|
229
|
+
- spec/models/preference_response_spec.rb
|
230
|
+
- spec/models/order_list_response_spec.rb
|
226
231
|
- spec/models/project_list_response_spec.rb
|
227
|
-
- spec/models/estimate_response_spec.rb
|
228
|
-
- spec/models/preference_spec.rb
|
229
|
-
- spec/models/create_order_request_spec.rb
|
230
|
-
- spec/models/create_mass_estimate_request_spec.rb
|
231
232
|
- spec/models/project_response_spec.rb
|
232
|
-
- spec/models/order_spec.rb
|
233
|
-
- spec/models/error_response_spec.rb
|
234
233
|
- spec/models/estimate_spec.rb
|
235
234
|
- spec/models/meta_index_object_spec.rb
|
236
|
-
- spec/models/
|
235
|
+
- spec/models/order_response_spec.rb
|
236
|
+
- spec/models/preference_list_response_spec.rb
|
237
|
+
- spec/models/allocation_spec.rb
|
238
|
+
- spec/models/create_order_request_spec.rb
|
239
|
+
- spec/patch_ruby_spec.rb
|
237
240
|
- spec/spec_helper.rb
|
238
241
|
- spec/support/shared/generated_classes.rb
|