patch_ruby 1.24.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/patch_ruby/api/estimates_api.rb +72 -2
  4. data/lib/patch_ruby/api/order_line_items_api.rb +269 -0
  5. data/lib/patch_ruby/api/orders_api.rb +99 -4
  6. data/lib/patch_ruby/api/projects_api.rb +12 -2
  7. data/lib/patch_ruby/api/technology_types_api.rb +7 -2
  8. data/lib/patch_ruby/api_client.rb +3 -3
  9. data/lib/patch_ruby/api_error.rb +2 -2
  10. data/lib/patch_ruby/configuration.rb +2 -2
  11. data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +2 -2
  12. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +2 -2
  13. data/lib/patch_ruby/models/create_ecommerce_estimate_request.rb +2 -2
  14. data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +2 -2
  15. data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -2
  16. data/lib/patch_ruby/models/create_hotel_estimate_request.rb +2 -2
  17. data/lib/patch_ruby/models/create_mass_estimate_request.rb +2 -2
  18. data/lib/patch_ruby/models/create_order_line_item_request.rb +375 -0
  19. data/lib/patch_ruby/models/create_order_request.rb +8 -67
  20. data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +2 -2
  21. data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +2 -2
  22. data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +2 -2
  23. data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -2
  24. data/lib/patch_ruby/models/create_success_response.rb +2 -2
  25. data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -2
  26. data/lib/patch_ruby/models/delete_order_line_item_response.rb +257 -0
  27. data/lib/patch_ruby/models/delete_order_response.rb +257 -0
  28. data/lib/patch_ruby/models/error_response.rb +2 -2
  29. data/lib/patch_ruby/models/estimate.rb +2 -2
  30. data/lib/patch_ruby/models/estimate_list_response.rb +2 -2
  31. data/lib/patch_ruby/models/estimate_response.rb +2 -2
  32. data/lib/patch_ruby/models/highlight.rb +2 -2
  33. data/lib/patch_ruby/models/inventory.rb +2 -2
  34. data/lib/patch_ruby/models/meta_index_object.rb +2 -2
  35. data/lib/patch_ruby/models/order.rb +11 -115
  36. data/lib/patch_ruby/models/order_issued_to.rb +2 -2
  37. data/lib/patch_ruby/models/{order_inventory.rb → order_line_item.rb} +19 -9
  38. data/lib/patch_ruby/models/{order_inventory_project.rb → order_line_item_project.rb} +7 -7
  39. data/lib/patch_ruby/models/{allocation.rb → order_line_item_response.rb} +33 -40
  40. data/lib/patch_ruby/models/order_list_response.rb +2 -2
  41. data/lib/patch_ruby/models/order_response.rb +2 -2
  42. data/lib/patch_ruby/models/parent_technology_type.rb +2 -2
  43. data/lib/patch_ruby/models/photo.rb +2 -2
  44. data/lib/patch_ruby/models/place_order_request.rb +2 -2
  45. data/lib/patch_ruby/models/project.rb +13 -53
  46. data/lib/patch_ruby/models/project_list_response.rb +2 -2
  47. data/lib/patch_ruby/models/project_response.rb +2 -2
  48. data/lib/patch_ruby/models/sdg.rb +2 -2
  49. data/lib/patch_ruby/models/standard.rb +2 -2
  50. data/lib/patch_ruby/models/technology_type.rb +2 -2
  51. data/lib/patch_ruby/models/technology_type_list_response.rb +2 -2
  52. data/lib/patch_ruby/models/update_order_line_item_request.rb +366 -0
  53. data/lib/patch_ruby/version.rb +3 -3
  54. data/lib/patch_ruby.rb +10 -5
  55. data/patch_ruby.gemspec +2 -2
  56. data/spec/api/order_line_items_api_spec.rb +78 -0
  57. data/spec/api_client_spec.rb +2 -2
  58. data/spec/configuration_spec.rb +2 -2
  59. data/spec/factories/create_order_requests.rb +4 -2
  60. data/spec/factories/orders.rb +5 -4
  61. data/spec/factories/projects.rb +1 -4
  62. data/spec/integration/orders_spec.rb +85 -44
  63. data/spec/integration/projects_spec.rb +2 -4
  64. data/spec/models/create_order_request_spec.rb +10 -3
  65. data/spec/models/order_spec.rb +8 -23
  66. data/spec/models/project_spec.rb +1 -4
  67. data/spec/spec_helper.rb +2 -2
  68. metadata +34 -31
  69. data/spec/factories/allocations.rb +0 -7
  70. data/spec/models/allocation_spec.rb +0 -59
