Skip to content

Commit 4ca8973

Browse files
committed
adds total_price_cents_usd to order creation
1 parent 51f12f6 commit 4ca8973

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

lib/patch_ruby/models/create_order_request.rb

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module Patch
1616
class CreateOrderRequest
1717
attr_accessor :mass_g
1818

19+
attr_accessor :total_price_cents_usd
20+
1921
attr_accessor :project_id
2022

2123
attr_accessor :metadata
@@ -24,6 +26,7 @@ class CreateOrderRequest
2426
def self.attribute_map
2527
{
2628
:'mass_g' => :'mass_g',
29+
:'total_price_cents_usd' => :'total_price_cents_usd',
2730
:'project_id' => :'project_id',
2831
:'metadata' => :'metadata'
2932
}
@@ -33,6 +36,7 @@ def self.attribute_map
3336
def self.openapi_types
3437
{
3538
:'mass_g' => :'Integer',
39+
:'total_price_cents_usd' => :'Integer',
3640
:'project_id' => :'String',
3741
:'metadata' => :'Object'
3842
}
@@ -68,6 +72,10 @@ def initialize(attributes = {})
6872
self.mass_g = attributes[:'mass_g']
6973
end
7074

75+
if attributes.key?(:'total_price_cents_usd')
76+
self.total_price_cents_usd = attributes[:'total_price_cents_usd']
77+
end
78+
7179
if attributes.key?(:'project_id')
7280
self.project_id = attributes[:'project_id']
7381
end
@@ -81,54 +89,61 @@ def initialize(attributes = {})
8189
# @return Array for valid properties with the reasons
8290
def list_invalid_properties
8391
invalid_properties = Array.new
84-
if @mass_g.nil?
85-
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
86-
end
87-
88-
if @mass_g > 2000000000
92+
if !@mass_g.nil? && @mass_g > 2000000000
8993
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
9094
end
9195

92-
if @mass_g < 1
96+
if !@mass_g.nil? && @mass_g < 1
9397
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
9498
end
9599

100+
if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
101+
invalid_properties.push('invalid value for "total_price_cents_usd", must be greater than or equal to 1.')
102+
end
103+
96104
invalid_properties
97105
end
98106

99107
# Check to see if the all the properties in the model are valid
100108
# @return true if the model is valid
101109
def valid?
102-
return false if @mass_g.nil?
103-
return false if @mass_g > 2000000000
104-
return false if @mass_g < 1
110+
return false if !@mass_g.nil? && @mass_g > 2000000000
111+
return false if !@mass_g.nil? && @mass_g < 1
112+
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
105113
true
106114
end
107115

108116
# Custom attribute writer method with validation
109117
# @param [Object] mass_g Value to be assigned
110118
def mass_g=(mass_g)
111-
if mass_g.nil?
112-
fail ArgumentError, 'mass_g cannot be nil'
113-
end
114-
115-
if mass_g > 2000000000
119+
if !mass_g.nil? && mass_g > 2000000000
116120
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
117121
end
118122

119-
if mass_g < 1
123+
if !mass_g.nil? && mass_g < 1
120124
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
121125
end
122126

123127
@mass_g = mass_g
124128
end
125129

130+
# Custom attribute writer method with validation
131+
# @param [Object] total_price_cents_usd Value to be assigned
132+
def total_price_cents_usd=(total_price_cents_usd)
133+
if !total_price_cents_usd.nil? && total_price_cents_usd < 1
134+
fail ArgumentError, 'invalid value for "total_price_cents_usd", must be greater than or equal to 1.'
135+
end
136+
137+
@total_price_cents_usd = total_price_cents_usd
138+
end
139+
126140
# Checks equality by comparing each attribute.
127141
# @param [Object] Object to be compared
128142
def ==(o)
129143
return true if self.equal?(o)
130144
self.class == o.class &&
131145
mass_g == o.mass_g &&
146+
total_price_cents_usd == o.total_price_cents_usd &&
132147
project_id == o.project_id &&
133148
metadata == o.metadata
134149
end
@@ -142,7 +157,7 @@ def eql?(o)
142157
# Calculates hash code according to all attributes.
143158
# @return [Integer] Hash code
144159
def hash
145-
[mass_g, project_id, metadata].hash
160+
[mass_g, total_price_cents_usd, project_id, metadata].hash
146161
end
147162

148163
# Builds the object from hash

0 commit comments

Comments
 (0)