patch_ruby 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ab75a1c077e255f54aa542b15eefc55ae4125994a71d8138be99a0534c1a5bd
4
- data.tar.gz: f0cd837fc4ed2187a775a01d33711b4d54b16ca30f992386305b32a81a159c1c
3
+ metadata.gz: b9f4307913b3197f4bf734c1c2f304210445268d022786c5dff9f454d77a9ca2
4
+ data.tar.gz: f0d29217913cc6d74e14c43a763e2c05b01aa746a4afcab0b9c8baf426c1b420
5
5
  SHA512:
6
- metadata.gz: a6706f4e0965eaa1edbed707a18609f04e85e5de5808d8ab95646a5c8d63c95cdbcb0d1b7dc7859270bbb098f28e6e094ca973b9ff13c403c08982a4d6292aea
7
- data.tar.gz: 4fcf46077c53e8e79c72d5a2caf88200b39e9c6297c67b6709c86dcc6572e3f559332bff888872e1b2b8e4827fefd829a3990045232b89f83841bae0d7e65490
6
+ metadata.gz: e06026d89b14cbdf33ed4f9d3a3bdd9aa4f698044a1fadd5cf46cca7c981aa469f9eac7095a473b360426d2291802fc11de9136773787704832861e2a496edba
7
+ data.tar.gz: 514089ea6fe7202c394e7a5b1642a070dda9ff5d1168696b8fa337e2d8f16509365ab38dd7f90ee951e227c1655d7a69a7e7b6ac195b767120b8853e955e8fd7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ 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.9.0] - 2021-08-17
9
+
10
+ ### Added
11
+
12
+ - Add support for querying Orders by `metadata`
13
+ - Added `transaction_value_eth_gwei` as an alternative way to compute transaction level emissions for ethereum
14
+
8
15
  ## [1.8.0] - 2021-07-20
9
16
 
10
17
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.8.0)
4
+ patch_ruby (1.9.0)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
Binary file
Binary file
@@ -281,6 +281,9 @@ module Patch
281
281
  # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
282
282
  # @param [Hash] opts the optional parameters
283
283
  # @option opts [Integer] :page
284
+ # @option opts [String] :metadata
285
+ # @option opts [String] :metadata_example1
286
+ # @option opts [String] :metadata_example2
284
287
  # @return [OrderListResponse]
285
288
  def retrieve_orders(opts = {})
286
289
  data, _status_code, _headers = retrieve_orders_with_http_info(opts)
@@ -291,6 +294,9 @@ module Patch
291
294
  # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for.
292
295
  # @param [Hash] opts the optional parameters
293
296
  # @option opts [Integer] :page
297
+ # @option opts [String] :metadata
298
+ # @option opts [String] :metadata_example1
299
+ # @option opts [String] :metadata_example2
294
300
  # @return [Array<(OrderListResponse, Integer, Hash)>] OrderListResponse data, response status code and response headers
295
301
  def retrieve_orders_with_http_info(opts = {})
296
302
  if @api_client.config.debugging
@@ -302,6 +308,9 @@ module Patch
302
308
  # query parameters
303
309
  query_params = opts[:query_params] || {}
304
310
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
311
+ query_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?
312
+ query_params[:'metadata[example1]'] = opts[:'metadata_example1'] if !opts[:'metadata_example1'].nil?
313
+ query_params[:'metadata[example2]'] = opts[:'metadata_example2'] if !opts[:'metadata_example2'].nil?
305
314
 
306
315
  # header parameters
307
316
  header_params = opts[:header_params] || {}
@@ -18,6 +18,8 @@ module Patch
18
18
 
19
19
  attr_accessor :gas_used
20
20
 
21
+ attr_accessor :transaction_value_eth_gwei
22
+
21
23
  attr_accessor :project_id
22
24
 
23
25
  attr_accessor :create_order