data/patch_ruby.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  =begin
4
- #Patch API V1
4
+ #Patch API V2
5
5
 
6
6
  #The core API used to integrate with Patch's service
7
7
 
8
- The version of the OpenAPI document: v1
8
+ The version of the OpenAPI document: 2
9
9
  Contact: engineering@usepatch.com
10
10
  Generated by: https://openapi-generator.tech
11
11
  OpenAPI Generator version: 5.3.1
@@ -0,0 +1,78 @@
1
+ =begin
2
+ #Patch API V2
3
+
4
+ #The core API used to integrate with Patch's service
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: engineering@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Patch::OrderLineItemsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'OrderLineItemsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = Patch::OrderLineItemsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of OrderLineItemsApi' do
30
+ it 'should create an instance of OrderLineItemsApi' do
31
+ expect(@api_instance).to be_instance_of(Patch::OrderLineItemsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for create_order_line_item
36
+ # Creates an order line item
37
+ # Creates a line item on an order that is in the `draft` state.
38
+ # @param order_id
39
+ # @param create_order_line_item_request
40
+ # @param [Hash] opts the optional parameters
41
+ # @option opts [Integer] :patch_version
42
+ # @return [OrderLineItemResponse]
43
+ describe 'create_order_line_item test' do
44
+ it 'should work' do
45
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
46
+ end
47
+ end
48
+
49
+ # unit tests for delete_order_line_item
50
+ # Deletes an order line item
51
+ # Deletes a line item on an order that is in the `draft` state.
52
+ # @param order_id
53
+ # @param serial_number
54
+ # @param [Hash] opts the optional parameters
55
+ # @option opts [Integer] :patch_version
56
+ # @return [DeleteOrderLineItemResponse]
57
+ describe 'delete_order_line_item test' do
58
+ it 'should work' do
59
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
60
+ end
61
+ end
62
+
63
+ # unit tests for update_order_line_item
64
+ # Updates an order line item
65
+ # Updates a line item on an order that is in the `draft` state.
66
+ # @param order_id
67
+ # @param serial_number
68
+ # @param update_order_line_item_request
69
+ # @param [Hash] opts the optional parameters
70
+ # @option opts [Integer] :patch_version
71
+ # @return [OrderLineItemResponse]
72
+ describe 'update_order_line_item test' do
73
+ it 'should work' do
74
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
75
+ end
76
+ end
77
+
78
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
2
+ #Patch API V2
3
3
 
4
4
  #The core API used to integrate with Patch's service
5
5
 
6
- The version of the OpenAPI document: v1
6
+ The version of the OpenAPI document: 2
7
7
  Contact: engineering@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 5.3.1
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
2
+ #Patch API V2
3
3
 
4
4
  #The core API used to integrate with Patch's service
5
5
 
6
- The version of the OpenAPI document: v1
6
+ The version of the OpenAPI document: 2
7
7
  Contact: engineering@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 5.3.1
@@ -1,8 +1,10 @@
1
1
  FactoryBot.define do
2
2
  factory :create_order_request, class: Patch::CreateOrderRequest do
3
3
  sequence(:project_id) { |n| n }
4
- mass_g { 100 }
5
- total_price_cents_usd { 100 }
4
+ amount { 100 }
5
+ unit { "g" }
6
+ total_price { 100 }
7
+ currency { "USD" }
6
8
  metadata { {} }
7
9
  end
8
10
  end
@@ -1,12 +1,13 @@
1
1
  FactoryBot.define do
2
2
  factory :order, class: Patch::Order do
3
3
  sequence(:id) { |n| n }
4
- mass_g { 1_000 }
4
+ amount { 1_000 }
5
+ unit { "g" }
5
6
  production { false }
6
7
  state { "draft" }
7
- allocation_state { "pending" }
8
- price_cents_usd { 500 }
9
- patch_fee_cents_usd { 5 }
8
+ price { 500 }
9
+ patch_fee { 5 }
10
+ currency { "USD" }
10
11
  metadata { {} }
11
12
  end
12
13
  end
@@ -7,12 +7,9 @@ FactoryBot.define do
7
7
  production { false }
8
8
  name { "New Project" }
9
9
  description { "New Descirption" }
10
- type { "biomass" }
11
10
  country { "DK" }
12
- developer { "Danish Developer" }
11
+ project_partner { "Danish Developer" }
13
12
  photos { [] }
14
- average_price_per_tonne_cents_usd { 120 }
15
- remaining_mass_g { 1_000 }
16
13
  standard { 'european_biochar_certificate' }
17
14
  state { 'CO' }
18
15
  latitude { 45.0 }
@@ -1,6 +1,6 @@
1
1
  RSpec.describe 'Orders Integration' do
2
2
  it 'supports create, place, cancel, retrieve and list' do
3
- create_order_response = Patch::Order.create_order(mass_g: 100)
3
+ create_order_response = Patch::Order.create_order(amount: 100, unit: "g")
4
4
  order_id = create_order_response.data.id
5
5
 
6
6
  retrieve_order_response = Patch::Order.retrieve_order(order_id)
@@ -25,20 +25,21 @@ RSpec.describe 'Orders Integration' do
25
25
  )
