patch_ruby 2.0.0 → 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_client.rb +1 -1
- data/lib/patch_ruby/configuration.rb +1 -2
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +5 -5
- data/lib/patch_ruby/models/create_order_line_item_request.rb +74 -6
- data/lib/patch_ruby/models/create_order_request.rb +74 -6
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +11 -1
- data/lib/patch_ruby/models/disclaimer.rb +282 -0
- data/lib/patch_ruby/models/inventory.rb +31 -1
- data/lib/patch_ruby/models/order.rb +6 -6
- data/lib/patch_ruby/models/order_line_item.rb +31 -1
- data/lib/patch_ruby/models/project.rb +60 -4
- data/lib/patch_ruby/models/update_order_line_item_request.rb +74 -6
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +1 -0
- data/spec/integration/estimates_spec.rb +1 -1
- data/spec/integration/orders_spec.rb +36 -0
- data/spec/integration/projects_spec.rb +17 -3
- data/spec/models/create_order_request_spec.rb +1 -1
- metadata +26 -25
@@ -0,0 +1,282 @@
|
|
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 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Patch
|
17
|
+
class Disclaimer
|
18
|
+
# The body of the disclaimer.
|
19
|
+
attr_accessor :body
|
20
|
+
|
21
|
+
# The header for the disclaimer.
|
22
|
+
attr_accessor :header
|
23
|
+
|
24
|
+
# The severity of the disclaimer.
|
25
|
+
attr_accessor :severity
|
26
|
+
|
27
|
+
# The text for the provided link.
|
28
|
+
attr_accessor :link_text
|
29
|
+
|
30
|
+
# The destination of the provided link.
|
31
|
+
attr_accessor :link_destination
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'body' => :'body',
|
37
|
+
:'header' => :'header',
|
38
|
+
:'severity' => :'severity',
|
39
|
+
:'link_text' => :'link_text',
|
40
|
+
:'link_destination' => :'link_destination'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns all the JSON keys this model knows about
|
45
|
+
def self.acceptable_attributes
|
46
|
+
attribute_map.values
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.openapi_types
|
51
|
+
{
|
52
|
+
:'body' => :'String',
|
53
|
+
:'header' => :'String',
|
54
|
+
:'severity' => :'String',
|
55
|
+
:'link_text' => :'String',
|
56
|
+
:'link_destination' => :'String'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# List of attributes with nullable: true
|
61
|
+
def self.openapi_nullable
|
62
|
+
Set.new([
|
63
|
+
:'body',
|
64
|
+
:'link_text',
|
65
|
+
:'link_destination'
|
66
|
+
])
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
71
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
72
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
73
|
+
def self.method_missing(message, *args, &block)
|
74
|
+
if Object.const_defined?('Patch::DisclaimersApi::OPERATIONS') && Patch::DisclaimersApi::OPERATIONS.include?(message)
|
75
|
+
Patch::DisclaimersApi.new.send(message, *args)
|
76
|
+
else
|
77
|
+
super
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Initializes the object
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
def initialize(attributes = {})
|
84
|
+
if (!attributes.is_a?(Hash))
|
85
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::Disclaimer` initialize method"
|
86
|
+
end
|
87
|
+
|
88
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
89
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
90
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::Disclaimer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
92
|
+
end
|
93
|
+
h[k.to_sym] = v
|
94
|
+
}
|
95
|
+
|
96
|
+
if attributes.key?(:'body')
|
97
|
+
self.body = attributes[:'body']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'header')
|
101
|
+
self.header = attributes[:'header']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'severity')
|
105
|
+
self.severity = attributes[:'severity']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'link_text')
|
109
|
+
self.link_text = attributes[:'link_text']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'link_destination')
|
113
|
+
self.link_destination = attributes[:'link_destination']
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
118
|
+
# @return Array for valid properties with the reasons
|
119
|
+
def list_invalid_properties
|
120
|
+
invalid_properties = Array.new
|
121
|
+
if @header.nil?
|
122
|
+
invalid_properties.push('invalid value for "header", header cannot be nil.')
|
123
|
+
end
|
124
|
+
|
125
|
+
if @severity.nil?
|
126
|
+
invalid_properties.push('invalid value for "severity", severity cannot be nil.')
|
127
|
+
end
|
128
|
+
|
129
|
+
invalid_properties
|
130
|
+
end
|
131
|
+
|
132
|
+
# Check to see if the all the properties in the model are valid
|
133
|
+
# @return true if the model is valid
|
134
|
+
def valid?
|
135
|
+
return false if @header.nil?
|
136
|
+
return false if @severity.nil?
|
137
|
+
true
|
138
|
+
end
|
139
|
+
|
140
|
+
# Checks equality by comparing each attribute.
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def ==(o)
|
143
|
+
return true if self.equal?(o)
|
144
|
+
self.class == o.class &&
|
145
|
+
body == o.body &&
|
146
|
+
header == o.header &&
|
147
|
+
severity == o.severity &&
|
148
|
+
link_text == o.link_text &&
|
149
|
+
link_destination == o.link_destination
|
150
|
+
end
|
151
|
+
|
152
|
+
# @see the `==` method
|
153
|
+
# @param [Object] Object to be compared
|
154
|
+
def eql?(o)
|
155
|
+
self == o
|
156
|
+
end
|
157
|
+
|
158
|
+
# Calculates hash code according to all attributes.
|
159
|
+
# @return [Integer] Hash code
|
160
|
+
def hash
|
161
|
+
[body, header, severity, link_text, link_destination].hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Builds the object from hash
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
# @return [Object] Returns the model itself
|
167
|
+
def self.build_from_hash(attributes)
|
168
|
+
new.build_from_hash(attributes)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Builds the object from hash
|
172
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
173
|
+
# @return [Object] Returns the model itself
|
174
|
+
def build_from_hash(attributes)
|
175
|
+
return nil unless attributes.is_a?(Hash)
|
176
|
+
self.class.openapi_types.each_pair do |key, type|
|
177
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
178
|
+
self.send("#{key}=", nil)
|
179
|
+
elsif type =~ /\AArray<(.*)>/i
|
180
|
+
# check to ensure the input is an array given that the attribute
|
181
|
+
# is documented as an array but the input is not
|
182
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
183
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
184
|
+
end
|
185
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
186
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
self
|
191
|
+
end
|
192
|
+
|
193
|
+
# Deserializes the data based on type
|
194
|
+
# @param string type Data type
|
195
|
+
# @param string value Value to be deserialized
|
196
|
+
# @return [Object] Deserialized data
|
197
|
+
def _deserialize(type, value)
|
198
|
+
case type.to_sym
|
199
|
+
when :Time
|
200
|
+
Time.parse(value)
|
201
|
+
when :Date
|
202
|
+
Date.parse(value)
|
203
|
+
when :String
|
204
|
+
value.to_s
|
205
|
+
when :Integer
|
206
|
+
value.to_i
|
207
|
+
when :Float
|
208
|
+
value.to_f
|
209
|
+
when :Boolean
|
210
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
211
|
+
true
|
212
|
+
else
|
213
|
+
false
|
214
|
+
end
|
215
|
+
when :Object
|
216
|
+
# generic object (usually a Hash), return directly
|
217
|
+
value
|
218
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
219
|
+
inner_type = Regexp.last_match[:inner_type]
|
220
|
+
value.map { |v| _deserialize(inner_type, v) }
|
221
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
222
|
+
k_type = Regexp.last_match[:k_type]
|
223
|
+
v_type = Regexp.last_match[:v_type]
|
224
|
+
{}.tap do |hash|
|
225
|
+
value.each do |k, v|
|
226
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
else # model
|
230
|
+
# models (e.g. Pet) or oneOf
|
231
|
+
klass = Patch.const_get(type)
|
232
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns the string representation of the object
|
237
|
+
# @return [String] String presentation of the object
|
238
|
+
def to_s
|
239
|
+
to_hash.to_s
|
240
|
+
end
|
241
|
+
|
242
|
+
# to_body is an alias to to_hash (backward compatibility)
|
243
|
+
# @return [Hash] Returns the object in the form of hash
|
244
|
+
def to_body
|
245
|
+
to_hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Returns the object in the form of hash
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
250
|
+
def to_hash
|
251
|
+
hash = {}
|
252
|
+
self.class.attribute_map.each_pair do |attr, param|
|
253
|
+
value = self.send(attr)
|
254
|
+
if value.nil?
|
255
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
256
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
257
|
+
end
|
258
|
+
|
259
|
+
hash[param] = _to_hash(value)
|
260
|
+
end
|
261
|
+
hash
|
262
|
+
end
|
263
|
+
|
264
|
+
# Outputs non-array value in the form of hash
|
265
|
+
# For object, use to_hash. Otherwise, just return the value
|
266
|
+
# @param [Object] value Any valid value
|
267
|
+
# @return [Hash] Returns the value in the form of hash
|
268
|
+
def _to_hash(value)
|
269
|
+
if value.is_a?(Array)
|
270
|
+
value.compact.map { |v| _to_hash(v) }
|
271
|
+
elsif value.is_a?(Hash)
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
274
|
+
end
|
275
|
+
elsif value.respond_to? :to_hash
|
276
|
+
value.to_hash
|
277
|
+
else
|
278
|
+
value
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
@@ -18,6 +18,12 @@ module Patch
|
|
18
18
|
# The year in which the climate impacts of the project occurred, or will occur.
|
19
19
|
attr_accessor :vintage_year
|
20
20
|
|
21
|
+
# The starting year in which the climate impacts of the project occurred, or will occur.
|
22
|
+
attr_accessor :vintage_start_year
|
23
|
+
|
24
|
+
# The ending year in which the climate impacts of the project occurred, or will occur.
|
25
|
+
attr_accessor :vintage_end_year
|
26
|
+
|
21
27
|
# The amount available for this vintage year.
|
22
28
|
attr_accessor :amount_available
|
23
29
|
|
@@ -34,6 +40,8 @@ module Patch
|
|
34
40
|
def self.attribute_map
|
35
41
|
{
|
36
42
|
:'vintage_year' => :'vintage_year',
|
43
|
+
:'vintage_start_year' => :'vintage_start_year',
|
44
|
+
:'vintage_end_year' => :'vintage_end_year',
|
37
45
|
:'amount_available' => :'amount_available',
|
38
46
|
:'price' => :'price',
|
39
47
|
:'currency' => :'currency',
|
@@ -50,6 +58,8 @@ module Patch
|
|
50
58
|
def self.openapi_types
|
51
59
|
{
|
52
60
|
:'vintage_year' => :'Integer',
|
61
|
+
:'vintage_start_year' => :'Integer',
|
62
|
+
:'vintage_end_year' => :'Integer',
|
53
63
|
:'amount_available' => :'Integer',
|
54
64
|
:'price' => :'Integer',
|
55
65
|
:'currency' => :'String',
|
@@ -94,6 +104,14 @@ module Patch
|
|
94
104
|
self.vintage_year = attributes[:'vintage_year']
|
95
105
|
end
|
96
106
|
|
107
|
+
if attributes.key?(:'vintage_start_year')
|
108
|
+
self.vintage_start_year = attributes[:'vintage_start_year']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'vintage_end_year')
|
112
|
+
self.vintage_end_year = attributes[:'vintage_end_year']
|
113
|
+
end
|
114
|
+
|
97
115
|
if attributes.key?(:'amount_available')
|
98
116
|
self.amount_available = attributes[:'amount_available']
|
99
117
|
end
|
@@ -119,6 +137,14 @@ module Patch
|
|
119
137
|
invalid_properties.push('invalid value for "vintage_year", vintage_year cannot be nil.')
|
120
138
|
end
|
121
139
|
|
140
|
+
if @vintage_start_year.nil?
|
141
|
+
invalid_properties.push('invalid value for "vintage_start_year", vintage_start_year cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @vintage_end_year.nil?
|
145
|
+
invalid_properties.push('invalid value for "vintage_end_year", vintage_end_year cannot be nil.')
|
146
|
+
end
|
147
|
+
|
122
148
|
if @amount_available.nil?
|
123
149
|
invalid_properties.push('invalid value for "amount_available", amount_available cannot be nil.')
|
124
150
|
end
|
@@ -142,6 +168,8 @@ module Patch
|
|
142
168
|
# @return true if the model is valid
|
143
169
|
def valid?
|
144
170
|
return false if @vintage_year.nil?
|
171
|
+
return false if @vintage_start_year.nil?
|
172
|
+
return false if @vintage_end_year.nil?
|
145
173
|
return false if @amount_available.nil?
|
146
174
|
return false if @price.nil?
|
147
175
|
return false if @currency.nil?
|
@@ -155,6 +183,8 @@ module Patch
|
|
155
183
|
return true if self.equal?(o)
|
156
184
|
self.class == o.class &&
|
157
185
|
vintage_year == o.vintage_year &&
|
186
|
+
vintage_start_year == o.vintage_start_year &&
|
187
|
+
vintage_end_year == o.vintage_end_year &&
|
158
188
|
amount_available == o.amount_available &&
|
159
189
|
price == o.price &&
|
160
190
|
currency == o.currency &&
|
@@ -170,7 +200,7 @@ module Patch
|
|
170
200
|
# Calculates hash code according to all attributes.
|
171
201
|
# @return [Integer] Hash code
|
172
202
|
def hash
|
173
|
-
[vintage_year, amount_available, price, currency, unit].hash
|
203
|
+
[vintage_year, vintage_start_year, vintage_end_year, amount_available, price, currency, unit].hash
|
174
204
|
end
|
175
205
|
|
176
206
|
# Builds the object from hash
|
@@ -42,7 +42,7 @@ module Patch
|
|
42
42
|
# The currency code for the `price` and `patch_fee`.
|
43
43
|
attr_accessor :currency
|
44
44
|
|
45
|
-
# The
|
45
|
+
# The URL of this order in the public registry. Use this URL to access the order's accompanying certificate.
|
46
46
|
attr_accessor :registry_url
|
47
47
|
|
48
48
|
# An optional JSON object containing metadata for this order.
|
@@ -230,8 +230,8 @@ module Patch
|
|
230
230
|
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
231
231
|
end
|
232
232
|
|
233
|
-
if @amount >
|
234
|
-
invalid_properties.push('invalid value for "amount", must be smaller than or equal to
|
233
|
+
if @amount > 100000000000000
|
234
|
+
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000000.')
|
235
235
|
end
|
236
236
|
|
237
237
|
if @amount < 0
|
@@ -270,7 +270,7 @@ module Patch
|
|
270
270
|
state_validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed", "processing", "complete", "cancelled"])
|
271
271
|
return false unless state_validator.valid?(@state)
|
272
272
|
return false if @amount.nil?
|
273
|
-
return false if @amount >
|
273
|
+
return false if @amount > 100000000000000
|
274
274
|
return false if @amount < 0
|
275
275
|
return false if @unit.nil?
|
276
276
|
return false if @price.nil?
|
@@ -297,8 +297,8 @@ module Patch
|
|
297
297
|
fail ArgumentError, 'amount cannot be nil'
|
298
298
|
end
|
299
299
|
|
300
|
-
if amount >
|
301
|
-
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to
|
300
|
+
if amount > 100000000000000
|
301
|
+
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000000.'
|
302
302
|
end
|
303
303
|
|
304
304
|
if amount < 0
|
@@ -24,6 +24,12 @@ module Patch
|
|
24
24
|
# The year in which the climate impacts of the project occurred, or will occur.
|
25
25
|
attr_accessor :vintage_year
|
26
26
|
|
27
|
+
# The starting year in which the climate impacts of the project occurred, or will occur.
|
28
|
+
attr_accessor :vintage_start_year
|
29
|
+
|
30
|
+
# The ending year in which the climate impacts of the project occurred, or will occur.
|
31
|
+
attr_accessor :vintage_end_year
|
32
|
+
|
27
33
|
# The amount ordered for the given project and vintage year.
|
28
34
|
attr_accessor :amount
|
29
35
|
|
@@ -42,6 +48,8 @@ module Patch
|
|
42
48
|
:'id' => :'id',
|
43
49
|
:'project' => :'project',
|
44
50
|
:'vintage_year' => :'vintage_year',
|
51
|
+
:'vintage_start_year' => :'vintage_start_year',
|
52
|
+
:'vintage_end_year' => :'vintage_end_year',
|
45
53
|
:'amount' => :'amount',
|
46
54
|
:'unit' => :'unit',
|
47
55
|
:'price' => :'price',
|
@@ -60,6 +68,8 @@ module Patch
|
|
60
68
|
:'id' => :'String',
|
61
69
|
:'project' => :'OrderLineItemProject',
|
62
70
|
:'vintage_year' => :'Integer',
|
71
|
+
:'vintage_start_year' => :'Integer',
|
72
|
+
:'vintage_end_year' => :'Integer',
|
63
73
|
:'amount' => :'Integer',
|
64
74
|
:'unit' => :'String',
|
65
75
|
:'price' => :'Integer',
|
@@ -115,6 +125,14 @@ module Patch
|
|
115
125
|
self.vintage_year = attributes[:'vintage_year']
|
116
126
|
end
|
117
127
|
|
128
|
+
if attributes.key?(:'vintage_start_year')
|
129
|
+
self.vintage_start_year = attributes[:'vintage_start_year']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'vintage_end_year')
|
133
|
+
self.vintage_end_year = attributes[:'vintage_end_year']
|
134
|
+
end
|
135
|
+
|
118
136
|
if attributes.key?(:'amount')
|
119
137
|
self.amount = attributes[:'amount']
|
120
138
|
end
|
@@ -144,6 +162,14 @@ module Patch
|
|
144
162
|
invalid_properties.push('invalid value for "vintage_year", vintage_year cannot be nil.')
|
145
163
|
end
|
146
164
|
|
165
|
+
if @vintage_start_year.nil?
|
166
|
+
invalid_properties.push('invalid value for "vintage_start_year", vintage_start_year cannot be nil.')
|
167
|
+
end
|
168
|
+
|
169
|
+
if @vintage_end_year.nil?
|
170
|
+
invalid_properties.push('invalid value for "vintage_end_year", vintage_end_year cannot be nil.')
|
171
|
+
end
|
172
|
+
|
147
173
|
if @amount.nil?
|
148
174
|
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
149
175
|
end
|
@@ -168,6 +194,8 @@ module Patch
|
|
168
194
|
def valid?
|
169
195
|
return false if @project.nil?
|
170
196
|
return false if @vintage_year.nil?
|
197
|
+
return false if @vintage_start_year.nil?
|
198
|
+
return false if @vintage_end_year.nil?
|
171
199
|
return false if @amount.nil?
|
172
200
|
return false if @unit.nil?
|
173
201
|
return false if @price.nil?
|
@@ -183,6 +211,8 @@ module Patch
|
|
183
211
|
id == o.id &&
|
184
212
|
project == o.project &&
|
185
213
|
vintage_year == o.vintage_year &&
|
214
|
+
vintage_start_year == o.vintage_start_year &&
|
215
|
+
vintage_end_year == o.vintage_end_year &&
|
186
216
|
amount == o.amount &&
|
187
217
|
unit == o.unit &&
|
188
218
|
price == o.price &&
|
@@ -198,7 +228,7 @@ module Patch
|
|
198
228
|
# Calculates hash code according to all attributes.
|
199
229
|
# @return [Integer] Hash code
|
200
230
|
def hash
|
201
|
-
[id, project, vintage_year, amount, unit, price, currency].hash
|
231
|
+
[id, project, vintage_year, vintage_start_year, vintage_end_year, amount, unit, price, currency].hash
|
202
232
|
end
|
203
233
|
|
204
234
|
# Builds the object from hash
|
@@ -36,6 +36,9 @@ module Patch
|
|
36
36
|
# The state where this project is located.
|
37
37
|
attr_accessor :state
|
38
38
|
|
39
|
+
# The issuance type of the project. One of: ex-ante, ex-post.
|
40
|
+
attr_accessor :issuance_type
|
41
|
+
|
39
42
|
# The latitude at which this project is located.
|
40
43
|
attr_accessor :latitude
|
41
44
|
|
@@ -68,6 +71,31 @@ module Patch
|
|
68
71
|
# An array of objects containing available inventory for a project. Available inventory is grouped by a project's vintage year and returns amount and pricing available for a given vintage year.
|
69
72
|
attr_accessor :inventory
|
70
73
|
|
74
|
+
# An array of objects containing disclaimers about the project. Information, warnings, and critical concerns may be present.
|
75
|
+
attr_accessor :disclaimers
|
76
|
+
|
77
|
+
class EnumAttributeValidator
|
78
|
+
attr_reader :datatype
|
79
|
+
attr_reader :allowable_values
|
80
|
+
|
81
|
+
def initialize(datatype, allowable_values)
|
82
|
+
@allowable_values = allowable_values.map do |value|
|
83
|
+
case datatype.to_s
|
84
|
+
when /Integer/i
|
85
|
+
value.to_i
|
86
|
+
when /Float/i
|
87
|
+
value.to_f
|
88
|
+
else
|
89
|
+
value
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def valid?(value)
|
95
|
+
!value || allowable_values.include?(value)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
71
99
|
# Attribute mapping from ruby-style variable name to JSON key.
|
72
100
|
def self.attribute_map
|
73
101
|
{
|
@@ -78,6 +106,7 @@ module Patch
|
|
78
106
|
:'mechanism' => :'mechanism',
|
79
107
|
:'country' => :'country',
|
80
108
|
:'state' => :'state',
|
109
|
+
:'issuance_type' => :'issuance_type',
|
81
110
|
:'latitude' => :'latitude',
|
82
111
|
:'longitude' => :'longitude',
|
83
112
|
:'project_partner' => :'project_partner',
|
@@ -88,7 +117,8 @@ module Patch
|
|
88
117
|
:'tagline' => :'tagline',
|
89
118
|
:'technology_type' => :'technology_type',
|
90
119
|
:'highlights' => :'highlights',
|
91
|
-
:'inventory' => :'inventory'
|
120
|
+
:'inventory' => :'inventory',
|
121
|
+
:'disclaimers' => :'disclaimers'
|
92
122
|
}
|
93
123
|
end
|
94
124
|
|
@@ -107,6 +137,7 @@ module Patch
|
|
107
137
|
:'mechanism' => :'String',
|
108
138
|
:'country' => :'String',
|
109
139
|
:'state' => :'String',
|
140
|
+
:'issuance_type' => :'String',
|
110
141
|
:'latitude' => :'Float',
|
111
142
|
:'longitude' => :'Float',
|
112
143
|
:'project_partner' => :'String',
|
@@ -117,7 +148,8 @@ module Patch
|
|
117
148
|
:'tagline' => :'String',
|
118
149
|
:'technology_type' => :'TechnologyType',
|
119
150
|
:'highlights' => :'Array<Highlight>',
|
120
|
-
:'inventory' => :'Array<Inventory>'
|
151
|
+
:'inventory' => :'Array<Inventory>',
|
152
|
+
:'disclaimers' => :'Array<Disclaimer>'
|
121
153
|
}
|
122
154
|
end
|
123
155
|
|
@@ -188,6 +220,10 @@ module Patch
|
|
188
220
|
self.state = attributes[:'state']
|
189
221
|
end
|
190
222
|
|
223
|
+
if attributes.key?(:'issuance_type')
|
224
|
+
self.issuance_type = attributes[:'issuance_type']
|
225
|
+
end
|
226
|
+
|
191
227
|
if attributes.key?(:'latitude')
|
192
228
|
self.latitude = attributes[:'latitude']
|
193
229
|
end
|
@@ -242,6 +278,12 @@ module Patch
|
|
242
278
|
self.inventory = value
|
243
279
|
end
|
244
280
|
end
|
281
|
+
|
282
|
+
if attributes.key?(:'disclaimers')
|
283
|
+
if (value = attributes[:'disclaimers']).is_a?(Array)
|
284
|
+
self.disclaimers = value
|
285
|
+
end
|
286
|
+
end
|
245
287
|
end
|
246
288
|
|
247
289
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -295,6 +337,8 @@ module Patch
|
|
295
337
|
return false if @name.nil?
|
296
338
|
return false if @description.nil?
|
297
339
|
return false if @country.nil?
|
340
|
+
issuance_type_validator = EnumAttributeValidator.new('String', ["ex-ante", "ex-post"])
|
341
|
+
return false unless issuance_type_validator.valid?(@issuance_type)
|
298
342
|
return false if @project_partner.nil?
|
299
343
|
return false if @technology_type.nil?
|
300
344
|
return false if @highlights.nil?
|
@@ -302,6 +346,16 @@ module Patch
|
|
302
346
|
true
|
303
347
|
end
|
304
348
|
|
349
|
+
# Custom attribute writer method checking allowed values (enum).
|
350
|
+
# @param [Object] issuance_type Object to be assigned
|
351
|
+
def issuance_type=(issuance_type)
|
352
|
+
validator = EnumAttributeValidator.new('String', ["ex-ante", "ex-post"])
|
353
|
+
unless validator.valid?(issuance_type)
|
354
|
+
fail ArgumentError, "invalid value for \"issuance_type\", must be one of #{validator.allowable_values}."
|
355
|
+
end
|
356
|
+
@issuance_type = issuance_type
|
357
|
+
end
|
358
|
+
|
305
359
|
# Checks equality by comparing each attribute.
|
306
360
|
# @param [Object] Object to be compared
|
307
361
|
def ==(o)
|
@@ -314,6 +368,7 @@ module Patch
|
|
314
368
|
mechanism == o.mechanism &&
|
315
369
|
country == o.country &&
|
316
370
|
state == o.state &&
|
371
|
+
issuance_type == o.issuance_type &&
|
317
372
|
latitude == o.latitude &&
|
318
373
|
longitude == o.longitude &&
|
319
374
|
project_partner == o.project_partner &&
|
@@ -324,7 +379,8 @@ module Patch
|
|
324
379
|
tagline == o.tagline &&
|
325
380
|
technology_type == o.technology_type &&
|
326
381
|
highlights == o.highlights &&
|
327
|
-
inventory == o.inventory
|
382
|
+
inventory == o.inventory &&
|
383
|
+
disclaimers == o.disclaimers
|
328
384
|
end
|
329
385
|
|
330
386
|
# @see the `==` method
|
@@ -336,7 +392,7 @@ module Patch
|
|
336
392
|
# Calculates hash code according to all attributes.
|
337
393
|
# @return [Integer] Hash code
|
338
394
|
def hash
|
339
|
-
[id, production, name, description, mechanism, country, state, latitude, longitude, project_partner, photos, verifier, standard, sdgs, tagline, technology_type, highlights, inventory].hash
|
395
|
+
[id, production, name, description, mechanism, country, state, issuance_type, latitude, longitude, project_partner, photos, verifier, standard, sdgs, tagline, technology_type, highlights, inventory, disclaimers].hash
|
340
396
|
end
|
341
397
|
|
342
398
|
# Builds the object from hash
|