@@ -27,6 +29,7 @@ module Patch
27
29
  {
28
30
  :'timestamp' => :'timestamp',
29
31
  :'gas_used' => :'gas_used',
32
+ :'transaction_value_eth_gwei' => :'transaction_value_eth_gwei',
30
33
  :'project_id' => :'project_id',
31
34
  :'create_order' => :'create_order'
32
35
  }
@@ -37,6 +40,7 @@ module Patch
37
40
  {
38
41
  :'timestamp' => :'String',
39
42
  :'gas_used' => :'Integer',
43
+ :'transaction_value_eth_gwei' => :'Integer',
40
44
  :'project_id' => :'String',
41
45
  :'create_order' => :'Boolean'
42
46
  }
@@ -50,6 +54,8 @@ module Patch
50
54
 
51
55
  nullable_properties.add("gas_used")
52
56
 
57
+ nullable_properties.add("transaction_value_eth_gwei")
58
+
53
59
  nullable_properties.add("project_id")
54
60
 
55
61
  nullable_properties.add("create_order")
@@ -91,6 +97,10 @@ module Patch
91
97
  self.gas_used = attributes[:'gas_used']
92
98
  end
93
99
 
100
+ if attributes.key?(:'transaction_value_eth_gwei')
101
+ self.transaction_value_eth_gwei = attributes[:'transaction_value_eth_gwei']
102
+ end
103
+
94
104
  if attributes.key?(:'project_id')
95
105
  self.project_id = attributes[:'project_id']
96
106
  end
@@ -120,6 +130,7 @@ module Patch
120
130
  self.class == o.class &&
121
131
  timestamp == o.timestamp &&
122
132
  gas_used == o.gas_used &&
133
+ transaction_value_eth_gwei == o.transaction_value_eth_gwei &&
123
134
  project_id == o.project_id &&
124
135
  create_order == o.create_order
125
136
  end
@@ -133,7 +144,7 @@ module Patch
133
144
  # Calculates hash code according to all attributes.
134
145
  # @return [Integer] Hash code
135
146
  def hash
136
- [timestamp, gas_used, project_id, create_order].hash
147
+ [timestamp, gas_used, transaction_value_eth_gwei, project_id, create_order].hash
137
148
  end
138
149
 
139
150
  # Builds the object from hash
@@ -20,7 +20,7 @@ module Patch
20
20
  # A boolean indicating if this estimate is a production or test mode estimate.
21
21
  attr_accessor :production
22
22
 
23
- # The type of estimate. Available types are mass, flight, shipping, and vehicle.
23
+ # The type of estimate. Available types are mass, flight, shipping, vehicle, and crypto.
24
24
  attr_accessor :type
25
25
 
26
26
  # The estimated mass in grams for this estimate.
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '1.8.0'
14
+ VERSION = '1.9.0'
15
15
  end
Binary file
@@ -1,10 +1,4 @@
1
1
  RSpec.describe 'Estimates Integration' do
2
- before do
3
- Patch.configure do |config|
4
- config.access_token = ENV['SANDBOX_API_KEY']
5
- end
6
- end
7
-
8
2
  it 'supports create, retrieve and list' do
9
3
  create_estimate_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
10
4
  estimate_id = create_estimate_response.data.id
@@ -33,7 +27,7 @@ RSpec.describe 'Estimates Integration' do
33
27
  )
34
28
 
35
29
  expect(flight_estimate.data.type).to eq 'flight'
36
- expect(flight_estimate.data.mass_g).to eq 1_031_697
30
+ expect(flight_estimate.data.mass_g).to eq 1_000_622
37
31
  end
38
32
 
39
33
  it 'supports creating vehicle estimates' do
@@ -1,10 +1,4 @@
1
1
  RSpec.describe 'Orders Integration' do
2
- before do
3
- Patch.configure do |config|
4
- config.access_token = ENV['SANDBOX_API_KEY']
5
- end
6
- end
7
-
8
2
  it 'supports create, place, cancel, retrieve and list' do
9
3
  create_order_response = Patch::Order.create_order(mass_g: 100)
10
4
  order_id = create_order_response.data.id
