patch_ruby 1.2.3 → 1.5.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 +43 -3
- data/Gemfile +1 -0
- data/Gemfile.lock +19 -3
- data/README.md +86 -9
- data/lib/patch_ruby/api/estimates_api.rb +195 -0
- data/lib/patch_ruby/api/projects_api.rb +9 -0
- data/lib/patch_ruby/configuration.rb +2 -2
- data/lib/patch_ruby/models/allocation.rb +10 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +19 -1
- data/lib/patch_ruby/models/create_order_request.rb +38 -16
- 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 +20 -0
- 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 +25 -4
- 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 +40 -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/sdg.rb +269 -0
- data/lib/patch_ruby/models/standard.rb +10 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/patch_ruby.gemspec +1 -1
- data/spec/configuration_spec.rb +3 -3
- 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 +52 -8
- data/spec/integration/orders_spec.rb +26 -0
- data/spec/integration/preferences_spec.rb +6 -2
- data/spec/integration/projects_spec.rb +20 -0
- 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 +10 -0
- data/spec/support/shared/generated_classes.rb +13 -0
- metadata +56 -17
@@ -90,6 +90,9 @@ module Patch
|
|
90
90
|
# Retrieves a list of projects available for purchase on Patch's platform.
|
91
91
|
# @param [Hash] opts the optional parameters
|
92
92
|
# @option opts [Integer] :page
|
93
|
+
# @option opts [String] :country
|
94
|
+
# @option opts [String] :type
|
95
|
+
# @option opts [Integer] :minimum_available_mass
|
93
96
|
# @return [ProjectListResponse]
|
94
97
|
def retrieve_projects(opts = {})
|
95
98
|
data, _status_code, _headers = retrieve_projects_with_http_info(opts)
|
@@ -100,6 +103,9 @@ module Patch
|
|
100
103
|
# Retrieves a list of projects available for purchase on Patch's platform.
|
101
104
|
# @param [Hash] opts the optional parameters
|
102
105
|
# @option opts [Integer] :page
|
106
|
+
# @option opts [String] :country
|
107
|
+
# @option opts [String] :type
|
108
|
+
# @option opts [Integer] :minimum_available_mass
|
103
109
|
# @return [Array<(ProjectListResponse, Integer, Hash)>] ProjectListResponse data, response status code and response headers
|
104
110
|
def retrieve_projects_with_http_info(opts = {})
|
105
111
|
if @api_client.config.debugging
|
@@ -111,6 +117,9 @@ module Patch
|
|
111
117
|
# query parameters
|
112
118
|
query_params = opts[:query_params] || {}
|
113
119
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
120
|
+
query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
|
121
|
+
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
122
|
+
query_params[:'minimum_available_mass'] = opts[:'minimum_available_mass'] if !opts[:'minimum_available_mass'].nil?
|
114
123
|
|
115
124
|
# header parameters
|
116
125
|
header_params = opts[:header_params] || {}
|
@@ -127,7 +127,7 @@ module Patch
|
|
127
127
|
|
128
128
|
def initialize
|
129
129
|
@scheme = 'https'
|
130
|
-
@host = 'api.
|
130
|
+
@host = 'api.patch.io'
|
131
131
|
@base_path = ''
|
132
132
|
@api_key = {}
|
133
133
|
@api_key_prefix = {}
|
@@ -212,7 +212,7 @@ module Patch
|
|
212
212
|
variables: {
|
213
213
|
defaultHost: {
|
214
214
|
description: "No description provided",
|
215
|
-
default_value: "api.
|
215
|
+
default_value: "api.patch.io",
|
216
216
|
}
|
217
217
|
}
|
218
218
|
}
|
@@ -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
|
@@ -121,6 +138,7 @@ module Patch
|
|
121
138
|
return true if self.equal?(o)
|
122
139
|
self.class == o.class &&
|
123
140
|
mass_g == o.mass_g &&
|
141
|
+
create_order == o.create_order &&
|
124
142
|
project_id == o.project_id
|
125
143
|
end
|
126
144
|
|
@@ -133,7 +151,7 @@ module Patch
|
|
133
151
|
# Calculates hash code according to all attributes.
|
134
152
|
# @return [Integer] Hash code
|
135
153
|
def hash
|
136
|
-
[mass_g, project_id].hash
|
154
|
+
[mass_g, create_order, project_id].hash
|
137
155
|
end
|
138
156
|
|
139
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,54 +96,61 @@ 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", mass_g cannot be nil.')
|
86
|
-
end
|
87
|
-
|
88
|
-
if @mass_g > 2000000000
|
99
|
+
if !@mass_g.nil? && @mass_g > 2000000000
|
89
100
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
90
101
|
end
|
91
102
|
|
92
|
-
if @mass_g < 1
|
103
|
+
if !@mass_g.nil? && @mass_g < 1
|
93
104
|
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
|
94
105
|
end
|
95
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.')
|
109
|
+
end
|
110
|
+
|
96
111
|
invalid_properties
|
97
112
|
end
|
98
113
|
|
99
114
|
# Check to see if the all the properties in the model are valid
|
100
115
|
# @return true if the model is valid
|
101
116
|
def valid?
|
102
|
-
return false if
|
103
|
-
return false if @mass_g
|
104
|
-
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
|
105
120
|
true
|
106
121
|
end
|
107
122
|
|
108
123
|
# Custom attribute writer method with validation
|
109
124
|
# @param [Object] mass_g Value to be assigned
|
110
125
|
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
|
126
|
+
if !mass_g.nil? && mass_g > 2000000000
|
116
127
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
117
128
|
end
|
118
129
|
|
119
|
-
if mass_g < 1
|
130
|
+
if !mass_g.nil? && mass_g < 1
|
120
131
|
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
|
121
132
|
end
|
122
133
|
|
123
134
|
@mass_g = mass_g
|
124
135
|
end
|
125
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
|
+
|
126
147
|
# Checks equality by comparing each attribute.
|
127
148
|
# @param [Object] Object to be compared
|
128
149
|
def ==(o)
|
129
150
|
return true if self.equal?(o)
|
130
151
|
self.class == o.class &&
|
131
152
|
mass_g == o.mass_g &&
|
153
|
+
total_price_cents_usd == o.total_price_cents_usd &&
|
132
154
|
project_id == o.project_id &&
|
133
155
|
metadata == o.metadata
|
134
156
|
end
|
@@ -142,7 +164,7 @@ module Patch
|
|
142
164
|
# Calculates hash code according to all attributes.
|
143
165
|
# @return [Integer] Hash code
|
144
166
|
def hash
|
145
|
-
[mass_g, project_id, metadata].hash
|
167
|
+
[mass_g, total_price_cents_usd, project_id, metadata].hash
|
146
168
|
end
|
147
169
|
|
148
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,22 +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.
|
29
36
|
attr_accessor :patch_fee_cents_usd
|
30
37
|
|
38
|
+
# An array containing the inventory allocations for this order.
|
31
39
|
attr_accessor :allocations
|
32
40
|
|
41
|
+
# An optional JSON object containing metadata for this order.
|
33
42
|
attr_accessor :metadata
|
34
43
|
|
35
44
|
class EnumAttributeValidator
|
@@ -84,6 +93,17 @@ module Patch
|
|
84
93
|
}
|
85
94
|
end
|
86
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
|
+
|
87
107
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
88
108
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
89
109
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|