patch_ruby 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +18 -2
- data/Makefile +10 -0
- data/README.md +48 -9
- data/lib/patch_ruby.rb +2 -0
- data/lib/patch_ruby/api/estimates_api.rb +195 -0
- data/lib/patch_ruby/models/allocation.rb +10 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +47 -1
- data/lib/patch_ruby/models/create_order_request.rb +54 -4
- 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 +24 -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 +58 -1
- 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 +237 -0
- data/lib/patch_ruby/models/preference.rb +10 -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 +74 -4
- 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/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 +41 -9
- data/spec/integration/orders_spec.rb +42 -5
- data/spec/integration/preferences_spec.rb +7 -3
- data/spec/integration/projects_spec.rb +19 -1
- data/spec/models/allocation_spec.rb +8 -1
- data/spec/models/create_mass_estimate_request_spec.rb +7 -1
- data/spec/models/create_order_request_spec.rb +7 -1
- data/spec/models/create_preference_request_spec.rb +8 -1
- data/spec/models/error_response_spec.rb +7 -1
- data/spec/models/estimate_list_response_spec.rb +7 -1
- data/spec/models/estimate_response_spec.rb +7 -1
- data/spec/models/estimate_spec.rb +8 -1
- data/spec/models/meta_index_object_spec.rb +7 -1
- data/spec/models/order_list_response_spec.rb +7 -1
- data/spec/models/order_response_spec.rb +7 -1
- data/spec/models/order_spec.rb +18 -1
- data/spec/models/preference_list_response_spec.rb +7 -1
- data/spec/models/preference_response_spec.rb +7 -1
- data/spec/models/preference_spec.rb +7 -1
- data/spec/models/project_list_response_spec.rb +7 -1
- data/spec/models/project_response_spec.rb +7 -1
- data/spec/models/project_spec.rb +21 -1
- data/spec/spec_helper.rb +11 -0
- data/spec/support/shared/generated_classes.rb +13 -0
- metadata +60 -17
@@ -14,10 +14,13 @@ require 'date'
|
|
14
14
|
|
15
15
|
module Patch
|
16
16
|
class Allocation
|
17
|
+
# A unique uid for the record. UIDs will be prepended by all_prod or all_test depending on the mode it was created in.
|
17
18
|
attr_accessor :id
|
18
19
|
|
20
|
+
# A boolean indicating if this project is a production or test mode project.
|
19
21
|
attr_accessor :production
|
20
22
|
|
23
|
+
# The amount (in grams) of allocated carbon offsets.
|
21
24
|
attr_accessor :mass_g
|
22
25
|
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -38,6 +41,13 @@ module Patch
|
|
38
41
|
}
|
39
42
|
end
|
40
43
|
|
44
|
+
# Set with nullable attributes.
|
45
|
+
def self.openapi_nullable
|
46
|
+
nullable_properties = Set.new
|
47
|
+
|
48
|
+
nullable_properties
|
49
|
+
end
|
50
|
+
|
41
51
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
42
52
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
43
53
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -16,12 +16,15 @@ module Patch
|
|
16
16
|
class CreateMassEstimateRequest
|
17
17
|
attr_accessor :mass_g
|
18
18
|
|
19
|
+
attr_accessor :create_order
|
20
|
+
|
19
21
|
attr_accessor :project_id
|
20
22
|
|
21
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
24
|
def self.attribute_map
|
23
25
|
{
|
24
26
|
:'mass_g' => :'mass_g',
|
27
|
+
:'create_order' => :'create_order',
|
25
28
|
:'project_id' => :'project_id'
|
26
29
|
}
|
27
30
|
end
|
@@ -30,10 +33,20 @@ module Patch
|
|
30
33
|
def self.openapi_types
|
31
34
|
{
|
32
35
|
:'mass_g' => :'Integer',
|
36
|
+
:'create_order' => :'Boolean',
|
33
37
|
:'project_id' => :'String'
|
34
38
|
}
|
35
39
|
end
|
36
40
|
|
41
|
+
# Set with nullable attributes.
|
42
|
+
def self.openapi_nullable
|
43
|
+
nullable_properties = Set.new
|
44
|
+
|
45
|
+
nullable_properties.add("create_order")
|
46
|
+
|
47
|
+
nullable_properties
|
48
|
+
end
|
49
|
+
|
37
50
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
38
51
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
39
52
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -64,6 +77,10 @@ module Patch
|
|
64
77
|
self.mass_g = attributes[:'mass_g']
|
65
78
|
end
|
66
79
|
|
80
|
+
if attributes.key?(:'create_order')
|
81
|
+
self.create_order = attributes[:'create_order']
|
82
|
+
end
|
83
|
+
|
67
84
|
if attributes.key?(:'project_id')
|
68
85
|
self.project_id = attributes[:'project_id']
|
69
86
|
end
|
@@ -77,6 +94,14 @@ module Patch
|
|
77
94
|
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
|
78
95
|
end
|
79
96
|
|
97
|
+
if @mass_g > 2000000000
|
98
|
+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
99
|
+
end
|
100
|
+
|
101
|
+
if @mass_g < 1
|
102
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
|
103
|
+
end
|
104
|
+
|
80
105
|
invalid_properties
|
81
106
|
end
|
82
107
|
|
@@ -84,15 +109,36 @@ module Patch
|
|
84
109
|
# @return true if the model is valid
|
85
110
|
def valid?
|
86
111
|
return false if @mass_g.nil?
|
112
|
+
return false if @mass_g > 2000000000
|
113
|
+
return false if @mass_g < 1
|
87
114
|
true
|
88
115
|
end
|
89
116
|
|
117
|
+
# Custom attribute writer method with validation
|
118
|
+
# @param [Object] mass_g Value to be assigned
|
119
|
+
def mass_g=(mass_g)
|
120
|
+
if mass_g.nil?
|
121
|
+
fail ArgumentError, 'mass_g cannot be nil'
|
122
|
+
end
|
123
|
+
|
124
|
+
if mass_g > 2000000000
|
125
|
+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
126
|
+
end
|
127
|
+
|
128
|
+
if mass_g < 1
|
129
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
|
130
|
+
end
|
131
|
+
|
132
|
+
@mass_g = mass_g
|
133
|
+
end
|
134
|
+
|
90
135
|
# Checks equality by comparing each attribute.
|
91
136
|
# @param [Object] Object to be compared
|
92
137
|
def ==(o)
|
93
138
|
return true if self.equal?(o)
|
94
139
|
self.class == o.class &&
|
95
140
|
mass_g == o.mass_g &&
|
141
|
+
create_order == o.create_order &&
|
96
142
|
project_id == o.project_id
|
97
143
|
end
|
98
144
|
|
@@ -105,7 +151,7 @@ module Patch
|
|
105
151
|
# Calculates hash code according to all attributes.
|
106
152
|
# @return [Integer] Hash code
|
107
153
|
def hash
|
108
|
-
[mass_g, project_id].hash
|
154
|
+
[mass_g, create_order, project_id].hash
|
109
155
|
end
|
110
156
|
|
111
157
|
# Builds the object from hash
|
@@ -16,6 +16,8 @@ module Patch
|
|
16
16
|
class CreateOrderRequest
|
17
17
|
attr_accessor :mass_g
|
18
18
|
|
19
|
+
attr_accessor :total_price_cents_usd
|
20
|
+
|
19
21
|
attr_accessor :project_id
|
20
22
|
|
21
23
|
attr_accessor :metadata
|
@@ -24,6 +26,7 @@ module Patch
|
|
24
26
|
def self.attribute_map
|
25
27
|
{
|
26
28
|
:'mass_g' => :'mass_g',
|
29
|
+
:'total_price_cents_usd' => :'total_price_cents_usd',
|
27
30
|
:'project_id' => :'project_id',
|
28
31
|
:'metadata' => :'metadata'
|
29
32
|
}
|
@@ -33,11 +36,19 @@ module Patch
|
|
33
36
|
def self.openapi_types
|
34
37
|
{
|
35
38
|
:'mass_g' => :'Integer',
|
39
|
+
:'total_price_cents_usd' => :'Integer',
|
36
40
|
:'project_id' => :'String',
|
37
41
|
:'metadata' => :'Object'
|
38
42
|
}
|
39
43
|
end
|
40
44
|
|
45
|
+
# Set with nullable attributes.
|
46
|
+
def self.openapi_nullable
|
47
|
+
nullable_properties = Set.new
|
48
|
+
|
49
|
+
nullable_properties
|
50
|
+
end
|
51
|
+
|
41
52
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
42
53
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
43
54
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -68,6 +79,10 @@ module Patch
|
|
68
79
|
self.mass_g = attributes[:'mass_g']
|
69
80
|
end
|
70
81
|
|
82
|
+
if attributes.key?(:'total_price_cents_usd')
|
83
|
+
self.total_price_cents_usd = attributes[:'total_price_cents_usd']
|
84
|
+
end
|
85
|
+
|
71
86
|
if attributes.key?(:'project_id')
|
72
87
|
self.project_id = attributes[:'project_id']
|
73
88
|
end
|
@@ -81,8 +96,16 @@ module Patch
|
|
81
96
|
# @return Array for valid properties with the reasons
|
82
97
|
def list_invalid_properties
|
83
98
|
invalid_properties = Array.new
|
84
|
-
if
|
85
|
-
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.')
|
86
109
|
end
|
87
110
|
|
88
111
|
invalid_properties
|
@@ -91,16 +114,43 @@ module Patch
|
|
91
114
|
# Check to see if the all the properties in the model are valid
|
92
115
|
# @return true if the model is valid
|
93
116
|
def valid?
|
94
|
-
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
|
95
120
|
true
|
96
121
|
end
|
97
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
|
+
|
98
147
|
# Checks equality by comparing each attribute.
|
99
148
|
# @param [Object] Object to be compared
|
100
149
|
def ==(o)
|
101
150
|
return true if self.equal?(o)
|
102
151
|
self.class == o.class &&
|
103
152
|
mass_g == o.mass_g &&
|
153
|
+
total_price_cents_usd == o.total_price_cents_usd &&
|
104
154
|
project_id == o.project_id &&
|
105
155
|
metadata == o.metadata
|
106
156
|
end
|
@@ -114,7 +164,7 @@ module Patch
|
|
114
164
|
# Calculates hash code according to all attributes.
|
115
165
|
# @return [Integer] Hash code
|
116
166
|
def hash
|
117
|
-
[mass_g, project_id, metadata].hash
|
167
|
+
[mass_g, total_price_cents_usd, project_id, metadata].hash
|
118
168
|
end
|
119
169
|
|
120
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,19 @@ 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. Available types are mass, flight, shipping, and vehicle.
|
21
24
|
attr_accessor :type
|
22
25
|
|
26
|
+
# The estimated mass in grams for this estimate.
|
27
|
+
attr_accessor :mass_g
|
28
|
+
|
29
|
+
# An object returning the order associated with this estimate. See the [Order section](/?id=orders) for the full schema.
|
23
30
|
attr_accessor :order
|
24
31
|
|
25
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -28,6 +35,7 @@ module Patch
|
|
28
35
|
:'id' => :'id',
|
29
36
|
:'production' => :'production',
|
30
37
|
:'type' => :'type',
|
38
|
+
:'mass_g' => :'mass_g',
|
31
39
|
:'order' => :'order'
|
32
40
|
}
|
33
41
|
end
|
@@ -38,10 +46,20 @@ module Patch
|
|
38
46
|
:'id' => :'String',
|
39
47
|
:'production' => :'Boolean',
|
40
48
|
:'type' => :'String',
|
49
|
+
:'mass_g' => :'Integer',
|
41
50
|
:'order' => :'Order'
|
42
51
|
}
|
43
52
|
end
|
44
53
|
|
54
|
+
# Set with nullable attributes.
|
55
|
+
def self.openapi_nullable
|
56
|
+
nullable_properties = Set.new
|
57
|
+
|
58
|
+
nullable_properties.add("order")
|
59
|
+
|
60
|
+
nullable_properties
|
61
|
+
end
|
62
|
+
|
45
63
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
46
64
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
47
65
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -80,6 +98,10 @@ module Patch
|
|
80
98
|
self.type = attributes[:'type']
|
81
99
|
end
|
82
100
|
|
101
|
+
if attributes.key?(:'mass_g')
|
102
|
+
self.mass_g = attributes[:'mass_g']
|
103
|
+
end
|
104
|
+
|
83
105
|
if attributes.key?(:'order')
|
84
106
|
self.order = attributes[:'order']
|
85
107
|
end
|
@@ -121,6 +143,7 @@ module Patch
|
|
121
143
|
id == o.id &&
|
122
144
|
production == o.production &&
|
123
145
|
type == o.type &&
|
146
|
+
mass_g == o.mass_g &&
|
124
147
|
order == o.order
|
125
148
|
end
|
126
149
|
|
@@ -133,7 +156,7 @@ module Patch
|
|
133
156
|
# Calculates hash code according to all attributes.
|
134
157
|
# @return [Integer] Hash code
|
135
158
|
def hash
|
136
|
-
[id, production, type, order].hash
|
159
|
+
[id, production, type, mass_g, order].hash
|
137
160
|
end
|
138
161
|
|
139
162
|
# Builds the object from 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,31 @@ 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.
|
31
42
|
attr_accessor :metadata
|
32
43
|
|
33
44
|
class EnumAttributeValidator
|
@@ -61,6 +72,7 @@ module Patch
|
|
61
72
|
:'state' => :'state',
|
62
73
|
:'allocation_state' => :'allocation_state',
|
63
74
|
:'price_cents_usd' => :'price_cents_usd',
|
75
|
+
:'patch_fee_cents_usd' => :'patch_fee_cents_usd',
|
64
76
|
:'allocations' => :'allocations',
|
65
77
|
:'metadata' => :'metadata'
|
66
78
|
}
|
@@ -75,11 +87,23 @@ module Patch
|
|
75
87
|
:'state' => :'String',
|
76
88
|
:'allocation_state' => :'String',
|
77
89
|
:'price_cents_usd' => :'String',
|
90
|
+
:'patch_fee_cents_usd' => :'String',
|
78
91
|
:'allocations' => :'Array<Allocation>',
|
79
92
|
:'metadata' => :'Object'
|
80
93
|
}
|
81
94
|
end
|
82
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
|
+
|
83
107
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
84
108
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
85
109
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -130,6 +154,10 @@ module Patch
|
|
130
154
|
self.price_cents_usd = attributes[:'price_cents_usd']
|
131
155
|
end
|
132
156
|
|
157
|
+
if attributes.key?(:'patch_fee_cents_usd')
|
158
|
+
self.patch_fee_cents_usd = attributes[:'patch_fee_cents_usd']
|
159
|
+
end
|
160
|
+
|
133
161
|
if attributes.key?(:'allocations')
|
134
162
|
if (value = attributes[:'allocations']).is_a?(Array)
|
135
163
|
self.allocations = value
|
@@ -153,6 +181,14 @@ module Patch
|
|
153
181
|
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
|
154
182
|
end
|
155
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
|
+
|
156
192
|
if @production.nil?
|
157
193
|
invalid_properties.push('invalid value for "production", production cannot be nil.')
|
158
194
|
end
|
@@ -181,6 +217,8 @@ module Patch
|
|
181
217
|
def valid?
|
182
218
|
return false if @id.nil?
|
183
219
|
return false if @mass_g.nil?
|
220
|
+
return false if @mass_g > 2000000000
|
221
|
+
return false if @mass_g < 1
|
184
222
|
return false if @production.nil?
|
185
223
|
return false if @state.nil?
|
186
224
|
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
|
@@ -193,6 +231,24 @@ module Patch
|
|
193
231
|
true
|
194
232
|
end
|
195
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
|
+
|
196
252
|
# Custom attribute writer method checking allowed values (enum).
|
197
253
|
# @param [Object] state Object to be assigned
|
198
254
|
def state=(state)
|
@@ -224,6 +280,7 @@ module Patch
|
|
224
280
|
state == o.state &&
|
225
281
|
allocation_state == o.allocation_state &&
|
226
282
|
price_cents_usd == o.price_cents_usd &&
|
283
|
+
patch_fee_cents_usd == o.patch_fee_cents_usd &&
|
227
284
|
allocations == o.allocations &&
|
228
285
|
metadata == o.metadata
|
229
286
|
end
|
@@ -237,7 +294,7 @@ module Patch
|
|
237
294
|
# Calculates hash code according to all attributes.
|
238
295
|
# @return [Integer] Hash code
|
239
296
|
def hash
|
240
|
-
[id, mass_g, production, state, allocation_state, price_cents_usd, allocations, metadata].hash
|
297
|
+
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, metadata].hash
|
241
298
|
end
|
242
299
|
|
243
300
|
# Builds the object from hash
|