26
26
 
27
27
  project_id = retrieve_project_response.data.id
28
- average_price_per_tonne_cents_usd = retrieve_project_response.data.average_price_per_tonne_cents_usd
29
28
 
30
- order_mass_g = 100_000
29
+ order_amount = 100_000
31
30
  tonne_per_gram = 1_000_000
32
31
 
33
- create_order_response = Patch::Order.create_order(mass_g: order_mass_g, project_id: project_id)
32
+ create_order_response = Patch::Order
33
+ .create_order(amount: order_amount, unit: "g", project_id: project_id)
34
34
 
35
35
  order = create_order_response.data
36
36
  expect(create_order_response.success).to eq true
37
37
  expect(order.id).not_to be_nil
38
38
  expect(order.created_at).to be_a_kind_of(Time)
39
- expect(order.mass_g).to eq(order_mass_g)
40
- expect(order.price_cents_usd).to be_kind_of(Integer)
41
- expect(order.patch_fee_cents_usd).to be_kind_of(Integer)
39
+ expect(order.amount).to eq(order_amount)
40
+ expect(order.unit).to eq("g")
41
+ expect(order.price).to be_kind_of(Integer)
42
+ expect(order.patch_fee).to be_kind_of(Integer)
42
43
  expect(order.registry_url).not_to be_empty
43
44
  end
44
45
 
@@ -48,10 +49,11 @@ RSpec.describe 'Orders Integration' do
48
49
  )
49
50
 
50
51
  issued_to = { email: 'envimpact@companyb.com', name: 'Company B' }
51
- total_price_cents_usd = 50_00
52
+ total_price = 50_00
52
53
 
53
54
  create_order_response = Patch::Order.create_order(
54
- total_price_cents_usd: total_price_cents_usd,
55
+ total_price: total_price,
56
+ currency: "USD",
55
57
  issued_to: issued_to
56
58
  )
57
59
 
@@ -60,42 +62,21 @@ RSpec.describe 'Orders Integration' do
60
62
  order = create_order_response.data
61
63
 
62
64
  expect(order.id).not_to be_nil
63
- expect(order.price_cents_usd + order.patch_fee_cents_usd).to eq total_price_cents_usd
65
+ expect(order.price + order.patch_fee).to eq total_price
64
66
  expect(order.issued_to.email).to eq(issued_to[:email])
65
67
  expect(order.issued_to.name).to eq(issued_to[:name])
66
68
  end
67
69
 
