patch_ruby 1.24.2 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +9 -10
- data/lib/patch_ruby/api/estimates_api.rb +72 -2
- data/lib/patch_ruby/api/order_line_items_api.rb +269 -0
- data/lib/patch_ruby/api/orders_api.rb +99 -4
- data/lib/patch_ruby/api/projects_api.rb +12 -2
- data/lib/patch_ruby/api/technology_types_api.rb +7 -2
- data/lib/patch_ruby/api_client.rb +3 -3
- data/lib/patch_ruby/api_error.rb +2 -2
- data/lib/patch_ruby/configuration.rb +3 -4
- data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_ecommerce_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_hotel_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +7 -7
- data/lib/patch_ruby/models/create_order_line_item_request.rb +443 -0
- data/lib/patch_ruby/models/create_order_request.rb +79 -70
- data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +13 -3
- data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_success_response.rb +2 -2
- data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/delete_order_line_item_response.rb +257 -0
- data/lib/patch_ruby/models/delete_order_response.rb +257 -0
- data/lib/patch_ruby/models/disclaimer.rb +282 -0
- data/lib/patch_ruby/models/error_response.rb +2 -2
- data/lib/patch_ruby/models/estimate.rb +2 -2
- data/lib/patch_ruby/models/estimate_list_response.rb +2 -2
- data/lib/patch_ruby/models/estimate_response.rb +2 -2
- data/lib/patch_ruby/models/highlight.rb +2 -2
- data/lib/patch_ruby/models/inventory.rb +33 -3
- data/lib/patch_ruby/models/meta_index_object.rb +2 -2
- data/lib/patch_ruby/models/order.rb +17 -121
- data/lib/patch_ruby/models/order_issued_to.rb +2 -2
- data/lib/patch_ruby/models/{order_inventory.rb → order_line_item.rb} +49 -9
- data/lib/patch_ruby/models/{order_inventory_project.rb → order_line_item_project.rb} +7 -7
- data/lib/patch_ruby/models/{allocation.rb → order_line_item_response.rb} +33 -40
- data/lib/patch_ruby/models/order_list_response.rb +2 -2
- data/lib/patch_ruby/models/order_response.rb +2 -2
- data/lib/patch_ruby/models/parent_technology_type.rb +2 -2
- data/lib/patch_ruby/models/photo.rb +2 -2
- data/lib/patch_ruby/models/place_order_request.rb +2 -2
- data/lib/patch_ruby/models/project.rb +72 -56
- data/lib/patch_ruby/models/project_list_response.rb +2 -2
- data/lib/patch_ruby/models/project_response.rb +2 -2
- data/lib/patch_ruby/models/sdg.rb +2 -2
- data/lib/patch_ruby/models/standard.rb +2 -2
- data/lib/patch_ruby/models/technology_type.rb +2 -2
- data/lib/patch_ruby/models/technology_type_list_response.rb +2 -2
- data/lib/patch_ruby/models/update_order_line_item_request.rb +434 -0
- data/lib/patch_ruby/version.rb +3 -3
- data/lib/patch_ruby.rb +11 -5
- data/patch_ruby.gemspec +2 -2
- data/spec/api/order_line_items_api_spec.rb +78 -0
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +2 -2
- data/spec/factories/create_order_requests.rb +4 -2
- data/spec/factories/orders.rb +5 -4
- data/spec/factories/projects.rb +1 -4
- data/spec/integration/estimates_spec.rb +1 -1
- data/spec/integration/orders_spec.rb +121 -44
- data/spec/integration/projects_spec.rb +19 -7
- data/spec/models/create_order_request_spec.rb +10 -3
- data/spec/models/order_spec.rb +8 -23
- data/spec/models/project_spec.rb +1 -4
- data/spec/spec_helper.rb +2 -2
- metadata +35 -31
- data/spec/factories/allocations.rb +0 -7
- data/spec/models/allocation_spec.rb +0 -59
@@ -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(
|
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
|
-
|
29
|
+
order_amount = 100_000
|
31
30
|
tonne_per_gram = 1_000_000
|
32
31
|
|
33
|
-
create_order_response = Patch::Order
|
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.
|
40
|
-
expect(order.
|
41
|
-
expect(order.
|
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
|
-
|
52
|
+
total_price = 50_00
|
52
53
|
|
53
54
|
create_order_response = Patch::Order.create_order(
|
54
|
-
|
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.
|
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(
|
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.
|
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(
|
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.
|
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,22 @@ 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(
|
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.
|
133
|
+
expect(create_order_response.data.amount).to eq(100)
|
134
|
+
expect(create_order_response.data.unit).to eq("g")
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'supports create with a vintage start year and vintage end year' do
|
138
|
+
create_order_response =
|
139
|
+
Patch::Order.create_order(amount: 100, unit: "g", vintage_start_year: 2022, vintage_end_year: 2023)
|
140
|
+
|
141
|
+
expect(create_order_response.success).to eq true
|
142
|
+
expect(create_order_response.data.id).not_to be_nil
|
143
|
+
expect(create_order_response.data.amount).to eq(100)
|
144
|
+
expect(create_order_response.data.unit).to eq("g")
|
152
145
|
end
|
153
146
|
|
154
147
|
it 'supports create with an amount and unit' do
|
@@ -159,16 +152,16 @@ RSpec.describe 'Orders Integration' do
|
|
159
152
|
expect(create_order_response.data.id).not_to be_nil
|
160
153
|
expect(create_order_response.data.amount).to eq(100)
|
161
154
|
expect(create_order_response.data.unit).to eq("g")
|
162
|
-
expect(create_order_response.data.
|
163
|
-
Patch::
|
155
|
+
expect(create_order_response.data.line_items[0]).to be_an_instance_of(
|
156
|
+
Patch::OrderLineItem
|
164
157
|
)
|
165
|
-
expect(create_order_response.data.
|
166
|
-
Patch::
|
158
|
+
expect(create_order_response.data.line_items[0].project).to be_an_instance_of(
|
159
|
+
Patch::OrderLineItemProject
|
167
160
|
)
|
168
|
-
expect(create_order_response.data.
|
161
|
+
expect(create_order_response.data.line_items[0].unit).to eq("g")
|
169
162
|
end
|
170
163
|
|
171
|
-
it 'supports create with a total price and currency' do
|
164
|
+
it 'supports create with a total price and foreign currency' do
|
172
165
|
create_order_response =
|
173
166
|
Patch::Order.create_order(total_price: 100, currency: "EUR")
|
174
167
|
|
@@ -178,4 +171,88 @@ RSpec.describe 'Orders Integration' do
|
|
178
171
|
).to be_within(1).of(100)
|
179
172
|
expect(create_order_response.data.currency).to eq "EUR"
|
180
173
|
end
|
174
|
+
|
175
|
+
it 'supports creating an empty draft order and adding/editing line items' do
|
176
|
+
# Create empty order
|
177
|
+
create_order_response =
|
178
|
+
Patch::Order.create_order(state: "draft")
|
179
|
+
|
180
|
+
expect(create_order_response.success).to eq true
|
181
|
+
expect(create_order_response.data.id).not_to be_nil
|
182
|
+
expect(create_order_response.data.price).to eq(0)
|
183
|
+
expect(create_order_response.data.amount).to eq(0)
|
184
|
+
expect(create_order_response.data.line_items).to eq([])
|
185
|
+
|
186
|
+
# Add project to order
|
187
|
+
order_id = create_order_response.data.id
|
188
|
+
retrieve_project_response = Patch::Project.retrieve_project(
|
189
|
+
Constants::BIOMASS_TEST_PROJECT_ID
|
190
|
+
)
|
191
|
+
project_id = retrieve_project_response.data.id
|
192
|
+
|
193
|
+
create_line_item_response = Patch::OrderLineItem
|
194
|
+
.create_order_line_item(order_id, { project_id: project_id })
|
195
|
+
|
196
|
+
expect(create_line_item_response.success).to eq(true)
|
197
|
+
expect(create_line_item_response.data.id).not_to be_nil
|
198
|
+
expect(create_line_item_response.data.amount).to eq(0)
|
199
|
+
|
200
|
+
# Update amount on line item
|
201
|
+
line_item_id = create_line_item_response.data.id
|
202
|
+
update_order_line_item_response = Patch::OrderLineItem
|
203
|
+
.update_order_line_item(order_id, line_item_id, { amount: 100000, unit: "g" })
|
204
|
+
|
205
|
+
expect(update_order_line_item_response.success).to eq(true)
|
206
|
+
expect(update_order_line_item_response.data.id).not_to be_nil
|
207
|
+
expect(update_order_line_item_response.data.amount).to eq(100000)
|
208
|
+
expect(update_order_line_item_response.data.price).to be >= 0
|
209
|
+
|
210
|
+
# Fetch order and check line item matches
|
211
|
+
retrieve_order_response = Patch::Order.retrieve_order(order_id)
|
212
|
+
expect(retrieve_order_response.data.id).to eq order_id
|
213
|
+
expect(retrieve_order_response.data.line_items.length).to eq(1)
|
214
|
+
expect(retrieve_order_response.data.line_items[0].id).to eq(line_item_id)
|
215
|
+
expect(retrieve_order_response.data.line_items[0].amount).to eq(100000)
|
216
|
+
|
217
|
+
# Delete line item
|
218
|
+
delete_line_item_response = Patch::OrderLineItem.delete_order_line_item(order_id, line_item_id)
|
219
|
+
expect(delete_line_item_response.success).to eq(true)
|
220
|
+
expect(delete_line_item_response.data).to eq(line_item_id)
|
221
|
+
|
222
|
+
# Add line item via vintage_start_year and vintage_end_year
|
223
|
+
create_order_line_item_response = Patch::OrderLineItem
|
224
|
+
.create_order_line_item(order_id, { project_id: project_id, amount: 300000, unit: "g", vintage_start_year: 2023, vintage_end_year: 2025 })
|
225
|
+
|
226
|
+
expect(create_order_line_item_response.success).to eq(true)
|
227
|
+
expect(create_order_line_item_response.data.id).not_to be_nil
|
228
|
+
expect(create_order_line_item_response.data.amount).to eq(300000)
|
229
|
+
expect(create_order_line_item_response.data.vintage_start_year).to eq(2023)
|
230
|
+
expect(create_order_line_item_response.data.vintage_end_year).to eq(2025)
|
231
|
+
expect(create_order_line_item_response.data.price).to be >= 0
|
232
|
+
|
233
|
+
# Fetch order and check line item matches
|
234
|
+
retrieve_order_response = Patch::Order.retrieve_order(order_id)
|
235
|
+
expect(retrieve_order_response.data.id).to eq order_id
|
236
|
+
expect(retrieve_order_response.data.line_items.length).to eq(1)
|
237
|
+
expect(retrieve_order_response.data.line_items[0].id).to eq(line_item_id)
|
238
|
+
expect(retrieve_order_response.data.line_items[0].amount).to eq(300000)
|
239
|
+
expect(retrieve_order_response.data.line_items[0].vintage_start_year).to eq(2023)
|
240
|
+
expect(retrieve_order_response.data.line_items[0].vintage_end_year).to eq(2025)
|
241
|
+
|
242
|
+
# Delete line item
|
243
|
+
line_item_id = create_order_line_item_response.data.id
|
244
|
+
delete_line_item_response = Patch::OrderLineItem.delete_order_line_item(order_id, line_item_id)
|
245
|
+
expect(delete_line_item_response.success).to eq(true)
|
246
|
+
expect(delete_line_item_response.data).to eq(line_item_id)
|
247
|
+
|
248
|
+
# Fetch order and see it has no line items
|
249
|
+
retrieve_order_response = Patch::Order.retrieve_order(order_id)
|
250
|
+
expect(retrieve_order_response.data.id).to eq order_id
|
251
|
+
expect(retrieve_order_response.data.line_items.length).to eq(0)
|
252
|
+
|
253
|
+
# Delete order
|
254
|
+
delete_order_response = Patch::Order.delete_order(order_id)
|
255
|
+
expect(delete_order_response.success).to eq(true)
|
256
|
+
expect(delete_order_response.data).to eq(order_id)
|
257
|
+
end
|
181
258
|
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
|
-
|
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
|
|
@@ -67,19 +65,33 @@ RSpec.describe 'Projects Integration' do
|
|
67
65
|
expect(inventory).to be_an_instance_of(Array)
|
68
66
|
expect(inventory[0]).to be_an_instance_of(Patch::Inventory)
|
69
67
|
expect(inventory[0].vintage_year).to be_an_instance_of(Integer)
|
68
|
+
expect(inventory[0].vintage_start_year).to be_an_instance_of(Integer)
|
69
|
+
expect(inventory[0].vintage_end_year).to be_an_instance_of(Integer)
|
70
70
|
expect(inventory[0].amount_available).to be_an_instance_of(Integer)
|
71
71
|
expect(inventory[0].price).to be_an_instance_of(Integer)
|
72
72
|
expect(inventory[0].currency).to be_an_instance_of(String)
|
73
73
|
expect(inventory[0].unit).to be_an_instance_of(String)
|
74
|
+
|
75
|
+
issuance_type = project.issuance_type
|
76
|
+
expect(issuance_type).to be_an_instance_of(String)
|
77
|
+
|
78
|
+
disclaimers = project.disclaimers
|
79
|
+
expect(disclaimers).to be_an_instance_of(Array)
|
80
|
+
expect(disclaimers[0]).to be_an_instance_of(Patch::Disclaimer)
|
81
|
+
expect(disclaimers[0].body).to be_an_instance_of(String)
|
82
|
+
expect(disclaimers[0].header).to be_an_instance_of(String)
|
83
|
+
expect(disclaimers[0].severity).to be_an_instance_of(String)
|
84
|
+
expect(disclaimers[0].link_text).to be_an_instance_of(String)
|
85
|
+
expect(disclaimers[0].link_destination).to be_an_instance_of(String)
|
74
86
|
end
|
75
87
|
|
76
88
|
it 'retrieves projects in the requested language' do
|
77
89
|
projects_response = Patch::Project.retrieve_projects(accept_language: 'fr')
|
78
90
|
|
79
|
-
expect(projects_response.data.
|
91
|
+
expect(projects_response.data.last.name).to include 'Démo' # French
|
80
92
|
|
81
|
-
project_id = projects_response.data.
|
93
|
+
project_id = projects_response.data.last.id
|
82
94
|
project_response = Patch::Project.retrieve_project(project_id, accept_language: 'fr')
|
83
|
-
expect(project_response.data.name).to include 'Démo' #
|
95
|
+
expect(project_response.data.name).to include 'Démo' # French
|
84
96
|
end
|
85
97
|
end
|
@@ -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) { {
|
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[
|
41
|
+
Set.new(%i[project_id metadata state vintage_year vintage_start_year vintage_end_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 "
|
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
|
data/spec/models/order_spec.rb
CHANGED
@@ -32,16 +32,17 @@ describe 'Order' do
|
|
32
32
|
let(:instance_hash) {
|
33
33
|
{
|
34
34
|
id: @instance.id,
|
35
|
-
|
35
|
+
amount: @instance.amount,
|
36
|
+
unit: @instance.unit,
|
36
37
|
production: @instance.production,
|
37
38
|
state: @instance.state,
|
38
|
-
|
39
|
-
|
40
|
-
|
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([
|
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 "
|
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 "
|
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
|
data/spec/models/project_spec.rb
CHANGED
@@ -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
|
-
|
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
|
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:
|
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.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patch Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-18 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,9 @@ 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
|
121
|
+
- lib/patch_ruby/models/disclaimer.rb
|
118
122
|
- lib/patch_ruby/models/error_response.rb
|
119
123
|
- lib/patch_ruby/models/estimate.rb
|
120
124
|
- lib/patch_ruby/models/estimate_list_response.rb
|
@@ -123,9 +127,10 @@ files:
|
|
123
127
|
- lib/patch_ruby/models/inventory.rb
|
124
128
|
- lib/patch_ruby/models/meta_index_object.rb
|
125
129
|
- lib/patch_ruby/models/order.rb
|
126
|
-
- lib/patch_ruby/models/order_inventory.rb
|
127
|
-
- lib/patch_ruby/models/order_inventory_project.rb
|
128
130
|
- lib/patch_ruby/models/order_issued_to.rb
|
131
|
+
- lib/patch_ruby/models/order_line_item.rb
|
132
|
+
- lib/patch_ruby/models/order_line_item_project.rb
|
133
|
+
- lib/patch_ruby/models/order_line_item_response.rb
|
129
134
|
- lib/patch_ruby/models/order_list_response.rb
|
130
135
|
- lib/patch_ruby/models/order_response.rb
|
131
136
|
- lib/patch_ruby/models/parent_technology_type.rb
|
@@ -138,16 +143,17 @@ files:
|
|
138
143
|
- lib/patch_ruby/models/standard.rb
|
139
144
|
- lib/patch_ruby/models/technology_type.rb
|
140
145
|
- lib/patch_ruby/models/technology_type_list_response.rb
|
146
|
+
- lib/patch_ruby/models/update_order_line_item_request.rb
|
141
147
|
- lib/patch_ruby/version.rb
|
142
148
|
- patch_ruby.gemspec
|
143
149
|
- spec/api/estimates_api_spec.rb
|
150
|
+
- spec/api/order_line_items_api_spec.rb
|
144
151
|
- spec/api/orders_api_spec.rb
|
145
152
|
- spec/api/projects_api_spec.rb
|
146
153
|
- spec/api/technology_types_api_spec.rb
|
147
154
|
- spec/api_client_spec.rb
|
148
155
|
- spec/configuration_spec.rb
|
149
156
|
- spec/constants.rb
|
150
|
-
- spec/factories/allocations.rb
|
151
157
|
- spec/factories/create_mass_estimate_requests.rb
|
152
158
|
- spec/factories/create_order_requests.rb
|
153
159
|
- spec/factories/error_responses.rb
|
@@ -168,7 +174,6 @@ files:
|
|
168
174
|
- spec/integration/orders_spec.rb
|
169
175
|
- spec/integration/projects/technology_types_spec.rb
|
170
176
|
- spec/integration/projects_spec.rb
|
171
|
-
- spec/models/allocation_spec.rb
|
172
177
|
- spec/models/create_mass_estimate_request_spec.rb
|
173
178
|
- spec/models/create_order_request_spec.rb
|
174
179
|
- spec/models/error_response_spec.rb
|
@@ -210,47 +215,46 @@ specification_version: 4
|
|
210
215
|
summary: Ruby wrapper for the Patch API
|
211
216
|
test_files:
|
212
217
|
- spec/api/projects_api_spec.rb
|
218
|
+
- spec/api/estimates_api_spec.rb
|
213
219
|
- spec/api/orders_api_spec.rb
|
220
|
+
- spec/api/order_line_items_api_spec.rb
|
214
221
|
- spec/api/technology_types_api_spec.rb
|
215
|
-
- spec/api/estimates_api_spec.rb
|
216
222
|
- spec/api_client_spec.rb
|
217
223
|
- spec/configuration_spec.rb
|
218
224
|
- spec/constants.rb
|
219
|
-
- spec/factories/parent_technology_type.rb
|
220
|
-
- spec/factories/sdgs.rb
|
221
|
-
- spec/factories/project_list_responses.rb
|
222
|
-
- spec/factories/estimate_responses.rb
|
223
|
-
- spec/factories/orders.rb
|
224
225
|
- 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
|
-
- spec/factories/estimates.rb
|
230
|
-
- spec/factories/projects.rb
|
231
226
|
- spec/factories/estimate_list_responses.rb
|
227
|
+
- spec/factories/create_mass_estimate_requests.rb
|
228
|
+
- spec/factories/projects.rb
|
232
229
|
- spec/factories/order_list_responses.rb
|
233
|
-
- spec/factories/error_responses.rb
|
234
230
|
- spec/factories/technology_type.rb
|
235
|
-
- spec/factories/
|
231
|
+
- spec/factories/estimates.rb
|
232
|
+
- spec/factories/error_responses.rb
|
233
|
+
- spec/factories/parent_technology_type.rb
|
234
|
+
- spec/factories/project_responses.rb
|
235
|
+
- spec/factories/create_order_requests.rb
|
236
|
+
- spec/factories/orders.rb
|
237
|
+
- spec/factories/sdgs.rb
|
238
|
+
- spec/factories/order_responses.rb
|
239
|
+
- spec/factories/project_list_responses.rb
|
240
|
+
- spec/factories/estimate_responses.rb
|
236
241
|
- spec/integration/projects/technology_types_spec.rb
|
237
|
-
- spec/integration/orders_spec.rb
|
238
242
|
- spec/integration/estimates_spec.rb
|
239
243
|
- spec/integration/projects_spec.rb
|
240
|
-
- spec/
|
241
|
-
- spec/models/
|
244
|
+
- spec/integration/orders_spec.rb
|
245
|
+
- spec/models/order_response_spec.rb
|
242
246
|
- spec/models/meta_index_object_spec.rb
|
243
|
-
- spec/models/
|
244
|
-
- spec/models/
|
245
|
-
- spec/models/create_mass_estimate_request_spec.rb
|
247
|
+
- spec/models/project_spec.rb
|
248
|
+
- spec/models/create_order_request_spec.rb
|
246
249
|
- spec/models/project_response_spec.rb
|
250
|
+
- spec/models/create_mass_estimate_request_spec.rb
|
251
|
+
- spec/models/project_list_response_spec.rb
|
252
|
+
- spec/models/order_spec.rb
|
247
253
|
- spec/models/error_response_spec.rb
|
248
254
|
- spec/models/estimate_spec.rb
|
249
255
|
- spec/models/order_list_response_spec.rb
|
250
|
-
- spec/models/
|
251
|
-
- spec/models/
|
252
|
-
- spec/models/order_spec.rb
|
253
|
-
- spec/models/create_order_request_spec.rb
|
256
|
+
- spec/models/estimate_list_response_spec.rb
|
257
|
+
- spec/models/estimate_response_spec.rb
|
254
258
|
- spec/patch_ruby_spec.rb
|
255
259
|
- spec/spec_helper.rb
|
256
260
|
- spec/support/shared/generated_classes.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Patch API V1
|
3
|
-
|
4
|
-
#The core API used to integrate with Patch's service
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v1
|
7
|
-
Contact: developers@usepatch.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.3.1
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'spec_helper'
|
14
|
-
require 'json'
|
15
|
-
require 'date'
|
16
|
-
|
17
|
-
# Unit tests for Patch::Allocation
|
18
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
-
# Please update as you see appropriate
|
20
|
-
describe 'Allocation' do
|
21
|
-
before do
|
22
|
-
# run before each test
|
23
|
-
@instance = build(:allocation)
|
24
|
-
end
|
25
|
-
|
26
|
-
after do
|
27
|
-
# run after each test
|
28
|
-
end
|
29
|
-
|
30
|
-
it_behaves_like "a generated class" do
|
31
|
-
let(:instance) { @instance }
|
32
|
-
let(:instance_hash) { { id: @instance.id, mass_g: @instance.mass_g, production: @instance.production } }
|
33
|
-
let(:nullable_properties) { Set.new }
|
34
|
-
end
|
35
|
-
|
36
|
-
describe 'test an instance of Allocation' do
|
37
|
-
it 'should create an instance of Allocation' do
|
38
|
-
expect(@instance).to be_instance_of(Patch::Allocation)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'test attribute "id"' do
|
43
|
-
it 'should work' do
|
44
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'test attribute "production"' do
|
49
|
-
it 'should work' do
|
50
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe 'test attribute "mass_g"' do
|
55
|
-
it 'should work' do
|
56
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|