patch_ruby 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c6fea9c586a5bafe867ad4910ca99e8d794eceb17965adbca02f5767f986b69
4
- data.tar.gz: f4afe79ee1e0afdede909be37c1f0aa6b56e4fc018e35a9f2cad3c6d886e6f12
3
+ metadata.gz: d5a1eec7fccc6caad29eefa746c0318b3ee7c2b52ff3694e999bb1bf8086595a
4
+ data.tar.gz: f3acf2fe8fdf86c68b9d4bce4b4e399e9137aae7414fac9e89f96ddecd8f25a5
5
5
  SHA512:
6
- metadata.gz: 9e8f1dadfd649f383d4961ff69bf00392972c5c6eac5cf78d51203965771245c5b8e44e8a4be76a3a3779fb41f020403f8d86596e62ddc6baf17e279d521a96b
7
- data.tar.gz: a46785a949700cfa7268424959162baabae59a959254a3a057ae0cddda972e5ad7d71a4b1bbe46abfa1943767752b612c01900c1229260105bc459cc4f07fe46
6
+ metadata.gz: 5e21d7cb2d176d1b5620f1d44a1c2df35cdea882e888ec7a894dbeb1991734508fe54f2b9be71153022d5f29755925d2e06217f9c50c1405471bed819efd4ded
7
+ data.tar.gz: c10d3372f00070ede5a70b39fe248c5065d8e5fd8fb1ef890add6581fa6ab374487d8594728d437d8aacf34e4b9cba0c71c0de69c89e4eb0259750f55140e621
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.3] - 2020-09-28
11
+
12
+ ### Added
13
+
14
+ - `patch_fee_cents_usd` field to `orders`
15
+
10
16
  ## [1.2.2] - 2020-09-18
11
17
 
12
18
  ### Added
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.2.2)
4
+ patch_ruby (1.2.3)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -0,0 +1,10 @@
1
+ SHELL = /bin/bash
2
+
3
+ build:
4
+ rubocop -a && \
5
+ bundle install
6
+
7
+ test:
8
+ bundle exec rspec
9
+
10
+ .PHONY: build test
data/README.md CHANGED
@@ -38,7 +38,7 @@ require 'patch_ruby'
38
38
 
39
39
  Patch.configure do |config|
40
40
  # Configure the Patch gem with your API key here
41
- config.access_token = ENV['PATCH_RUBY_API_KEY']
41
+ config.access_token = ENV['SANDBOX_API_KEY']
42
42
  end
43
43
  ```
44
44
 
@@ -161,7 +161,7 @@ $ bundle install
161
161
 
162
162
  Set up required environment variables:
163
163
  ```
164
- $ export PATCH_RUBY_API_KEY=<SANDBOX API KEY>
164
+ $ export SANDBOX_API_KEY=<SANDBOX API KEY>
165
165
  ```
166
166
 
167
167
  Run tests:
@@ -26,6 +26,8 @@ module Patch
26
26
 
27
27
  attr_accessor :price_cents_usd
28
28
 
29
+ attr_accessor :patch_fee_cents_usd
30
+
29
31
  attr_accessor :allocations
30
32
 
31
33
  attr_accessor :metadata
@@ -61,6 +63,7 @@ module Patch
61
63
  :'state' => :'state',
62
64
  :'allocation_state' => :'allocation_state',
63
65
  :'price_cents_usd' => :'price_cents_usd',
66
+ :'patch_fee_cents_usd' => :'patch_fee_cents_usd',
64
67
  :'allocations' => :'allocations',
65
68
  :'metadata' => :'metadata'
66
69
  }
@@ -75,6 +78,7 @@ module Patch
75
78
  :'state' => :'String',
76
79
  :'allocation_state' => :'String',
77
80
  :'price_cents_usd' => :'String',
81
+ :'patch_fee_cents_usd' => :'String',
78
82
  :'allocations' => :'Array<Allocation>',
79
83
  :'metadata' => :'Object'
80
84
  }
@@ -130,6 +134,10 @@ module Patch
130
134
  self.price_cents_usd = attributes[:'price_cents_usd']
131
135
  end
132
136
 
137
+ if attributes.key?(:'patch_fee_cents_usd')
138
+ self.patch_fee_cents_usd = attributes[:'patch_fee_cents_usd']
139
+ end
140
+
133
141
  if attributes.key?(:'allocations')
134
142
  if (value = attributes[:'allocations']).is_a?(Array)
135
143
  self.allocations = value
@@ -252,6 +260,7 @@ module Patch
252
260
  state == o.state &&
253
261
  allocation_state == o.allocation_state &&
254
262
  price_cents_usd == o.price_cents_usd &&
263
+ patch_fee_cents_usd == o.patch_fee_cents_usd &&
255
264
  allocations == o.allocations &&
256
265
  metadata == o.metadata
257
266
  end
@@ -265,7 +274,7 @@ module Patch
265
274
  # Calculates hash code according to all attributes.
266
275
  # @return [Integer] Hash code
267
276
  def hash
268
- [id, mass_g, production, state, allocation_state, price_cents_usd, allocations, metadata].hash
277
+ [id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, metadata].hash
269
278
  end
270
279
 
271
280
  # Builds the object from hash
@@ -65,12 +65,17 @@ module Patch
65
65
  # @return Array for valid properties with the reasons
66
66
  def list_invalid_properties
67
67
  invalid_properties = Array.new
68
+ if @url.nil?
69
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
70
+ end
71
+
68
72
  invalid_properties
69
73
  end
70
74
 
71
75
  # Check to see if the all the properties in the model are valid
72
76
  # @return true if the model is valid
73
77
  def valid?
78
+ return false if @url.nil?
74
79
  true
75
80
  end
76
81
 
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '1.2.2'
14
+ VERSION = '1.2.3'
15
15
  end
@@ -0,0 +1,3 @@
1
+ module Constants
2
+ BIOMASS_TEST_PROJECT_ID = "pro_test_c3a9feba769fc7a8806377266ca9ff6a"
3
+ end
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Estimates Integration' do
2
2
  before do
3
3
  Patch.configure do |config|
4
- config.access_token = ENV['PATCH_RUBY_API_KEY']
4
+ config.access_token = ENV['SANDBOX_API_KEY']
5
5
  end
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Orders Integration' do
2
2
  before do
3
3
  Patch.configure do |config|
4
- config.access_token = ENV['PATCH_RUBY_API_KEY']
4
+ config.access_token = ENV['SANDBOX_API_KEY']
5
5
  end
6
6
  end
7
7
 
@@ -26,14 +26,25 @@ RSpec.describe 'Orders Integration' do
26
26
  end
27
27
 
28
28
  it 'supports create with a project-id' do
29
- retrieve_projects_response = Patch::Project.retrieve_projects(page: 1)
30
- project_id = retrieve_projects_response.data.first.id
29
+ retrieve_project_response = Patch::Project.retrieve_project(
30
+ Constants::BIOMASS_TEST_PROJECT_ID
31
+ )
31
32
 
32
- create_order_response = Patch::Order.create_order(mass_g: 100, project_id: project_id)
33
+ project_id = retrieve_project_response.data.id
34
+ average_price_per_tonne_cents_usd = retrieve_project_response.data.average_price_per_tonne_cents_usd
35
+
36
+ order_mass_g = 100_000
37
+ tonne_per_gram = 1_000_000
38
+
39
+ expected_price = (average_price_per_tonne_cents_usd.to_f / tonne_per_gram) * order_mass_g
40
+
41
+ create_order_response = Patch::Order.create_order(mass_g: order_mass_g, project_id: project_id)
33
42
 
34
43
  expect(create_order_response.success).to eq true
35
44
  expect(create_order_response.data.id).not_to be_nil
36
- expect(create_order_response.data.mass_g).to eq(100)
45
+ expect(create_order_response.data.mass_g).to eq(order_mass_g)
46
+ expect(create_order_response.data.price_cents_usd.to_i).to eq(expected_price)
47
+ expect(create_order_response.data.patch_fee_cents_usd).not_to be_empty
37
48
  end
38
49
 
39
50
  it 'supports create with metadata' do
@@ -1,7 +1,7 @@
1
1
  RSpec.describe 'Preferences Integration' do
2
2
  before do
3
3
  Patch.configure do |config|
4
- config.access_token = ENV['PATCH_RUBY_API_KEY']
4
+ config.access_token = ENV['SANDBOX_API_KEY']
5
5
  end
6
6
  end
7
7
 
@@ -1,6 +1,6 @@
1
1
  RSpec.describe 'Projects Integration' do
2
2
  Patch.configure do |config|
3
- config.access_token = ENV['PATCH_RUBY_API_KEY']
3
+ config.access_token = ENV['SANDBOX_API_KEY']
4
4
  end
5
5
 
6
6
  it 'supports retrieve and list' do
@@ -12,6 +12,7 @@ OpenAPI Generator version: 4.3.1
12
12
 
13
13
  # load the gem
14
14
  require 'patch_ruby'
15
+ require 'constants'
15
16
 
16
17
  # The following was generated by the `rspec --init` command. Conventionally, all
17
18
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
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.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patch Technology
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-19 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -80,6 +80,7 @@ files:
80
80
  - CHANGELOG.md
81
81
  - Gemfile
82
82
  - Gemfile.lock
83
+ - Makefile
83
84
  - README.md
84
85
  - Rakefile
85
86
  - lib/patch_ruby.rb
@@ -118,6 +119,7 @@ files:
118
119
  - spec/api/projects_api_spec.rb
119
120
  - spec/api_client_spec.rb
120
121
  - spec/configuration_spec.rb
122
+ - spec/constants.rb
121
123
  - spec/integration/estimates_spec.rb
122
124
  - spec/integration/orders_spec.rb
123
125
  - spec/integration/preferences_spec.rb
@@ -165,32 +167,33 @@ signing_key:
165
167
  specification_version: 4
166
168
  summary: Ruby wrapper for the Patch API
167
169
  test_files:
168
- - spec/api/projects_api_spec.rb
169
- - spec/api/estimates_api_spec.rb
170
170
  - spec/api/preferences_api_spec.rb
171
+ - spec/api/estimates_api_spec.rb
171
172
  - spec/api/orders_api_spec.rb
173
+ - spec/api/projects_api_spec.rb
172
174
  - spec/api_client_spec.rb
173
175
  - spec/configuration_spec.rb
174
- - spec/integration/estimates_spec.rb
175
- - spec/integration/preferences_spec.rb
176
+ - spec/constants.rb
176
177
  - spec/integration/projects_spec.rb
178
+ - spec/integration/preferences_spec.rb
179
+ - spec/integration/estimates_spec.rb
177
180
  - spec/integration/orders_spec.rb
178
- - spec/models/order_spec.rb
179
181
  - spec/models/order_response_spec.rb
180
- - spec/models/create_preference_request_spec.rb
181
- - spec/models/allocation_spec.rb
182
- - spec/models/project_list_response_spec.rb
183
- - spec/models/project_response_spec.rb
184
- - spec/models/order_list_response_spec.rb
185
- - spec/models/preference_spec.rb
186
- - spec/models/estimate_spec.rb
187
182
  - spec/models/estimate_list_response_spec.rb
188
- - spec/models/preference_response_spec.rb
189
- - spec/models/create_order_request_spec.rb
183
+ - spec/models/project_spec.rb
190
184
  - spec/models/estimate_response_spec.rb
185
+ - spec/models/project_response_spec.rb
186
+ - spec/models/error_response_spec.rb
187
+ - spec/models/estimate_spec.rb
191
188
  - spec/models/create_mass_estimate_request_spec.rb
189
+ - spec/models/project_list_response_spec.rb
190
+ - spec/models/preference_spec.rb
191
+ - spec/models/create_order_request_spec.rb
192
+ - spec/models/order_list_response_spec.rb
192
193
  - spec/models/preference_list_response_spec.rb
193
- - spec/models/error_response_spec.rb
194
- - spec/models/project_spec.rb
194
+ - spec/models/preference_response_spec.rb
195
+ - spec/models/allocation_spec.rb
196
+ - spec/models/order_spec.rb
195
197
  - spec/models/meta_index_object_spec.rb
198
+ - spec/models/create_preference_request_spec.rb
196
199
  - spec/spec_helper.rb