68
- it 'supports create with a total price' do
69
- retrieve_project_response = Patch::Project.retrieve_project(
70
- Constants::BIOMASS_TEST_PROJECT_ID
71
- )
72
-
73
- project_id = retrieve_project_response.data.id
74
- total_price_cents_usd = 50_00
75
-
76
- create_order_response = Patch::Order.create_order(
77
- total_price_cents_usd: total_price_cents_usd,
78
- project_id: project_id
79
- )
80
-
81
- expect(create_order_response.success).to eq true
82
-
83
- order = create_order_response.data
84
-
85
- expect(order.id).not_to be_nil
86
- expect(order.price_cents_usd + order.patch_fee_cents_usd).to eq total_price_cents_usd
87
- expect(order.registry_url).not_to be_empty
88
- end
89
-
90
70
  it 'supports creation with and querying by metadata' do
91
71
  metadata = { user: 'john doe' }
92
72
 
93
73
  create_order_response =
94
- Patch::Order.create_order(mass_g: 100, metadata: metadata)
74
+ Patch::Order.create_order(amount: 100, unit: "g", metadata: metadata)
95
75
 
96
76
  expect(create_order_response.success).to eq true
97
77
  expect(create_order_response.data.id).not_to be_nil
98
- expect(create_order_response.data.mass_g).to eq(100)
78
+ expect(create_order_response.data.amount).to eq(100)
79
+ expect(create_order_response.data.unit).to eq("g")
99
80
  expect(create_order_response.data.metadata).to eq(metadata)
100
81
 
