patch_ruby 1.0.0 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +78 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +30 -11
- data/Makefile +10 -0
- data/README.md +61 -8
- data/lib/patch_ruby.rb +2 -0
- data/lib/patch_ruby/models/allocation.rb +25 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +48 -4
- data/lib/patch_ruby/models/create_order_request.rb +75 -7
- data/lib/patch_ruby/models/create_preference_request.rb +7 -0
- data/lib/patch_ruby/models/error_response.rb +9 -0
- data/lib/patch_ruby/models/estimate.rb +29 -1
- data/lib/patch_ruby/models/estimate_list_response.rb +9 -0
- data/lib/patch_ruby/models/estimate_response.rb +9 -0
- data/lib/patch_ruby/models/meta_index_object.rb +11 -0
- data/lib/patch_ruby/models/order.rb +105 -4
- data/lib/patch_ruby/models/order_list_response.rb +9 -0
- data/lib/patch_ruby/models/order_response.rb +9 -0
- data/lib/patch_ruby/models/photo.rb +233 -0
- data/lib/patch_ruby/models/preference.rb +25 -0
- data/lib/patch_ruby/models/preference_list_response.rb +9 -0
- data/lib/patch_ruby/models/preference_response.rb +9 -0
- data/lib/patch_ruby/models/project.rb +141 -25
- data/lib/patch_ruby/models/project_list_response.rb +9 -0
- data/lib/patch_ruby/models/project_response.rb +9 -0
- data/lib/patch_ruby/models/standard.rb +254 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/spec/api/estimates_api_spec.rb +6 -7
- data/spec/api/orders_api_spec.rb +10 -11
- data/spec/api/preferences_api_spec.rb +8 -9
- data/spec/api/projects_api_spec.rb +4 -5
- data/spec/constants.rb +3 -0
- data/spec/factories/allocations.rb +7 -0
- data/spec/factories/create_mass_estimate_requests.rb +6 -0
- data/spec/factories/create_order_requests.rb +8 -0
- data/spec/factories/create_preference_requests.rb +5 -0
- data/spec/factories/error_responses.rb +7 -0
- data/spec/factories/estimate_list_responses.rb +8 -0
- data/spec/factories/estimate_responses.rb +7 -0
- data/spec/factories/estimates.rb +8 -0
- data/spec/factories/meta_index_objects.rb +6 -0
- data/spec/factories/order_list_responses.rb +8 -0
- data/spec/factories/order_responses.rb +7 -0
- data/spec/factories/orders.rb +12 -0
- data/spec/factories/preference_list_responses.rb +8 -0
- data/spec/factories/preference_responses.rb +7 -0
- data/spec/factories/preferences.rb +7 -0
- data/spec/factories/project_list_responses.rb +8 -0
- data/spec/factories/project_responses.rb +7 -0
- data/spec/factories/projects.rb +15 -0
- data/spec/integration/estimates_spec.rb +4 -3
- data/spec/integration/orders_spec.rb +60 -1
- data/spec/integration/preferences_spec.rb +1 -1
- data/spec/integration/projects_spec.rb +19 -1
- data/spec/models/allocation_spec.rb +8 -2
- data/spec/models/create_mass_estimate_request_spec.rb +7 -2
- data/spec/models/create_order_request_spec.rb +7 -2
- data/spec/models/create_preference_request_spec.rb +8 -2
- data/spec/models/error_response_spec.rb +7 -2
- data/spec/models/estimate_list_response_spec.rb +7 -2
- data/spec/models/estimate_response_spec.rb +7 -2
- data/spec/models/estimate_spec.rb +8 -2
- data/spec/models/meta_index_object_spec.rb +7 -2
- data/spec/models/order_list_response_spec.rb +7 -2
- data/spec/models/order_response_spec.rb +7 -2
- data/spec/models/order_spec.rb +18 -2
- data/spec/models/preference_list_response_spec.rb +7 -2
- data/spec/models/preference_response_spec.rb +7 -2
- data/spec/models/preference_spec.rb +7 -2
- data/spec/models/project_list_response_spec.rb +7 -2
- data/spec/models/project_response_spec.rb +7 -2
- data/spec/models/project_spec.rb +21 -2
- data/spec/spec_helper.rb +11 -0
- data/spec/support/shared/generated_classes.rb +13 -0
- metadata +61 -17
@@ -16,20 +16,39 @@ module Patch
|
|
16
16
|
class CreateOrderRequest
|
17
17
|
attr_accessor :mass_g
|
18
18
|
|
19
|
+
attr_accessor :total_price_cents_usd
|
20
|
+
|
21
|
+
attr_accessor :project_id
|
22
|
+
|
23
|
+
attr_accessor :metadata
|
24
|
+
|
19
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
20
26
|
def self.attribute_map
|
21
27
|
{
|
22
|
-
:'mass_g' => :'mass_g'
|
28
|
+
:'mass_g' => :'mass_g',
|
29
|
+
:'total_price_cents_usd' => :'total_price_cents_usd',
|
30
|
+
:'project_id' => :'project_id',
|
31
|
+
:'metadata' => :'metadata'
|
23
32
|
}
|
24
33
|
end
|
25
34
|
|
26
35
|
# Attribute type mapping.
|
27
36
|
def self.openapi_types
|
28
37
|
{
|
29
|
-
:'mass_g' => :'Integer'
|
38
|
+
:'mass_g' => :'Integer',
|
39
|
+
:'total_price_cents_usd' => :'Integer',
|
40
|
+
:'project_id' => :'String',
|
41
|
+
:'metadata' => :'Object'
|
30
42
|
}
|
31
43
|
end
|
32
44
|
|
45
|
+
# Set with nullable attributes.
|
46
|
+
def self.openapi_nullable
|
47
|
+
nullable_properties = Set.new
|
48
|
+
|
49
|
+
nullable_properties
|
50
|
+
end
|
51
|
+
|
33
52
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
34
53
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
35
54
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -59,14 +78,34 @@ module Patch
|
|
59
78
|
if attributes.key?(:'mass_g')
|
60
79
|
self.mass_g = attributes[:'mass_g']
|
61
80
|
end
|
81
|
+
|
82
|
+
if attributes.key?(:'total_price_cents_usd')
|
83
|
+
self.total_price_cents_usd = attributes[:'total_price_cents_usd']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'project_id')
|
87
|
+
self.project_id = attributes[:'project_id']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'metadata')
|
91
|
+
self.metadata = attributes[:'metadata']
|
92
|
+
end
|
62
93
|
end
|
63
94
|
|
64
95
|
# Show invalid properties with the reasons. Usually used together with valid?
|
65
96
|
# @return Array for valid properties with the reasons
|
66
97
|
def list_invalid_properties
|
67
98
|
invalid_properties = Array.new
|
68
|
-
if
|
69
|
-
invalid_properties.push('invalid value for "mass_g",
|
99
|
+
if !@mass_g.nil? && @mass_g > 2000000000
|
100
|
+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
101
|
+
end
|
102
|
+
|
103
|
+
if !@mass_g.nil? && @mass_g < 1
|
104
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
|
105
|
+
end
|
106
|
+
|
107
|
+
if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
108
|
+
invalid_properties.push('invalid value for "total_price_cents_usd", must be greater than or equal to 1.')
|
70
109
|
end
|
71
110
|
|
72
111
|
invalid_properties
|
@@ -75,16 +114,45 @@ module Patch
|
|
75
114
|
# Check to see if the all the properties in the model are valid
|
76
115
|
# @return true if the model is valid
|
77
116
|
def valid?
|
78
|
-
return false if
|
117
|
+
return false if !@mass_g.nil? && @mass_g > 2000000000
|
118
|
+
return false if !@mass_g.nil? && @mass_g < 1
|
119
|
+
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
79
120
|
true
|
80
121
|
end
|
81
122
|
|
123
|
+
# Custom attribute writer method with validation
|
124
|
+
# @param [Object] mass_g Value to be assigned
|
125
|
+
def mass_g=(mass_g)
|
126
|
+
if !mass_g.nil? && mass_g > 2000000000
|
127
|
+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
128
|
+
end
|
129
|
+
|
130
|
+
if !mass_g.nil? && mass_g < 1
|
131
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
|
132
|
+
end
|
133
|
+
|
134
|
+
@mass_g = mass_g
|
135
|
+
end
|
136
|
+
|
137
|
+
# Custom attribute writer method with validation
|
138
|
+
# @param [Object] total_price_cents_usd Value to be assigned
|
139
|
+
def total_price_cents_usd=(total_price_cents_usd)
|
140
|
+
if !total_price_cents_usd.nil? && total_price_cents_usd < 1
|
141
|
+
fail ArgumentError, 'invalid value for "total_price_cents_usd", must be greater than or equal to 1.'
|
142
|
+
end
|
143
|
+
|
144
|
+
@total_price_cents_usd = total_price_cents_usd
|
145
|
+
end
|
146
|
+
|
82
147
|
# Checks equality by comparing each attribute.
|
83
148
|
# @param [Object] Object to be compared
|
84
149
|
def ==(o)
|
85
150
|
return true if self.equal?(o)
|
86
151
|
self.class == o.class &&
|
87
|
-
mass_g == o.mass_g
|
152
|
+
mass_g == o.mass_g &&
|
153
|
+
total_price_cents_usd == o.total_price_cents_usd &&
|
154
|
+
project_id == o.project_id &&
|
155
|
+
metadata == o.metadata
|
88
156
|
end
|
89
157
|
|
90
158
|
# @see the `==` method
|
@@ -96,7 +164,7 @@ module Patch
|
|
96
164
|
# Calculates hash code according to all attributes.
|
97
165
|
# @return [Integer] Hash code
|
98
166
|
def hash
|
99
|
-
[mass_g].hash
|
167
|
+
[mass_g, total_price_cents_usd, project_id, metadata].hash
|
100
168
|
end
|
101
169
|
|
102
170
|
# Builds the object from hash
|
@@ -30,6 +30,13 @@ module Patch
|
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
33
|
+
# Set with nullable attributes.
|
34
|
+
def self.openapi_nullable
|
35
|
+
nullable_properties = Set.new
|
36
|
+
|
37
|
+
nullable_properties
|
38
|
+
end
|
39
|
+
|
33
40
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
34
41
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
35
42
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -38,6 +38,15 @@ module Patch
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
+
# Set with nullable attributes.
|
42
|
+
def self.openapi_nullable
|
43
|
+
nullable_properties = Set.new
|
44
|
+
|
45
|
+
nullable_properties.add("data")
|
46
|
+
|
47
|
+
nullable_properties
|
48
|
+
end
|
49
|
+
|
41
50
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
42
51
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
43
52
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -14,12 +14,16 @@ require 'date'
|
|
14
14
|
|
15
15
|
module Patch
|
16
16
|
class Estimate
|
17
|
+
# A unique uid for the record. UIDs will be prepended by est_prod or est_test depending on the mode it was created in.
|
17
18
|
attr_accessor :id
|
18
19
|
|
20
|
+
# A boolean indicating if this estimate is a production or test mode estimate.
|
19
21
|
attr_accessor :production
|
20
22
|
|
23
|
+
# The type of estimate. Currently mass is the only supported value.
|
21
24
|
attr_accessor :type
|
22
25
|
|
26
|
+
# An object returning the order associated with this estimate. See the [Order section](/?id=orders) for the full schema.
|
23
27
|
attr_accessor :order
|
24
28
|
|
25
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -42,6 +46,15 @@ module Patch
|
|
42
46
|
}
|
43
47
|
end
|
44
48
|
|
49
|
+
# Set with nullable attributes.
|
50
|
+
def self.openapi_nullable
|
51
|
+
nullable_properties = Set.new
|
52
|
+
|
53
|
+
nullable_properties.add("order")
|
54
|
+
|
55
|
+
nullable_properties
|
56
|
+
end
|
57
|
+
|
45
58
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
46
59
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
47
60
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -89,12 +102,27 @@ module Patch
|
|
89
102
|
# @return Array for valid properties with the reasons
|
90
103
|
def list_invalid_properties
|
91
104
|
invalid_properties = Array.new
|
105
|
+
if @id.nil?
|
106
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
|
+
if @production.nil?
|
110
|
+
invalid_properties.push('invalid value for "production", production cannot be nil.')
|
111
|
+
end
|
112
|
+
|
113
|
+
if @type.nil?
|
114
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
115
|
+
end
|
116
|
+
|
92
117
|
invalid_properties
|
93
118
|
end
|
94
119
|
|
95
120
|
# Check to see if the all the properties in the model are valid
|
96
121
|
# @return true if the model is valid
|
97
122
|
def valid?
|
123
|
+
return false if @id.nil?
|
124
|
+
return false if @production.nil?
|
125
|
+
return false if @type.nil?
|
98
126
|
true
|
99
127
|
end
|
100
128
|
|
@@ -211,7 +239,7 @@ module Patch
|
|
211
239
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
212
240
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
213
241
|
end
|
214
|
-
|
242
|
+
|
215
243
|
hash[param] = _to_hash(value)
|
216
244
|
end
|
217
245
|
hash
|
@@ -42,6 +42,15 @@ module Patch
|
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
+
# Set with nullable attributes.
|
46
|
+
def self.openapi_nullable
|
47
|
+
nullable_properties = Set.new
|
48
|
+
|
49
|
+
nullable_properties.add("error")
|
50
|
+
|
51
|
+
nullable_properties
|
52
|
+
end
|
53
|
+
|
45
54
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
46
55
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
47
56
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -38,6 +38,15 @@ module Patch
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
+
# Set with nullable attributes.
|
42
|
+
def self.openapi_nullable
|
43
|
+
nullable_properties = Set.new
|
44
|
+
|
45
|
+
nullable_properties.add("error")
|
46
|
+
|
47
|
+
nullable_properties
|
48
|
+
end
|
49
|
+
|
41
50
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
42
51
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
43
52
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -34,6 +34,17 @@ module Patch
|
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
37
|
+
# Set with nullable attributes.
|
38
|
+
def self.openapi_nullable
|
39
|
+
nullable_properties = Set.new
|
40
|
+
|
41
|
+
nullable_properties.add("prev_page")
|
42
|
+
|
43
|
+
nullable_properties.add("next_page")
|
44
|
+
|
45
|
+
nullable_properties
|
46
|
+
end
|
47
|
+
|
37
48
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
38
49
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
39
50
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -14,20 +14,33 @@ require 'date'
|
|
14
14
|
|
15
15
|
module Patch
|
16
16
|
class Order
|
17
|
+
# A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in.
|
17
18
|
attr_accessor :id
|
18
19
|
|
20
|
+
# The amount of carbon offsets in grams purchased through this order.
|
19
21
|
attr_accessor :mass_g
|
20
22
|
|
23
|
+
# A boolean indicating if this order is a production or test mode order.
|
21
24
|
attr_accessor :production
|
22
25
|
|
26
|
+
# The current state of the order.
|
23
27
|
attr_accessor :state
|
24
28
|
|
29
|
+
# The current state of the allocated carbon offsets of the order.
|
25
30
|
attr_accessor :allocation_state
|
26
31
|
|
32
|
+
# The total price in cents USD of the carbon offsets purchased through this order.
|
27
33
|
attr_accessor :price_cents_usd
|
28
34
|
|
35
|
+
# The Patch Fee in cents USD for this order.
|
36
|
+
attr_accessor :patch_fee_cents_usd
|
37
|
+
|
38
|
+
# An array containing the inventory allocations for this order.
|
29
39
|
attr_accessor :allocations
|
30
40
|
|
41
|
+
# An optional JSON object containing metadata for this order.
|
42
|
+
attr_accessor :metadata
|
43
|
+
|
31
44
|
class EnumAttributeValidator
|
32
45
|
attr_reader :datatype
|
33
46
|
attr_reader :allowable_values
|
@@ -59,7 +72,9 @@ module Patch
|
|
59
72
|
:'state' => :'state',
|
60
73
|
:'allocation_state' => :'allocation_state',
|
61
74
|
:'price_cents_usd' => :'price_cents_usd',
|
62
|
-
:'
|
75
|
+
:'patch_fee_cents_usd' => :'patch_fee_cents_usd',
|
76
|
+
:'allocations' => :'allocations',
|
77
|
+
:'metadata' => :'metadata'
|
63
78
|
}
|
64
79
|
end
|
65
80
|
|
@@ -72,10 +87,23 @@ module Patch
|
|
72
87
|
:'state' => :'String',
|
73
88
|
:'allocation_state' => :'String',
|
74
89
|
:'price_cents_usd' => :'String',
|
75
|
-
:'
|
90
|
+
:'patch_fee_cents_usd' => :'String',
|
91
|
+
:'allocations' => :'Array<Allocation>',
|
92
|
+
:'metadata' => :'Object'
|
76
93
|
}
|
77
94
|
end
|
78
95
|
|
96
|
+
# Set with nullable attributes.
|
97
|
+
def self.openapi_nullable
|
98
|
+
nullable_properties = Set.new
|
99
|
+
|
100
|
+
nullable_properties.add("price_cents_usd")
|
101
|
+
|
102
|
+
nullable_properties.add("patch_fee_cents_usd")
|
103
|
+
|
104
|
+
nullable_properties
|
105
|
+
end
|
106
|
+
|
79
107
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
80
108
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
81
109
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -126,30 +154,101 @@ module Patch
|
|
126
154
|
self.price_cents_usd = attributes[:'price_cents_usd']
|
127
155
|
end
|
128
156
|
|
157
|
+
if attributes.key?(:'patch_fee_cents_usd')
|
158
|
+
self.patch_fee_cents_usd = attributes[:'patch_fee_cents_usd']
|
159
|
+
end
|
160
|
+
|
129
161
|
if attributes.key?(:'allocations')
|
130
162
|
if (value = attributes[:'allocations']).is_a?(Array)
|
131
163
|
self.allocations = value
|
132
164
|
end
|
133
165
|
end
|
166
|
+
|
167
|
+
if attributes.key?(:'metadata')
|
168
|
+
self.metadata = attributes[:'metadata']
|
169
|
+
end
|
134
170
|
end
|
135
171
|
|
136
172
|
# Show invalid properties with the reasons. Usually used together with valid?
|
137
173
|
# @return Array for valid properties with the reasons
|
138
174
|
def list_invalid_properties
|
139
175
|
invalid_properties = Array.new
|
176
|
+
if @id.nil?
|
177
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
178
|
+
end
|
179
|
+
|
180
|
+
if @mass_g.nil?
|
181
|
+
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
|
182
|
+
end
|
183
|
+
|
184
|
+
if @mass_g > 2000000000
|
185
|
+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
186
|
+
end
|
187
|
+
|
188
|
+
if @mass_g < 1
|
189
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
|
190
|
+
end
|
191
|
+
|
192
|
+
if @production.nil?
|
193
|
+
invalid_properties.push('invalid value for "production", production cannot be nil.')
|
194
|
+
end
|
195
|
+
|
196
|
+
if @state.nil?
|
197
|
+
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
198
|
+
end
|
199
|
+
|
200
|
+
if @allocation_state.nil?
|
201
|
+
invalid_properties.push('invalid value for "allocation_state", allocation_state cannot be nil.')
|
202
|
+
end
|
203
|
+
|
204
|
+
if @allocations.nil?
|
205
|
+
invalid_properties.push('invalid value for "allocations", allocations cannot be nil.')
|
206
|
+
end
|
207
|
+
|
208
|
+
if @metadata.nil?
|
209
|
+
invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
|
210
|
+
end
|
211
|
+
|
140
212
|
invalid_properties
|
141
213
|
end
|
142
214
|
|
143
215
|
# Check to see if the all the properties in the model are valid
|
144
216
|
# @return true if the model is valid
|
145
217
|
def valid?
|
218
|
+
return false if @id.nil?
|
219
|
+
return false if @mass_g.nil?
|
220
|
+
return false if @mass_g > 2000000000
|
221
|
+
return false if @mass_g < 1
|
222
|
+
return false if @production.nil?
|
223
|
+
return false if @state.nil?
|
146
224
|
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
|
147
225
|
return false unless state_validator.valid?(@state)
|
226
|
+
return false if @allocation_state.nil?
|
148
227
|
allocation_state_validator = EnumAttributeValidator.new('String', ["pending", "partially_allocated", "allocated"])
|
149
228
|
return false unless allocation_state_validator.valid?(@allocation_state)
|
229
|
+
return false if @allocations.nil?
|
230
|
+
return false if @metadata.nil?
|
150
231
|
true
|
151
232
|
end
|
152
233
|
|
234
|
+
# Custom attribute writer method with validation
|
235
|
+
# @param [Object] mass_g Value to be assigned
|
236
|
+
def mass_g=(mass_g)
|
237
|
+
if mass_g.nil?
|
238
|
+
fail ArgumentError, 'mass_g cannot be nil'
|
239
|
+
end
|
240
|
+
|
241
|
+
if mass_g > 2000000000
|
242
|
+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
243
|
+
end
|
244
|
+
|
245
|
+
if mass_g < 1
|
246
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
|
247
|
+
end
|
248
|
+
|
249
|
+
@mass_g = mass_g
|
250
|
+
end
|
251
|
+
|
153
252
|
# Custom attribute writer method checking allowed values (enum).
|
154
253
|
# @param [Object] state Object to be assigned
|
155
254
|
def state=(state)
|
@@ -181,7 +280,9 @@ module Patch
|
|
181
280
|
state == o.state &&
|
182
281
|
allocation_state == o.allocation_state &&
|
183
282
|
price_cents_usd == o.price_cents_usd &&
|
184
|
-
|
283
|
+
patch_fee_cents_usd == o.patch_fee_cents_usd &&
|
284
|
+
allocations == o.allocations &&
|
285
|
+
metadata == o.metadata
|
185
286
|
end
|
186
287
|
|
187
288
|
# @see the `==` method
|
@@ -193,7 +294,7 @@ module Patch
|
|
193
294
|
# Calculates hash code according to all attributes.
|
194
295
|
# @return [Integer] Hash code
|
195
296
|
def hash
|
196
|
-
[id, mass_g, production, state, allocation_state, price_cents_usd, allocations].hash
|
297
|
+
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, metadata].hash
|
197
298
|
end
|
198
299
|
|
199
300
|
# Builds the object from hash
|