patch_ruby 1.12.0 → 1.15.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 +24 -0
- data/Gemfile.lock +2 -2
- data/lib/patch_ruby/api/estimates_api.rb +2 -2
- data/lib/patch_ruby/api/technology_types_api.rb +84 -0
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +13 -1
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +13 -1
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -0
- data/lib/patch_ruby/models/order.rb +1 -1
- data/lib/patch_ruby/models/parent_technology_type.rb +240 -0
- data/lib/patch_ruby/models/project.rb +92 -15
- data/lib/patch_ruby/models/technology_type.rb +259 -0
- data/lib/patch_ruby/models/technology_type_list_response.rb +259 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +4 -0
- data/spec/api/technology_types_api_spec.rb +46 -0
- data/spec/factories/parent_technology_type.rb +8 -0
- data/spec/factories/projects.rb +7 -0
- data/spec/factories/sdgs.rb +10 -0
- data/spec/factories/technology_type.rb +9 -0
- data/spec/integration/estimates_spec.rb +16 -2
- data/spec/integration/orders_spec.rb +2 -2
- data/spec/integration/projects/technology_types_spec.rb +14 -0
- data/spec/integration/projects_spec.rb +17 -1
- data/spec/models/create_mass_estimate_request_spec.rb +1 -1
- data/spec/models/project_spec.rb +10 -2
- metadata +41 -27
@@ -0,0 +1,259 @@
|
|
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: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Patch
|
17
|
+
class TechnologyTypeListResponse
|
18
|
+
attr_accessor :success
|
19
|
+
|
20
|
+
attr_accessor :error
|
21
|
+
|
22
|
+
attr_accessor :data
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'success' => :'success',
|
28
|
+
:'error' => :'error',
|
29
|
+
:'data' => :'data'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'success' => :'Boolean',
|
42
|
+
:'error' => :'Object',
|
43
|
+
:'data' => :'Array<TechnologyType>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'error',
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
56
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
57
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
58
|
+
def self.method_missing(message, *args, &block)
|
59
|
+
if Object.const_defined?('Patch::TechnologyTypeListResponsesApi::OPERATIONS') && Patch::TechnologyTypeListResponsesApi::OPERATIONS.include?(message)
|
60
|
+
Patch::TechnologyTypeListResponsesApi.new.send(message, *args)
|
61
|
+
else
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::TechnologyTypeListResponse` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::TechnologyTypeListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'success')
|
82
|
+
self.success = attributes[:'success']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'error')
|
86
|
+
self.error = attributes[:'error']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'data')
|
90
|
+
if (value = attributes[:'data']).is_a?(Array)
|
91
|
+
self.data = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
97
|
+
# @return Array for valid properties with the reasons
|
98
|
+
def list_invalid_properties
|
99
|
+
invalid_properties = Array.new
|
100
|
+
if @success.nil?
|
101
|
+
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @data.nil?
|
105
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
return false if @success.nil?
|
115
|
+
return false if @data.nil?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
success == o.success &&
|
125
|
+
error == o.error &&
|
126
|
+
data == o.data
|
127
|
+
end
|
128
|
+
|
129
|
+
# @see the `==` method
|
130
|
+
# @param [Object] Object to be compared
|
131
|
+
def eql?(o)
|
132
|
+
self == o
|
133
|
+
end
|
134
|
+
|
135
|
+
# Calculates hash code according to all attributes.
|
136
|
+
# @return [Integer] Hash code
|
137
|
+
def hash
|
138
|
+
[success, error, data].hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def self.build_from_hash(attributes)
|
145
|
+
new.build_from_hash(attributes)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Builds the object from hash
|
149
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
+
# @return [Object] Returns the model itself
|
151
|
+
def build_from_hash(attributes)
|
152
|
+
return nil unless attributes.is_a?(Hash)
|
153
|
+
self.class.openapi_types.each_pair do |key, type|
|
154
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
155
|
+
self.send("#{key}=", nil)
|
156
|
+
elsif type =~ /\AArray<(.*)>/i
|
157
|
+
# check to ensure the input is an array given that the attribute
|
158
|
+
# is documented as an array but the input is not
|
159
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
160
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
161
|
+
end
|
162
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
163
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
self
|
168
|
+
end
|
169
|
+
|
170
|
+
# Deserializes the data based on type
|
171
|
+
# @param string type Data type
|
172
|
+
# @param string value Value to be deserialized
|
173
|
+
# @return [Object] Deserialized data
|
174
|
+
def _deserialize(type, value)
|
175
|
+
case type.to_sym
|
176
|
+
when :Time
|
177
|
+
Time.parse(value)
|
178
|
+
when :Date
|
179
|
+
Date.parse(value)
|
180
|
+
when :String
|
181
|
+
value.to_s
|
182
|
+
when :Integer
|
183
|
+
value.to_i
|
184
|
+
when :Float
|
185
|
+
value.to_f
|
186
|
+
when :Boolean
|
187
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
188
|
+
true
|
189
|
+
else
|
190
|
+
false
|
191
|
+
end
|
192
|
+
when :Object
|
193
|
+
# generic object (usually a Hash), return directly
|
194
|
+
value
|
195
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
196
|
+
inner_type = Regexp.last_match[:inner_type]
|
197
|
+
value.map { |v| _deserialize(inner_type, v) }
|
198
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
199
|
+
k_type = Regexp.last_match[:k_type]
|
200
|
+
v_type = Regexp.last_match[:v_type]
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each do |k, v|
|
203
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
else # model
|
207
|
+
# models (e.g. Pet) or oneOf
|
208
|
+
klass = Patch.const_get(type)
|
209
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the string representation of the object
|
214
|
+
# @return [String] String presentation of the object
|
215
|
+
def to_s
|
216
|
+
to_hash.to_s
|
217
|
+
end
|
218
|
+
|
219
|
+
# to_body is an alias to to_hash (backward compatibility)
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_body
|
222
|
+
to_hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the object in the form of hash
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_hash
|
228
|
+
hash = {}
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
230
|
+
value = self.send(attr)
|
231
|
+
if value.nil?
|
232
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
233
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
234
|
+
end
|
235
|
+
|
236
|
+
hash[param] = _to_hash(value)
|
237
|
+
end
|
238
|
+
hash
|
239
|
+
end
|
240
|
+
|
241
|
+
# Outputs non-array value in the form of hash
|
242
|
+
# For object, use to_hash. Otherwise, just return the value
|
243
|
+
# @param [Object] value Any valid value
|
244
|
+
# @return [Hash] Returns the value in the form of hash
|
245
|
+
def _to_hash(value)
|
246
|
+
if value.is_a?(Array)
|
247
|
+
value.compact.map { |v| _to_hash(v) }
|
248
|
+
elsif value.is_a?(Hash)
|
249
|
+
{}.tap do |hash|
|
250
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
251
|
+
end
|
252
|
+
elsif value.respond_to? :to_hash
|
253
|
+
value.to_hash
|
254
|
+
else
|
255
|
+
value
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
data/lib/patch_ruby/version.rb
CHANGED
data/lib/patch_ruby.rb
CHANGED
@@ -35,6 +35,7 @@ require 'patch_ruby/models/meta_index_object'
|
|
35
35
|
require 'patch_ruby/models/order'
|
36
36
|
require 'patch_ruby/models/order_list_response'
|
37
37
|
require 'patch_ruby/models/order_response'
|
38
|
+
require 'patch_ruby/models/parent_technology_type'
|
38
39
|
require 'patch_ruby/models/photo'
|
39
40
|
require 'patch_ruby/models/preference'
|
40
41
|
require 'patch_ruby/models/preference_list_response'
|
@@ -44,12 +45,15 @@ require 'patch_ruby/models/project_list_response'
|
|
44
45
|
require 'patch_ruby/models/project_response'
|
45
46
|
require 'patch_ruby/models/sdg'
|
46
47
|
require 'patch_ruby/models/standard'
|
48
|
+
require 'patch_ruby/models/technology_type'
|
49
|
+
require 'patch_ruby/models/technology_type_list_response'
|
47
50
|
|
48
51
|
# APIs
|
49
52
|
require 'patch_ruby/api/estimates_api'
|
50
53
|
require 'patch_ruby/api/orders_api'
|
51
54
|
require 'patch_ruby/api/preferences_api'
|
52
55
|
require 'patch_ruby/api/projects_api'
|
56
|
+
require 'patch_ruby/api/technology_types_api'
|
53
57
|
|
54
58
|
module Patch
|
55
59
|
class << self
|
@@ -0,0 +1,46 @@
|
|
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: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Patch::TechnologyTypesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'TechnologyTypesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Patch::TechnologyTypesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of TechnologyTypesApi' do
|
30
|
+
it 'should create an instance of TechnologyTypesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Patch::TechnologyTypesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for retrieve_technology_types
|
36
|
+
# Retrieves the list of technology_types
|
37
|
+
# Retrieves a list of all technology_types.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [TechnologyTypeListResponse]
|
40
|
+
describe 'retrieve_technology_types test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
data/spec/factories/projects.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :project, class: Patch::Project do
|
3
3
|
sequence(:id) { |n| n }
|
4
|
+
association(:technology_type)
|
5
|
+
sdgs { build_list(:sdg, 1) }
|
6
|
+
|
4
7
|
production { false }
|
5
8
|
name { "New Project" }
|
6
9
|
description { "New Descirption" }
|
@@ -11,5 +14,9 @@ FactoryBot.define do
|
|
11
14
|
average_price_per_tonne_cents_usd { 120 }
|
12
15
|
remaining_mass_g { 1_000 }
|
13
16
|
standard { 'european_biochar_certificate' }
|
17
|
+
state { 'CO' }
|
18
|
+
latitude { 45.0 }
|
19
|
+
longitude { 45.0 }
|
20
|
+
mechanism { 'removal' }
|
14
21
|
end
|
15
22
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :sdg, class: Patch::Sdg do
|
5
|
+
description { "Take urgent action to combat climate change and its impacts." }
|
6
|
+
number { 13 }
|
7
|
+
title { "Climate Action" }
|
8
|
+
url { "https://sdgs.un.org/goals/goal13" }
|
9
|
+
end
|
10
|
+
end
|
@@ -56,11 +56,12 @@ RSpec.describe 'Estimates Integration' do
|
|
56
56
|
make: make,
|
57
57
|
model: model,
|
58
58
|
year: year,
|
59
|
-
create_order:
|
59
|
+
create_order: true
|
60
60
|
)
|
61
61
|
|
62
62
|
expect(vehicle_estimate.data.type).to eq 'vehicle'
|
63
63
|
expect(vehicle_estimate.data.mass_g).to eq 5_500
|
64
|
+
expect(vehicle_estimate.data.order.mass_g).to eq 5_500
|
64
65
|
end
|
65
66
|
|
66
67
|
it 'supports creating vehicle estimates with partial information' do
|
@@ -91,7 +92,7 @@ RSpec.describe 'Estimates Integration' do
|
|
91
92
|
|
92
93
|
|
93
94
|
it 'supports creating bitcoin estimates with partial information' do
|
94
|
-
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate(
|
95
|
+
bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate()
|
95
96
|
|
96
97
|
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
97
98
|
expect(bitcoin_estimate.data.mass_g).to be >= 2_000
|
@@ -123,6 +124,19 @@ RSpec.describe 'Estimates Integration' do
|
|
123
124
|
expect(bitcoin_estimate_1.data.mass_g).to be > bitcoin_estimate_2.data.mass_g # Bitcoin was emitting less in July 2021 than in June
|
124
125
|
end
|
125
126
|
|
127
|
+
it 'supports creating bitcoin estimates with a average_daily_balance_btc_sats' do
|
128
|
+
bitcoin_estimate_1 = Patch::Estimate.create_bitcoin_estimate(
|
129
|
+
average_daily_balance_btc_sats: 1000000
|
130
|
+
)
|
131
|
+
|
132
|
+
bitcoin_estimate_2 = Patch::Estimate.create_bitcoin_estimate(
|
133
|
+
average_daily_balance_btc_sats: 10000000
|
134
|
+
)
|
135
|
+
|
136
|
+
expect(bitcoin_estimate_1.data.type).to eq 'bitcoin'
|
137
|
+
expect(bitcoin_estimate_1.data.mass_g).to be < bitcoin_estimate_2.data.mass_g
|
138
|
+
end
|
139
|
+
|
126
140
|
it 'supports creating ethereum estimates with a gas amount' do
|
127
141
|
ethereum_estimate = Patch::Estimate.create_ethereum_estimate(
|
128
142
|
gas_used: 100
|
@@ -87,13 +87,13 @@ RSpec.describe 'Orders Integration' do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'supports place and cancel for orders created via an estimate' do
|
90
|
-
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
|
90
|
+
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
|
91
91
|
order_to_place_id = create_estimate_to_place_response.data.order.id
|
92
92
|
|
93
93
|
place_order_response = Patch::Order.place_order(order_to_place_id)
|
94
94
|
expect(place_order_response.data.state).to eq 'placed'
|
95
95
|
|
96
|
-
create_estimate_to_cancel_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
|
96
|
+
create_estimate_to_cancel_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
|
97
97
|
order_to_cancel_id = create_estimate_to_cancel_response.data.order.id
|
98
98
|
|
99
99
|
cancel_order_response = Patch::Order.cancel_order(order_to_cancel_id)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe "Projects TechnologyTypes Integration" do
|
4
|
+
it "returns a list of technology types and their parent types" do
|
5
|
+
technology_types = Patch::TechnologyType.retrieve_technology_types()
|
6
|
+
expect(technology_types.data.count).to be_positive
|
7
|
+
expect(technology_types.data.first.slug).to be_a(String)
|
8
|
+
expect(technology_types.data.first.name).to be_a(String)
|
9
|
+
|
10
|
+
parent = technology_types.data.first.parent_technology_type
|
11
|
+
expect(parent.slug).to be_a(String)
|
12
|
+
expect(parent.name).to be_a(String)
|
13
|
+
end
|
14
|
+
end
|
@@ -42,9 +42,25 @@ RSpec.describe 'Projects Integration' do
|
|
42
42
|
it 'returns the expected fields' do
|
43
43
|
project = Patch::Project.retrieve_projects(page: 1).data.first
|
44
44
|
|
45
|
+
keys = attributes_for(:project).keys
|
46
|
+
expect(project.to_hash.keys).to include(*keys)
|
47
|
+
|
45
48
|
expect(project.photos).to be_an_instance_of(Array)
|
46
|
-
expect(project.average_price_per_tonne_cents_usd)
|
49
|
+
expect(project.average_price_per_tonne_cents_usd)
|
50
|
+
.to be_an_instance_of(Integer)
|
47
51
|
expect(project.remaining_mass_g).to be_an_instance_of(Integer)
|
52
|
+
expect(project.longitude).to be_an_instance_of(Float)
|
53
|
+
expect(project.latitude).to be_an_instance_of(Float)
|
54
|
+
|
55
|
+
expect(project.technology_type)
|
56
|
+
.to be_an_instance_of(Patch::TechnologyType)
|
57
|
+
expect(project.technology_type.name).to be_an_instance_of(String)
|
58
|
+
expect(project.technology_type.slug).to be_an_instance_of(String)
|
59
|
+
|
60
|
+
parent_type = project.technology_type.parent_technology_type
|
61
|
+
expect(parent_type).to be_an_instance_of(Patch::ParentTechnologyType)
|
62
|
+
expect(parent_type.name).to be_an_instance_of(String)
|
63
|
+
expect(parent_type.slug).to be_an_instance_of(String)
|
48
64
|
end
|
49
65
|
end
|
50
66
|
end
|
@@ -29,7 +29,7 @@ describe 'CreateMassEstimateRequest' 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 } }
|
32
|
+
let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g, create_order: @instance.create_order } }
|
33
33
|
let(:nullable_properties) { Set.new([:create_order]) }
|
34
34
|
end
|
35
35
|
|
data/spec/models/project_spec.rb
CHANGED
@@ -41,10 +41,18 @@ describe 'Project' do
|
|
41
41
|
photos: @instance.photos,
|
42
42
|
average_price_per_tonne_cents_usd: @instance.average_price_per_tonne_cents_usd,
|
43
43
|
remaining_mass_g: @instance.remaining_mass_g,
|
44
|
-
|
44
|
+
state: @instance.state,
|
45
|
+
longitude: @instance.longitude,
|
46
|
+
latitude: @instance.latitude,
|
47
|
+
standard: @instance.standard,
|
48
|
+
mechanism: @instance.mechanism,
|
49
|
+
technology_type: @instance.technology_type.to_hash,
|
50
|
+
sdgs: @instance.sdgs.map(&:to_hash)
|
45
51
|
}
|
46
52
|
}
|
47
|
-
let(:nullable_properties)
|
53
|
+
let(:nullable_properties) do
|
54
|
+
Set.new(%i[photos standard sdgs state latitude longitude])
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
describe 'test an instance of Project' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patch_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.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: 2021-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/patch_ruby/api/orders_api.rb
|
98
98
|
- lib/patch_ruby/api/preferences_api.rb
|
99
99
|
- lib/patch_ruby/api/projects_api.rb
|
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
|
@@ -118,6 +119,7 @@ files:
|
|
118
119
|
- lib/patch_ruby/models/order.rb
|
119
120
|
- lib/patch_ruby/models/order_list_response.rb
|
120
121
|
- lib/patch_ruby/models/order_response.rb
|
122
|
+
- lib/patch_ruby/models/parent_technology_type.rb
|
121
123
|
- lib/patch_ruby/models/photo.rb
|
122
124
|
- lib/patch_ruby/models/preference.rb
|
123
125
|
- lib/patch_ruby/models/preference_list_response.rb
|
@@ -127,12 +129,15 @@ files:
|
|
127
129
|
- lib/patch_ruby/models/project_response.rb
|
128
130
|
- lib/patch_ruby/models/sdg.rb
|
129
131
|
- lib/patch_ruby/models/standard.rb
|
132
|
+
- lib/patch_ruby/models/technology_type.rb
|
133
|
+
- lib/patch_ruby/models/technology_type_list_response.rb
|
130
134
|
- lib/patch_ruby/version.rb
|
131
135
|
- patch_ruby.gemspec
|
132
136
|
- spec/api/estimates_api_spec.rb
|
133
137
|
- spec/api/orders_api_spec.rb
|
134
138
|
- spec/api/preferences_api_spec.rb
|
135
139
|
- spec/api/projects_api_spec.rb
|
140
|
+
- spec/api/technology_types_api_spec.rb
|
136
141
|
- spec/api_client_spec.rb
|
137
142
|
- spec/configuration_spec.rb
|
138
143
|
- spec/constants.rb
|
@@ -148,15 +153,19 @@ files:
|
|
148
153
|
- spec/factories/order_list_responses.rb
|
149
154
|
- spec/factories/order_responses.rb
|
150
155
|
- spec/factories/orders.rb
|
156
|
+
- spec/factories/parent_technology_type.rb
|
151
157
|
- spec/factories/preference_list_responses.rb
|
152
158
|
- spec/factories/preference_responses.rb
|
153
159
|
- spec/factories/preferences.rb
|
154
160
|
- spec/factories/project_list_responses.rb
|
155
161
|
- spec/factories/project_responses.rb
|
156
162
|
- spec/factories/projects.rb
|
163
|
+
- spec/factories/sdgs.rb
|
164
|
+
- spec/factories/technology_type.rb
|
157
165
|
- spec/integration/estimates_spec.rb
|
158
166
|
- spec/integration/orders_spec.rb
|
159
167
|
- spec/integration/preferences_spec.rb
|
168
|
+
- spec/integration/projects/technology_types_spec.rb
|
160
169
|
- spec/integration/projects_spec.rb
|
161
170
|
- spec/models/allocation_spec.rb
|
162
171
|
- spec/models/create_mass_estimate_request_spec.rb
|
@@ -203,53 +212,58 @@ signing_key:
|
|
203
212
|
specification_version: 4
|
204
213
|
summary: Ruby wrapper for the Patch API
|
205
214
|
test_files:
|
206
|
-
- spec/api/orders_api_spec.rb
|
207
215
|
- spec/api/projects_api_spec.rb
|
216
|
+
- spec/api/orders_api_spec.rb
|
217
|
+
- spec/api/technology_types_api_spec.rb
|
208
218
|
- spec/api/preferences_api_spec.rb
|
209
219
|
- spec/api/estimates_api_spec.rb
|
210
220
|
- spec/api_client_spec.rb
|
211
221
|
- spec/configuration_spec.rb
|
212
222
|
- spec/constants.rb
|
213
|
-
- spec/factories/
|
214
|
-
- spec/factories/
|
223
|
+
- spec/factories/sdgs.rb
|
224
|
+
- spec/factories/order_responses.rb
|
225
|
+
- spec/factories/orders.rb
|
226
|
+
- spec/factories/create_mass_estimate_requests.rb
|
227
|
+
- spec/factories/create_preference_requests.rb
|
228
|
+
- spec/factories/project_responses.rb
|
229
|
+
- spec/factories/meta_index_objects.rb
|
230
|
+
- spec/factories/estimates.rb
|
215
231
|
- spec/factories/order_list_responses.rb
|
216
|
-
- spec/factories/
|
232
|
+
- spec/factories/parent_technology_type.rb
|
233
|
+
- spec/factories/preferences.rb
|
217
234
|
- spec/factories/estimate_list_responses.rb
|
218
|
-
- spec/factories/create_preference_requests.rb
|
219
235
|
- spec/factories/preference_responses.rb
|
220
236
|
- spec/factories/error_responses.rb
|
221
|
-
- spec/factories/
|
222
|
-
- spec/factories/order_responses.rb
|
223
|
-
- spec/factories/create_mass_estimate_requests.rb
|
237
|
+
- spec/factories/projects.rb
|
224
238
|
- spec/factories/preference_list_responses.rb
|
225
239
|
- spec/factories/estimate_responses.rb
|
226
|
-
- spec/factories/meta_index_objects.rb
|
227
|
-
- spec/factories/project_responses.rb
|
228
|
-
- spec/factories/orders.rb
|
229
|
-
- spec/factories/project_list_responses.rb
|
230
240
|
- spec/factories/allocations.rb
|
231
|
-
- spec/
|
241
|
+
- spec/factories/project_list_responses.rb
|
242
|
+
- spec/factories/technology_type.rb
|
243
|
+
- spec/factories/create_order_requests.rb
|
232
244
|
- spec/integration/preferences_spec.rb
|
233
245
|
- spec/integration/estimates_spec.rb
|
234
246
|
- spec/integration/orders_spec.rb
|
235
|
-
- spec/
|
247
|
+
- spec/integration/projects/technology_types_spec.rb
|
248
|
+
- spec/integration/projects_spec.rb
|
249
|
+
- spec/models/estimate_list_response_spec.rb
|
250
|
+
- spec/models/preference_response_spec.rb
|
251
|
+
- spec/models/estimate_spec.rb
|
236
252
|
- spec/models/create_order_request_spec.rb
|
237
|
-
- spec/models/
|
253
|
+
- spec/models/order_list_response_spec.rb
|
238
254
|
- spec/models/preference_list_response_spec.rb
|
239
|
-
- spec/models/
|
240
|
-
- spec/models/estimate_spec.rb
|
241
|
-
- spec/models/project_list_response_spec.rb
|
255
|
+
- spec/models/create_preference_request_spec.rb
|
242
256
|
- spec/models/preference_spec.rb
|
257
|
+
- spec/models/estimate_response_spec.rb
|
258
|
+
- spec/models/order_spec.rb
|
259
|
+
- spec/models/project_response_spec.rb
|
243
260
|
- spec/models/order_response_spec.rb
|
244
|
-
- spec/models/estimate_list_response_spec.rb
|
245
|
-
- spec/models/order_list_response_spec.rb
|
246
|
-
- spec/models/create_preference_request_spec.rb
|
247
261
|
- spec/models/meta_index_object_spec.rb
|
248
|
-
- spec/models/
|
249
|
-
- spec/models/
|
250
|
-
- spec/models/estimate_response_spec.rb
|
251
|
-
- spec/models/project_spec.rb
|
262
|
+
- spec/models/project_list_response_spec.rb
|
263
|
+
- spec/models/error_response_spec.rb
|
252
264
|
- spec/models/allocation_spec.rb
|
265
|
+
- spec/models/project_spec.rb
|
266
|
+
- spec/models/create_mass_estimate_request_spec.rb
|
253
267
|
- spec/patch_ruby_spec.rb
|
254
268
|
- spec/spec_helper.rb
|
255
269
|
- spec/support/shared/generated_classes.rb
|