101
82
  retrieve_orders_response = Patch::Order.retrieve_orders(
@@ -109,11 +90,12 @@ RSpec.describe 'Orders Integration' do
109
90
 
110
91
  it 'supports creation in draft state' do
111
92
  create_order_response =
112
- Patch::Order.create_order(mass_g: 100, state: "draft")
93
+ Patch::Order.create_order(amount: 100, unit: "g", state: "draft")
113
94
 
114
95
  expect(create_order_response.success).to eq true
115
96
  expect(create_order_response.data.id).not_to be_nil
116
- expect(create_order_response.data.mass_g).to eq(100)
97
+ expect(create_order_response.data.amount).to eq(100)
98
+ expect(create_order_response.data.unit).to eq("g")
117
99
  expect(create_order_response.data.state).to eq("draft")
118
100
  end
119
101
 
@@ -144,11 +126,12 @@ RSpec.describe 'Orders Integration' do
144
126
 
145
127
  it 'supports create with a vintage year' do
146
128
  create_order_response =
147
- Patch::Order.create_order(mass_g: 100, vintage_year: 2022)
129
+ Patch::Order.create_order(amount: 100, unit: "g", vintage_year: 2022)
148
130
 
149
131
  expect(create_order_response.success).to eq true
150
132
  expect(create_order_response.data.id).not_to be_nil
151
- expect(create_order_response.data.mass_g).to eq(100)
133
+ expect(create_order_response.data.amount).to eq(100)
134
+ expect(create_order_response.data.unit).to eq("g")
152
135
  end
153
136
 
154
137
  it 'supports create with an amount and unit' do
@@ -159,16 +142,16 @@ RSpec.describe 'Orders Integration' do
159
142
  expect(create_order_response.data.id).not_to be_nil
160
143
  expect(create_order_response.data.amount).to eq(100)
161
144
  expect(create_order_response.data.unit).to eq("g")
162
- expect(create_order_response.data.inventory[0]).to be_an_instance_of(
163
- Patch::OrderInventory
145
+ expect(create_order_response.data.line_items[0]).to be_an_instance_of(
146
+ Patch::OrderLineItem
164
147
  )
165
- expect(create_order_response.data.inventory[0].project).to be_an_instance_of(
166
- Patch::OrderInventoryProject
148
+ expect(create_order_response.data.line_items[0].project).to be_an_instance_of(
149
+ Patch::OrderLineItemProject
167
150
  )
168
- expect(create_order_response.data.inventory[0].unit).to eq("g")
151
+ expect(create_order_response.data.line_items[0].unit).to eq("g")
169
152
  end
170
153
 
171
- it 'supports create with a total price and currency' do
154
+ it 'supports create with a total price and foreign currency' do
172
155
  create_order_response =
173
156
  Patch::Order.create_order(total_price: 100, currency: "EUR")
174
157
 
@@ -178,4 +161,62 @@ RSpec.describe 'Orders Integration' do
178
161
  ).to be_within(1).of(100)
179
162
  expect(create_order_response.data.currency).to eq "EUR"
180
163
  end
164
+
165
+ it 'supports creating an empty draft order and adding/editing line items' do
166
+ # Create empty order
167
+ create_order_response =
168
+ Patch::Order.create_order(state: "draft")
169
+
170
+ expect(create_order_response.success).to eq true
171
+ expect(create_order_response.data.id).not_to be_nil
172
+ expect(create_order_response.data.price).to eq(0)
173
+ expect(create_order_response.data.amount).to eq(0)
174
+ expect(create_order_response.data.line_items).to eq([])
175
+
176
+ # Add project to order
177
+ order_id = create_order_response.data.id
178
+ retrieve_project_response = Patch::Project.retrieve_project(
179
+ Constants::BIOMASS_TEST_PROJECT_ID
180
+ )
181
+ project_id = retrieve_project_response.data.id
182
+
183
+ create_line_item_response = Patch::OrderLineItem
184
+ .create_order_line_item(order_id, { project_id: project_id })
185
+
186
+ expect(create_line_item_response.success).to eq(true)
187
+ expect(create_line_item_response.data.id).not_to be_nil
188
+ expect(create_line_item_response.data.amount).to eq(0)
189
+
190
+ # Update amount on line item
191
+ line_item_id = create_line_item_response.data.id
192
+ update_order_line_item_response = Patch::OrderLineItem
193
+ .update_order_line_item(order_id, line_item_id, { amount: 100000, unit: "g" })
194
+
195
+ expect(update_order_line_item_response.success).to eq(true)
196
+ expect(update_order_line_item_response.data.id).not_to be_nil
197
+ expect(update_order_line_item_response.data.amount).to eq(100000)
198
+ expect(update_order_line_item_response.data.price).to be >= 0
199
+
200
+ # Fetch order and check line item matches
201
+ retrieve_order_response = Patch::Order.retrieve_order(order_id)
202
+ expect(retrieve_order_response.data.id).to eq order_id
203
+ expect(retrieve_order_response.data.line_items.length).to eq(1)
204
+ expect(retrieve_order_response.data.line_items[0].id).to eq(line_item_id)
205
+ expect(retrieve_order_response.data.line_items[0].amount).to eq(100000)
206
+
207
+ # Delete line item
208
+ delete_line_item_response = Patch::OrderLineItem.delete_order_line_item(order_id, line_item_id)
209
+ expect(delete_line_item_response.success).to eq(true)
210
+ expect(delete_line_item_response.data).to eq(line_item_id)
211
+
212
+ # Fetch order and see it has no line items
213
+ retrieve_order_response = Patch::Order.retrieve_order(order_id)
214
+ expect(retrieve_order_response.data.id).to eq order_id
215
+ expect(retrieve_order_response.data.line_items.length).to eq(0)
216
+
217
+ # Delete order
218
+ delete_order_response = Patch::Order.delete_order(order_id)
219
+ expect(delete_order_response.success).to eq(true)
220
+ expect(delete_order_response.data).to eq(order_id)
221
+ end
181
222
  end
@@ -34,7 +34,8 @@ RSpec.describe 'Projects Integration' do
34
34
  minimum_available_mass = 100
35
35
  projects = Patch::Project.retrieve_projects(minimum_available_mass: minimum_available_mass)
36
36
  projects.data.map do |project|
37
- expect(project.remaining_mass_g >= minimum_available_mass).to be true
37
+ project_mass = project.inventory.sum(&:amount_available)
38
+ expect(project_mass >= minimum_available_mass).to be true
38
39
  end
39
40
  end
40
41
 
@@ -45,9 +46,6 @@ RSpec.describe 'Projects Integration' do
45
46
  expect(project.to_hash.keys).to include(*keys)
46
47
 
47
48
  expect(project.photos).to be_an_instance_of(Array)
48
- expect(project.average_price_per_tonne_cents_usd)
49
- .to be_an_instance_of(Integer)
50
- expect(project.remaining_mass_g).to be_an_instance_of(Integer)
51
49
  expect(project.longitude).to be_an_instance_of(Float)
52
50
  expect(project.latitude).to be_an_instance_of(Float)
53
51
 
@@ -29,9 +29,16 @@ describe 'CreateOrderRequest' do
29
29
 
30
30
  it_behaves_like "a generated class" do
31
31
  let(:instance) { @instance }
32
- let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g, total_price_cents_usd: @instance.total_price_cents_usd, metadata: @instance.metadata } }
32
+ let(:instance_hash) { {
33
+ project_id: @instance.project_id,
34
+ amount: @instance.amount,
35
+ unit: @instance.unit,
36
+ total_price: @instance.total_price,
37
+ currency: @instance.currency,
38
+ metadata: @instance.metadata
39
+ } }
33
40
  let(:nullable_properties) do
