lib/patch_ruby/models/project.rb in patch_ruby-1.14.0 vs lib/patch_ruby/models/project.rb in patch_ruby-1.15.0

- old
+ new

@@ -25,14 +25,14 @@ attr_accessor :name # The description of the project. attr_accessor :description - # The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil. + # Deprecated. Favor the technology_type field instead. attr_accessor :type - # The mechanism of the project. removal or avoidance. + # The mechanism of the project. Either removal or avoidance. attr_accessor :mechanism # The country of origin of the project. attr_accessor :country @@ -61,15 +61,15 @@ attr_accessor :standard # An array returning the UN Sustainable Development Goals associated with this project. attr_accessor :sdgs - attr_accessor :technology_type - - # A short description of the project + # A short description of the project. attr_accessor :tagline + attr_accessor :technology_type + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @@ -107,12 +107,12 @@ :'photos' => :'photos', :'average_price_per_tonne_cents_usd' => :'average_price_per_tonne_cents_usd', :'remaining_mass_g' => :'remaining_mass_g', :'standard' => :'standard', :'sdgs' => :'sdgs', - :'technology_type' => :'technology_type', - :'tagline' => :'tagline' + :'tagline' => :'tagline', + :'technology_type' => :'technology_type' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes @@ -136,12 +136,12 @@ :'photos' => :'Array<Photo>', :'average_price_per_tonne_cents_usd' => :'Integer', :'remaining_mass_g' => :'Integer', :'standard' => :'Standard', :'sdgs' => :'Array<Sdg>', - :'technology_type' => :'TechnologyType', - :'tagline' => :'String' + :'tagline' => :'String', + :'technology_type' => :'TechnologyType' } end # List of attributes with nullable: true def self.openapi_nullable @@ -150,11 +150,10 @@ :'latitude', :'longitude', :'photos', :'standard', :'sdgs', - :'tagline' ]) end # Allows models with corresponding API classes to delegate API operations to those API classes @@ -249,17 +248,17 @@ if (value = attributes[:'sdgs']).is_a?(Array) self.sdgs = value end end - if attributes.key?(:'technology_type') - self.technology_type = attributes[:'technology_type'] - end - if attributes.key?(:'tagline') self.tagline = attributes[:'tagline'] end + + if attributes.key?(:'technology_type') + self.technology_type = attributes[:'technology_type'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties @@ -294,42 +293,35 @@ if @remaining_mass_g.nil? invalid_properties.push('invalid value for "remaining_mass_g", remaining_mass_g cannot be nil.') end + if @technology_type.nil? + invalid_properties.push('invalid value for "technology_type", technology_type cannot be nil.') + end + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return false if @id.nil? return false if @production.nil? return false if @name.nil? return false if @description.nil? - type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"]) - return false unless type_validator.valid?(@type) mechanism_validator = EnumAttributeValidator.new('String', ["removal", "avoidance"]) return false unless mechanism_validator.valid?(@mechanism) return false if @country.nil? return false if @developer.nil? return false if @average_price_per_tonne_cents_usd.nil? return false if @remaining_mass_g.nil? + return false if @technology_type.nil? true end # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). # @param [Object] mechanism Object to be assigned def mechanism=(mechanism) validator = EnumAttributeValidator.new('String', ["removal", "avoidance"]) unless validator.valid?(mechanism) fail ArgumentError, "invalid value for \"mechanism\", must be one of #{validator.allowable_values}." @@ -356,12 +348,12 @@ photos == o.photos && average_price_per_tonne_cents_usd == o.average_price_per_tonne_cents_usd && remaining_mass_g == o.remaining_mass_g && standard == o.standard && sdgs == o.sdgs && - technology_type == o.technology_type && - tagline == o.tagline + tagline == o.tagline && + technology_type == o.technology_type end # @see the `==` method # @param [Object] Object to be compared def eql?(o) @@ -369,10 +361,10 @@ end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, production, name, description, type, mechanism, country, state, latitude, longitude, developer, photos, average_price_per_tonne_cents_usd, remaining_mass_g, standard, sdgs, technology_type, tagline].hash + [id, production, name, description, type, mechanism, country, state, latitude, longitude, developer, photos, average_price_per_tonne_cents_usd, remaining_mass_g, standard, sdgs, tagline, technology_type].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself