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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -0
  3. data/Gemfile +2 -1
  4. data/Gemfile.lock +30 -11
  5. data/Makefile +10 -0
  6. data/README.md +61 -8
  7. data/lib/patch_ruby.rb +2 -0
  8. data/lib/patch_ruby/models/allocation.rb +25 -0
  9. data/lib/patch_ruby/models/create_mass_estimate_request.rb +48 -4
  10. data/lib/patch_ruby/models/create_order_request.rb +75 -7
  11. data/lib/patch_ruby/models/create_preference_request.rb +7 -0
  12. data/lib/patch_ruby/models/error_response.rb +9 -0
  13. data/lib/patch_ruby/models/estimate.rb +29 -1
  14. data/lib/patch_ruby/models/estimate_list_response.rb +9 -0
  15. data/lib/patch_ruby/models/estimate_response.rb +9 -0
  16. data/lib/patch_ruby/models/meta_index_object.rb +11 -0
  17. data/lib/patch_ruby/models/order.rb +105 -4
  18. data/lib/patch_ruby/models/order_list_response.rb +9 -0
  19. data/lib/patch_ruby/models/order_response.rb +9 -0
  20. data/lib/patch_ruby/models/photo.rb +233 -0
  21. data/lib/patch_ruby/models/preference.rb +25 -0
  22. data/lib/patch_ruby/models/preference_list_response.rb +9 -0
  23. data/lib/patch_ruby/models/preference_response.rb +9 -0
  24. data/lib/patch_ruby/models/project.rb +141 -25
  25. data/lib/patch_ruby/models/project_list_response.rb +9 -0
  26. data/lib/patch_ruby/models/project_response.rb +9 -0
  27. data/lib/patch_ruby/models/standard.rb +254 -0
  28. data/lib/patch_ruby/version.rb +1 -1
  29. data/spec/api/estimates_api_spec.rb +6 -7
  30. data/spec/api/orders_api_spec.rb +10 -11
  31. data/spec/api/preferences_api_spec.rb +8 -9
  32. data/spec/api/projects_api_spec.rb +4 -5
  33. data/spec/constants.rb +3 -0
  34. data/spec/factories/allocations.rb +7 -0
  35. data/spec/factories/create_mass_estimate_requests.rb +6 -0
  36. data/spec/factories/create_order_requests.rb +8 -0
  37. data/spec/factories/create_preference_requests.rb +5 -0
  38. data/spec/factories/error_responses.rb +7 -0
  39. data/spec/factories/estimate_list_responses.rb +8 -0
  40. data/spec/factories/estimate_responses.rb +7 -0
  41. data/spec/factories/estimates.rb +8 -0
  42. data/spec/factories/meta_index_objects.rb +6 -0
  43. data/spec/factories/order_list_responses.rb +8 -0
  44. data/spec/factories/order_responses.rb +7 -0
  45. data/spec/factories/orders.rb +12 -0
  46. data/spec/factories/preference_list_responses.rb +8 -0
  47. data/spec/factories/preference_responses.rb +7 -0
  48. data/spec/factories/preferences.rb +7 -0
  49. data/spec/factories/project_list_responses.rb +8 -0
  50. data/spec/factories/project_responses.rb +7 -0
  51. data/spec/factories/projects.rb +15 -0
  52. data/spec/integration/estimates_spec.rb +4 -3
  53. data/spec/integration/orders_spec.rb +60 -1
  54. data/spec/integration/preferences_spec.rb +1 -1
  55. data/spec/integration/projects_spec.rb +19 -1
  56. data/spec/models/allocation_spec.rb +8 -2
  57. data/spec/models/create_mass_estimate_request_spec.rb +7 -2
  58. data/spec/models/create_order_request_spec.rb +7 -2
  59. data/spec/models/create_preference_request_spec.rb +8 -2
  60. data/spec/models/error_response_spec.rb +7 -2
  61. data/spec/models/estimate_list_response_spec.rb +7 -2
  62. data/spec/models/estimate_response_spec.rb +7 -2
  63. data/spec/models/estimate_spec.rb +8 -2
  64. data/spec/models/meta_index_object_spec.rb +7 -2
  65. data/spec/models/order_list_response_spec.rb +7 -2
  66. data/spec/models/order_response_spec.rb +7 -2
  67. data/spec/models/order_spec.rb +18 -2
  68. data/spec/models/preference_list_response_spec.rb +7 -2
  69. data/spec/models/preference_response_spec.rb +7 -2
  70. data/spec/models/preference_spec.rb +7 -2
  71. data/spec/models/project_list_response_spec.rb +7 -2
  72. data/spec/models/project_response_spec.rb +7 -2
  73. data/spec/models/project_spec.rb +21 -2
  74. data/spec/spec_helper.rb +11 -0
  75. data/spec/support/shared/generated_classes.rb +13 -0
  76. metadata +61 -17
@@ -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
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #Patch API V1
3
+
4
+ #The core API used to integrate with Patch's service
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: developers@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Patch
16
+ class Photo
17
+ attr_accessor :url
18
+
19
+ attr_accessor :id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'url',
25
+ :'id' => :'id'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'url' => :'String',
33
+ :'id' => :'String'
34
+ }
35
+ end
36
+
37
+ # Set with nullable attributes.
38
+ def self.openapi_nullable
39
+ nullable_properties = Set.new
40
+
41
+ nullable_properties
42
+ end
43
+
44
+ # Allows models with corresponding API classes to delegate API operations to those API classes
45
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
46
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
47
+ def self.method_missing(message, *args, &block)
48
+ if Object.const_defined?('Patch::PhotosApi::OPERATIONS') && Patch::PhotosApi::OPERATIONS.include?(message)
49
+ Patch::PhotosApi.new.send(message, *args)
50
+ else
51
+ super
52
+ end
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::Photo` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::Photo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'url')
71
+ self.url = attributes[:'url']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @url.nil?
80
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
81
+ end
82
+
83
+ if @id.nil?
84
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @url.nil?
94
+ return false if @id.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ url == o.url &&
104
+ id == o.id
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [url, id].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :DateTime
153
+ DateTime.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ Patch.const_get(type).build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+ end
233
+ end
@@ -14,10 +14,13 @@ require 'date'
14
14
 
15
15
  module Patch
16
16
  class Preference
17
+ # A unique uid for the record. UIDs will be prepended by pre_prod or pre_test depending on the mode it was created in.
17
18
  attr_accessor :id
18
19
 
20
+ # Percentage of total purchased offsets that should go to a project. Default is 100%.
19
21
  attr_accessor :allocation_percentage
20
22
 
23
+ # An object returning the Project record this Preference is associated with. See the [Project section](/?id=projects) for the full schema.
21
24
  attr_accessor :project
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
@@ -81,12 +91,27 @@ module Patch
81
91
  # @return Array for valid properties with the reasons
82
92
  def list_invalid_properties
83
93
  invalid_properties = Array.new
94
+ if @id.nil?
95
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
96
+ end
97
+
98
+ if @allocation_percentage.nil?
99
+ invalid_properties.push('invalid value for "allocation_percentage", allocation_percentage cannot be nil.')
100
+ end
101
+
102
+ if @project.nil?
103
+ invalid_properties.push('invalid value for "project", project cannot be nil.')
104
+ end
105
+
84
106
  invalid_properties
85
107
  end
86
108
 
87
109
  # Check to see if the all the properties in the model are valid
88
110
  # @return true if the model is valid
89
111
  def valid?
112
+ return false if @id.nil?
113
+ return false if @allocation_percentage.nil?
114
+ return false if @project.nil?
90
115
  true
91
116
  end
92
117
 
@@ -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
@@ -14,23 +14,60 @@ require 'date'
14
14
 
15
15
  module Patch
16
16
  class Project
17
+ # A unique uid for the record. UIDs will be prepended by pro_prod or pro_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 name of the project.
21
24
  attr_accessor :name
22
25
 
26
+ # The description of the project.
23
27
  attr_accessor :description
24
28
 
29
+ # The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil.
30
+ attr_accessor :type
31
+
32
+ # The country of origin of the project.
25
33
  attr_accessor :country
26
34
 
27
- attr_accessor :longitude
35
+ # The name of the project developer.
36
+ attr_accessor :developer
28
37
 
29
- attr_accessor :latitude
38
+ # An array of URLs for photos of the project.
39
+ attr_accessor :photos
30
40
 
31
- attr_accessor :verifier
41
+ # The average price per tonne in USD cents for carbon offsets supplied by this project.
42
+ attr_accessor :average_price_per_tonne_cents_usd
32
43
 
33
- attr_accessor :developer
44
+ # The remaining mass in grams available for purchase for this project.
45
+ attr_accessor :remaining_mass_g
46
+
47
+ # An object returning the Standard associated with this project.
48
+ attr_accessor :standard
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
34
71
 
35
72
  # Attribute mapping from ruby-style variable name to JSON key.
36
73
  def self.attribute_map
@@ -39,11 +76,13 @@ module Patch
39
76
  :'production' => :'production',
40
77
  :'name' => :'name',
41
78
  :'description' => :'description',
79
+ :'type' => :'type',
42
80
  :'country' => :'country',
43
- :'longitude' => :'longitude',
44
- :'latitude' => :'latitude',
45
- :'verifier' => :'verifier',
46
- :'developer' => :'developer'
81
+ :'developer' => :'developer',
82
+ :'photos' => :'photos',
83
+ :'average_price_per_tonne_cents_usd' => :'average_price_per_tonne_cents_usd',
84
+ :'remaining_mass_g' => :'remaining_mass_g',
85
+ :'standard' => :'standard'
47
86
  }
48
87
  end
49
88
 
@@ -54,14 +93,27 @@ module Patch
54
93
  :'production' => :'Boolean',
55
94
  :'name' => :'String',
56
95
  :'description' => :'String',
96
+ :'type' => :'String',
57
97
  :'country' => :'String',
58
- :'longitude' => :'Float',
59
- :'latitude' => :'Float',
60
- :'verifier' => :'String',
61
- :'developer' => :'String'
98
+ :'developer' => :'String',
99
+ :'photos' => :'Array<Photo>',
100
+ :'average_price_per_tonne_cents_usd' => :'Integer',
101
+ :'remaining_mass_g' => :'Integer',
102
+ :'standard' => :'Standard'
62
103
  }
63
104
  end
64
105
 
106
+ # Set with nullable attributes.
107
+ def self.openapi_nullable
108
+ nullable_properties = Set.new
109
+
110
+ nullable_properties.add("photos")
111
+
112
+ nullable_properties.add("standard")
113
+
114
+ nullable_properties
115
+ end
116
+
65
117
  # Allows models with corresponding API classes to delegate API operations to those API classes
66
118
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
67
119
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -104,24 +156,34 @@ module Patch
104
156
  self.description = attributes[:'description']
105
157
  end
106
158
 
159
+ if attributes.key?(:'type')
160
+ self.type = attributes[:'type']
161
+ end
162
+
107
163
  if attributes.key?(:'country')
108
164
  self.country = attributes[:'country']
109
165
  end
110
166
 
111
- if attributes.key?(:'longitude')
112
- self.longitude = attributes[:'longitude']
167
+ if attributes.key?(:'developer')
168
+ self.developer = attributes[:'developer']
113
169
  end
114
170
 
115
- if attributes.key?(:'latitude')
116
- self.latitude = attributes[:'latitude']
171
+ if attributes.key?(:'photos')
172
+ if (value = attributes[:'photos']).is_a?(Array)
173
+ self.photos = value
174
+ end
117
175
  end
118
176
 
119
- if attributes.key?(:'verifier')
120
- self.verifier = attributes[:'verifier']
177
+ if attributes.key?(:'average_price_per_tonne_cents_usd')
178
+ self.average_price_per_tonne_cents_usd = attributes[:'average_price_per_tonne_cents_usd']
121
179
  end
122
180
 
123
- if attributes.key?(:'developer')
124
- self.developer = attributes[:'developer']
181
+ if attributes.key?(:'remaining_mass_g')
182
+ self.remaining_mass_g = attributes[:'remaining_mass_g']
183
+ end
184
+
185
+ if attributes.key?(:'standard')
186
+ self.standard = attributes[:'standard']
125
187
  end
126
188
  end
127
189
 
@@ -129,15 +191,67 @@ module Patch
129
191
  # @return Array for valid properties with the reasons
130
192
  def list_invalid_properties
131
193
  invalid_properties = Array.new
194
+ if @id.nil?
195
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
196
+ end
197
+
198
+ if @production.nil?
199
+ invalid_properties.push('invalid value for "production", production cannot be nil.')
200
+ end
201
+
202
+ if @name.nil?
203
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
204
+ end
205
+
206
+ if @description.nil?
207
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
208
+ end
209
+
210
+ if @country.nil?
211
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
212
+ end
213
+
214
+ if @developer.nil?
215
+ invalid_properties.push('invalid value for "developer", developer cannot be nil.')
216
+ end
217
+
218
+ if @average_price_per_tonne_cents_usd.nil?
219
+ invalid_properties.push('invalid value for "average_price_per_tonne_cents_usd", average_price_per_tonne_cents_usd cannot be nil.')
220
+ end
221
+
222
+ if @remaining_mass_g.nil?
223
+ invalid_properties.push('invalid value for "remaining_mass_g", remaining_mass_g cannot be nil.')
224
+ end
225
+
132
226
  invalid_properties
133
227
  end
134
228
 
135
229
  # Check to see if the all the properties in the model are valid
136
230
  # @return true if the model is valid
137
231
  def valid?
232
+ return false if @id.nil?
233
+ return false if @production.nil?
234
+ return false if @name.nil?
235
+ return false if @description.nil?
236
+ type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
237
+ return false unless type_validator.valid?(@type)
238
+ return false if @country.nil?
239
+ return false if @developer.nil?
240
+ return false if @average_price_per_tonne_cents_usd.nil?
241
+ return false if @remaining_mass_g.nil?
138
242
  true
139
243
  end
140
244
 
245
+ # Custom attribute writer method checking allowed values (enum).
246
+ # @param [Object] type Object to be assigned
247
+ def type=(type)
248
+ validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
249
+ unless validator.valid?(type)
250
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
251
+ end
252
+ @type = type
253
+ end
254
+
141
255
  # Checks equality by comparing each attribute.
142
256
  # @param [Object] Object to be compared
143
257
  def ==(o)
@@ -147,11 +261,13 @@ module Patch
147
261
  production == o.production &&
148
262
  name == o.name &&
149
263
  description == o.description &&
264
+ type == o.type &&
150
265
  country == o.country &&
151
- longitude == o.longitude &&
152
- latitude == o.latitude &&
153
- verifier == o.verifier &&
154
- developer == o.developer
266
+ developer == o.developer &&
267
+ photos == o.photos &&
268
+ average_price_per_tonne_cents_usd == o.average_price_per_tonne_cents_usd &&
269
+ remaining_mass_g == o.remaining_mass_g &&
270
+ standard == o.standard
155
271
  end
156
272
 
157
273
  # @see the `==` method
@@ -163,7 +279,7 @@ module Patch
163
279
  # Calculates hash code according to all attributes.
164
280
  # @return [Integer] Hash code
165
281
  def hash
166
- [id, production, name, description, country, longitude, latitude, verifier, developer].hash
282
+ [id, production, name, description, type, country, developer, photos, average_price_per_tonne_cents_usd, remaining_mass_g, standard].hash
167
283
  end
168
284
 
169
285
  # Builds the object from hash