34
- Set.new(%i[mass_g total_price_cents_usd project_id metadata state vintage_year total_price currency amount unit])
41
+ Set.new(%i[project_id metadata state vintage_year total_price currency amount unit])
35
42
  end
36
43
  end
37
44
 
@@ -40,7 +47,7 @@ describe 'CreateOrderRequest' do
40
47
  expect(@instance).to be_instance_of(Patch::CreateOrderRequest)
41
48
  end
42
49
  end
43
- describe 'test attribute "mass_g"' do
50
+ describe 'test attribute "amount"' do
44
51
  it 'should work' do
45
52
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
46
53
  end
@@ -32,16 +32,17 @@ describe 'Order' do
32
32
  let(:instance_hash) {
33
33
  {
34
34
  id: @instance.id,
35
- mass_g: @instance.mass_g,
35
+ amount: @instance.amount,
36
+ unit: @instance.unit,
36
37
  production: @instance.production,
37
38
  state: @instance.state,
38
- allocation_state: @instance.allocation_state,
39
- price_cents_usd: @instance.price_cents_usd,
40
- patch_fee_cents_usd: @instance.patch_fee_cents_usd,
39
+ price: @instance.price,
40
+ patch_fee: @instance.patch_fee,
41
+ currency: @instance.currency,
41
42
  metadata: @instance.metadata
42
43
  }
43
44
  }
44
- let(:nullable_properties) { Set.new([:patch_fee_cents_usd, :price_cents_usd]) }
45
+ let(:nullable_properties) { Set.new([]) }
45
46
  end
46
47
 
47
48
  describe 'test an instance of Order' do
@@ -55,7 +56,7 @@ describe 'Order' do
55
56
  end
56
57
  end
57
58
 
58
- describe 'test attribute "mass_g"' do
59
+ describe 'test attribute "amount"' do
59
60
  it 'should work' do
60
61
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
61
62
  end
@@ -77,23 +78,7 @@ describe 'Order' do
77
78
  end
78
79
  end
79
80
 
80
- describe 'test attribute "allocation_state"' do
81
- it 'should work' do
82
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
83
- # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["pending", "partially_allocated", "allocated"])
84
- # validator.allowable_values.each do |value|
85
- # expect { @instance.allocation_state = value }.not_to raise_error
86
- # end
87
- end
88
- end
89
-
90
- describe 'test attribute "price_cents_usd"' do
91
- it 'should work' do
92
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
93
- end
94
- end
95
-
96
- describe 'test attribute "allocations"' do
81
+ describe 'test attribute "price"' do
97
82
  it 'should work' do
98
83
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
99
84
  end
@@ -35,12 +35,9 @@ describe 'Project' do
35
35
  name: @instance.name,
36
36
  description: @instance.description,
37
37
  production: @instance.production,
38
- type: @instance.type,
39
38
  country: @instance.country,
40
- developer: @instance.developer,
39
+ project_partner: @instance.project_partner,
41
40
  photos: @instance.photos,
42
- average_price_per_tonne_cents_usd: @instance.average_price_per_tonne_cents_usd,
43
- remaining_mass_g: @instance.remaining_mass_g,
44
41
  state: @instance.state,
45
42
  longitude: @instance.longitude,
46
43
  latitude: @instance.latitude,
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
2
+ #Patch API V2
3
3
 
4
4
  #The core API used to integrate with Patch's service
5
5
 
6
- The version of the OpenAPI document: v1
6
+ The version of the OpenAPI document: 2
7
7
  Contact: engineering@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 5.3.1
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.24.2
4
+ version: 2.0.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-08-11 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -94,13 +94,13 @@ files:
94
94
  - bin/rspec
95
95
  - lib/patch_ruby.rb
96
96
  - lib/patch_ruby/api/estimates_api.rb
97
+ - lib/patch_ruby/api/order_line_items_api.rb
97
98
  - lib/patch_ruby/api/orders_api.rb
98
99
  - lib/patch_ruby/api/projects_api.rb
99
100
  - lib/patch_ruby/api/technology_types_api.rb
100
101
  - lib/patch_ruby/api_client.rb
101
102
  - lib/patch_ruby/api_error.rb
102
103
  - lib/patch_ruby/configuration.rb
103
- - lib/patch_ruby/models/allocation.rb
104
104
  - lib/patch_ruby/models/create_air_shipping_estimate_request.rb
105
105
  - lib/patch_ruby/models/create_bitcoin_estimate_request.rb
106
106
  - lib/patch_ruby/models/create_ecommerce_estimate_request.rb
@@ -108,6 +108,7 @@ files:
108
108
  - lib/patch_ruby/models/create_flight_estimate_request.rb
109
109
  - lib/patch_ruby/models/create_hotel_estimate_request.rb
110
110
  - lib/patch_ruby/models/create_mass_estimate_request.rb
111
+ - lib/patch_ruby/models/create_order_line_item_request.rb
111
112
  - lib/patch_ruby/models/create_order_request.rb
112
113
  - lib/patch_ruby/models/create_rail_shipping_estimate_request.rb
113
114
  - lib/patch_ruby/models/create_road_shipping_estimate_request.rb
@@ -115,6 +116,8 @@ files:
115
116
  - lib/patch_ruby/models/create_shipping_estimate_request.rb
116
117
  - lib/patch_ruby/models/create_success_response.rb
117
118
  - lib/patch_ruby/models/create_vehicle_estimate_request.rb
119
+ - lib/patch_ruby/models/delete_order_line_item_response.rb
120
+ - lib/patch_ruby/models/delete_order_response.rb
118
121
  - lib/patch_ruby/models/error_response.rb
119
122
  - lib/patch_ruby/models/estimate.rb
120
123
  - lib/patch_ruby/models/estimate_list_response.rb
@@ -123,9 +126,10 @@ files:
123
126
  - lib/patch_ruby/models/inventory.rb
124
127
  - lib/patch_ruby/models/meta_index_object.rb
125
128
  - lib/patch_ruby/models/order.rb
126
- - lib/patch_ruby/models/order_inventory.rb
127
- - lib/patch_ruby/models/order_inventory_project.rb
128
129
  - lib/patch_ruby/models/order_issued_to.rb
130
+ - lib/patch_ruby/models/order_line_item.rb
131
+ - lib/patch_ruby/models/order_line_item_project.rb
132
+ - lib/patch_ruby/models/order_line_item_response.rb
129
133
  - lib/patch_ruby/models/order_list_response.rb
130
134
  - lib/patch_ruby/models/order_response.rb
131
135
  - lib/patch_ruby/models/parent_technology_type.rb
@@ -138,16 +142,17 @@ files:
138
142
  - lib/patch_ruby/models/standard.rb
139
143
  - lib/patch_ruby/models/technology_type.rb
140
144
  - lib/patch_ruby/models/technology_type_list_response.rb
145
+ - lib/patch_ruby/models/update_order_line_item_request.rb
141
146
  - lib/patch_ruby/version.rb
142
147
  - patch_ruby.gemspec
143
148
  - spec/api/estimates_api_spec.rb
149
+ - spec/api/order_line_items_api_spec.rb
144
150
  - spec/api/orders_api_spec.rb
145
151
  - spec/api/projects_api_spec.rb
146
152
  - spec/api/technology_types_api_spec.rb
147
153
  - spec/api_client_spec.rb
148
154
  - spec/configuration_spec.rb
149
155
  - spec/constants.rb
150
- - spec/factories/allocations.rb
151
156
  - spec/factories/create_mass_estimate_requests.rb
152
157
  - spec/factories/create_order_requests.rb