@@ -71,15 +65,24 @@ RSpec.describe 'Orders Integration' do
71
65
  expect(order.registry_url).not_to be_empty
72
66
  end
73
67
 
74
- it 'supports create with metadata' do
68
+ it 'supports creation with and querying by metadata' do
75
69
  metadata = { user: 'john doe' }
76
70
 
77
- create_order_response = Patch::Order.create_order(mass_g: 100, metadata: metadata)
71
+ create_order_response =
72
+ Patch::Order.create_order(mass_g: 100, metadata: metadata)
78
73
 
79
74
  expect(create_order_response.success).to eq true
80
75
  expect(create_order_response.data.id).not_to be_nil
81
76
  expect(create_order_response.data.mass_g).to eq(100)
82
77
  expect(create_order_response.data.metadata).to eq(metadata)
78
+
79
+ retrieve_orders_response = Patch::Order.retrieve_orders(
80
+ page: 1, metadata: { user: 'john' }
81
+ )
82
+ expect(retrieve_orders_response.success).to eq true
83
+ expect(retrieve_orders_response.data.count).to be >= 1
84
+ expect(retrieve_orders_response.data.map(&:metadata))
85
+ .to all(have_key(:user))
83
86
  end
84
87
 
85
88
  it 'supports place and cancel for orders created via an estimate' do
@@ -1,10 +1,4 @@
1
1
  RSpec.describe 'Preferences Integration' do
2
- before do
3
- Patch.configure do |config|
4
- config.access_token = ENV['SANDBOX_API_KEY']
5
- end
6
- end
7
-
8
2
  it 'supports create, delete, retrieve and list' do
9
3
  retrieve_projects_response = Patch::Project.retrieve_projects
10
4
  expect(retrieve_projects_response.data.length).not_to be_zero
@@ -1,8 +1,4 @@
1
1
  RSpec.describe 'Projects Integration' do
2
- Patch.configure do |config|
3
- config.access_token = ENV['SANDBOX_API_KEY']
4
- end
5
-
6
2
  it 'supports retrieve and list' do
7
3
  page_limit = 1
8
4
  next_page = 1
@@ -43,20 +39,12 @@ RSpec.describe 'Projects Integration' do
43
39
  end
44
40
 
45
41
  describe 'returned fields' do