153
158
  - spec/factories/error_responses.rb
@@ -168,7 +173,6 @@ files:
168
173
  - spec/integration/orders_spec.rb
169
174
  - spec/integration/projects/technology_types_spec.rb
170
175
  - spec/integration/projects_spec.rb
171
- - spec/models/allocation_spec.rb
172
176
  - spec/models/create_mass_estimate_request_spec.rb
173
177
  - spec/models/create_order_request_spec.rb
174
178
  - spec/models/error_response_spec.rb
@@ -209,47 +213,46 @@ signing_key:
209
213
  specification_version: 4
210
214
  summary: Ruby wrapper for the Patch API
211
215
  test_files:
212
- - spec/api/projects_api_spec.rb
213
- - spec/api/orders_api_spec.rb
214
216
  - spec/api/technology_types_api_spec.rb
217
+ - spec/api/order_line_items_api_spec.rb
218
+ - spec/api/orders_api_spec.rb
219
+ - spec/api/projects_api_spec.rb
215
220
  - spec/api/estimates_api_spec.rb
216
221
  - spec/api_client_spec.rb
217
222
  - spec/configuration_spec.rb
218
223
  - spec/constants.rb
219
224
  - spec/factories/parent_technology_type.rb
225
+ - spec/factories/estimate_responses.rb
220
226
  - spec/factories/sdgs.rb
227
+ - spec/factories/estimate_list_responses.rb
228
+ - spec/factories/order_list_responses.rb
229
+ - spec/factories/project_responses.rb
230
+ - spec/factories/projects.rb
221
231
  - spec/factories/project_list_responses.rb
222
- - spec/factories/estimate_responses.rb
223
232
  - spec/factories/orders.rb
224
- - spec/factories/meta_index_objects.rb
225
- - spec/factories/create_order_requests.rb
226
- - spec/factories/order_responses.rb
227
- - spec/factories/project_responses.rb
228
- - spec/factories/allocations.rb
229
233
  - spec/factories/estimates.rb
230
- - spec/factories/projects.rb
231
- - spec/factories/estimate_list_responses.rb
232
- - spec/factories/order_list_responses.rb
233
- - spec/factories/error_responses.rb
234
- - spec/factories/technology_type.rb
234
+ - spec/factories/create_order_requests.rb
235
235
  - spec/factories/create_mass_estimate_requests.rb
236
- - spec/integration/projects/technology_types_spec.rb
236
+ - spec/factories/meta_index_objects.rb
237
+ - spec/factories/technology_type.rb
238
+ - spec/factories/error_responses.rb
239
+ - spec/factories/order_responses.rb
237
240
  - spec/integration/orders_spec.rb
238
- - spec/integration/estimates_spec.rb
239
241
  - spec/integration/projects_spec.rb
240
- - spec/models/allocation_spec.rb
242
+ - spec/integration/projects/technology_types_spec.rb
243
+ - spec/integration/estimates_spec.rb
244
+ - spec/models/order_response_spec.rb
245
+ - spec/models/order_list_response_spec.rb
246
+ - spec/models/order_spec.rb
247
+ - spec/models/create_mass_estimate_request_spec.rb
248
+ - spec/models/estimate_response_spec.rb
241
249
  - spec/models/project_list_response_spec.rb
250
+ - spec/models/error_response_spec.rb
242
251
  - spec/models/meta_index_object_spec.rb
243
- - spec/models/estimate_response_spec.rb
244
- - spec/models/estimate_list_response_spec.rb
245
- - spec/models/create_mass_estimate_request_spec.rb
246
252
  - spec/models/project_response_spec.rb
247
- - spec/models/error_response_spec.rb
248
- - spec/models/estimate_spec.rb
249
- - spec/models/order_list_response_spec.rb
250
- - spec/models/order_response_spec.rb
251
253
  - spec/models/project_spec.rb
252
- - spec/models/order_spec.rb
254
+ - spec/models/estimate_spec.rb
255
+ - spec/models/estimate_list_response_spec.rb
253
256
  - spec/models/create_order_request_spec.rb
254
257
  - spec/patch_ruby_spec.rb
255
258
  - spec/spec_helper.rb