46
- before do
47
- @project = Patch::Project.retrieve_projects(page: 1).data.first
48
- end
49
-
50
- it 'returns photos' do
51
- expect(@project.photos).to be_an_instance_of(Array)
52
- end
53
-
54
- it 'returns average_price_per_tonne_cents_usd' do
55
- expect(@project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
56
- end
42
+ it 'returns the expected fields' do
43
+ project = Patch::Project.retrieve_projects(page: 1).data.first
57
44
 
58
- it 'returns remaining_mass_g' do
59
- expect(@project.remaining_mass_g).to be_an_instance_of(Integer)
45
+ expect(project.photos).to be_an_instance_of(Array)
46
+ expect(project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
47
+ expect(project.remaining_mass_g).to be_an_instance_of(Integer)
60
48
  end
61
49
  end
62
50
  end
data/spec/spec_helper.rb CHANGED
@@ -41,6 +41,15 @@ RSpec.configure do |config|
41
41
  config.include FactoryBot::Syntax::Methods
42
42
  config.before(:suite) do
43
43
  FactoryBot.find_definitions
44
+ Patch.configure do |config|
45
+ if ENV.fetch('LOCAL_SDK_TEST', false)
46
+ config.access_token = ENV.fetch('LOCAL_PATCH_API_KEY')
47
+ config.scheme = 'http'
48
+ config.host = 'api.patch.test:3000'
49
+ else
50
+ config.access_token = ENV.fetch('SANDBOX_API_KEY')
51
+ end
52
+ end
44
53
  end
45
54
 
46
55
  # rspec-expectations config goes here. You can use an alternate
@@ -66,6 +75,12 @@ RSpec.configure do |config|
66
75
  mocks.verify_partial_doubles = true
67
76
  end
68
77
 
78
+ # Run specs in random order to surface order dependencies. If you find an
79
+ # order dependency and want to debug it, you can fix the order by providing
80
+ # the seed, which is printed after each run.
81
+ # --seed 1234
82
+ config.order = :random
83
+
69
84
  # The settings below are suggested to provide a good initial experience
70
85
  # with RSpec, but feel free to customize to your heart's content.
71
86
  =begin
@@ -107,12 +122,6 @@ RSpec.configure do |config|
107
122
  # particularly slow.
108
123
  config.profile_examples = 10
109
124
 
110
- # Run specs in random order to surface order dependencies. If you find an
111
- # order dependency and want to debug it, you can fix the order by providing
112
- # the seed, which is printed after each run.
113
- # --seed 1234
114
- config.order = :random
115
-
116
125
  # Seed global randomization in this process using the `--seed` CLI option.
117
126
  # Setting this allows you to use `--seed` to deterministically reproduce
118
127
  # test failures related to randomization by passing the same `--seed` value
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.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patch Technology
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -83,7 +83,12 @@ files:
83
83
  - Makefile
84
84
  - README.md
85
85
  - Rakefile
86
+ - bin/rspec
86
87
  - lib/patch_ruby.rb
88
+ - lib/patch_ruby/.api_client.rb.un~
89
+ - lib/patch_ruby/.configuration.rb.un~
90
+ - lib/patch_ruby/.version.rb.un~
91
+ - lib/patch_ruby/api/.orders_api.rb.un~
87
92
  - lib/patch_ruby/api/estimates_api.rb
88
93
  - lib/patch_ruby/api/orders_api.rb
89
94
  - lib/patch_ruby/api/preferences_api.rb
@@ -91,6 +96,7 @@ files:
91
96
  - lib/patch_ruby/api_client.rb
92
97
  - lib/patch_ruby/api_error.rb
93
98
  - lib/patch_ruby/configuration.rb
99
+ - lib/patch_ruby/models/.create_ethereum_estimate_request.rb.un~
94
100
  - lib/patch_ruby/models/allocation.rb
95
101
  - lib/patch_ruby/models/create_bitcoin_estimate_request.rb
96
102
  - lib/patch_ruby/models/create_ethereum_estimate_request.rb
@@ -116,6 +122,7 @@ files:
116
122
  - lib/patch_ruby/models/standard.rb
117
123
  - lib/patch_ruby/version.rb
118
124
  - patch_ruby.gemspec
125
+ - spec/.spec_helper.rb.un~
119
126
  - spec/api/estimates_api_spec.rb
120
127
  - spec/api/orders_api_spec.rb
121
128
  - spec/api/preferences_api_spec.rb
@@ -141,6 +148,10 @@ files:
141
148
  - spec/factories/project_list_responses.rb
142
149
  - spec/factories/project_responses.rb
143
150
  - spec/factories/projects.rb
151
+ - spec/integration/.estimates_spec.rb.un~
152
+ - spec/integration/.orders_spec.rb.un~
153
+ - spec/integration/.preferences_spec.rb.un~
154
+ - spec/integration/.projects_spec.rb.un~
144
155
  - spec/integration/estimates_spec.rb
145
156
  - spec/integration/orders_spec.rb
146
157
  - spec/integration/preferences_spec.rb
@@ -170,7 +181,7 @@ homepage: https://www.patch.io
170
181
  licenses:
171
182
  - MIT
172
183
  metadata: {}
173
- post_install_message:
184
+ post_install_message:
174
185
  rdoc_options: []
175
186
  require_paths:
176
187
  - lib
@@ -186,57 +197,61 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
197
  version: '0'
187
198
  requirements: []
188
199
  rubygems_version: 3.1.2
189
- signing_key:
200
+ signing_key:
190
201
  specification_version: 4
191
202
  summary: Ruby wrapper for the Patch API
192
203
  test_files:
193
204
  - spec/api/preferences_api_spec.rb
194
- - spec/api/projects_api_spec.rb
195
- - spec/api/estimates_api_spec.rb
196
205
  - spec/api/orders_api_spec.rb
206
+ - spec/api/estimates_api_spec.rb
207
+ - spec/api/projects_api_spec.rb
197
208
  - spec/api_client_spec.rb
198
209
  - spec/configuration_spec.rb
199
210
  - spec/constants.rb
200
- - spec/factories/order_list_responses.rb
201
- - spec/factories/preferences.rb
202
- - spec/factories/project_responses.rb
203
- - spec/factories/estimates.rb
204
211
  - spec/factories/preference_responses.rb
205
- - spec/factories/estimate_list_responses.rb
206
- - spec/factories/create_preference_requests.rb
207
- - spec/factories/project_list_responses.rb
208
- - spec/factories/error_responses.rb
209
212
  - spec/factories/meta_index_objects.rb
210
213
  - spec/factories/preference_list_responses.rb
214
+ - spec/factories/allocations.rb
215
+ - spec/factories/project_list_responses.rb
211
216
  - spec/factories/projects.rb
217
+ - spec/factories/error_responses.rb
212
218
  - spec/factories/create_mass_estimate_requests.rb
213
- - spec/factories/order_responses.rb
214
- - spec/factories/allocations.rb
215
219
  - spec/factories/orders.rb
220
+ - spec/factories/preferences.rb
221
+ - spec/factories/create_preference_requests.rb
216
222
  - spec/factories/create_order_requests.rb
223
+ - spec/factories/project_responses.rb
224
+ - spec/factories/estimate_list_responses.rb
225
+ - spec/factories/order_list_responses.rb
226
+ - spec/factories/estimates.rb
227
+ - spec/factories/order_responses.rb
217
228
  - spec/factories/estimate_responses.rb
218
- - spec/integration/orders_spec.rb
219
- - spec/integration/preferences_spec.rb
229
+ - spec/integration/.preferences_spec.rb.un~
220
230
  - spec/integration/estimates_spec.rb
231
+ - spec/integration/.orders_spec.rb.un~
221
232
  - spec/integration/projects_spec.rb
233
+ - spec/integration/.estimates_spec.rb.un~
234
+ - spec/integration/preferences_spec.rb
235
+ - spec/integration/orders_spec.rb
236
+ - spec/integration/.projects_spec.rb.un~
237
+ - spec/models/error_response_spec.rb
238
+ - spec/models/estimate_response_spec.rb
239
+ - spec/models/project_spec.rb
222
240
  - spec/models/create_preference_request_spec.rb
241
+ - spec/models/order_response_spec.rb
223
242
  - spec/models/preference_spec.rb
224
- - spec/models/estimate_response_spec.rb
225
- - spec/models/error_response_spec.rb
243
+ - spec/models/project_list_response_spec.rb
226
244
  - spec/models/estimate_list_response_spec.rb
227
- - spec/models/create_mass_estimate_request_spec.rb
228
- - spec/models/project_spec.rb
245
+ - spec/models/preference_list_response_spec.rb
246
+ - spec/models/meta_index_object_spec.rb
247
+ - spec/models/create_order_request_spec.rb
229
248
  - spec/models/order_spec.rb
230
249
  - spec/models/preference_response_spec.rb
231
- - spec/models/order_list_response_spec.rb
232
- - spec/models/project_list_response_spec.rb
233
250
  - spec/models/project_response_spec.rb
234
251
  - spec/models/estimate_spec.rb
235
- - spec/models/meta_index_object_spec.rb
236
- - spec/models/order_response_spec.rb
237
- - spec/models/preference_list_response_spec.rb
238
252
  - spec/models/allocation_spec.rb
239
- - spec/models/create_order_request_spec.rb
253
+ - spec/models/order_list_response_spec.rb
254
+ - spec/models/create_mass_estimate_request_spec.rb
240
255
  - spec/patch_ruby_spec.rb
241
256
  - spec/spec_helper.rb
242
257
  - spec/support/shared/generated_classes.rb