lib/patch_ruby/models/project.rb in patch_ruby-2.0.0 vs lib/patch_ruby/models/project.rb in patch_ruby-2.1.1
- old
+ new
@@ -34,10 +34,13 @@
attr_accessor :country
# The state where this project is located.
attr_accessor :state
+ # The issuance type of the project. One of: ex-ante, ex-post.
+ attr_accessor :issuance_type
+
# The latitude at which this project is located.
attr_accessor :latitude
# The longitude at which this project is located.
attr_accessor :longitude
@@ -66,31 +69,58 @@
attr_accessor :highlights
# An array of objects containing available inventory for a project. Available inventory is grouped by a project's vintage year and returns amount and pricing available for a given vintage year.
attr_accessor :inventory
+ # An array of objects containing disclaimers about the project. Information, warnings, and critical concerns may be present.
+ attr_accessor :disclaimers
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'id' => :'id',
:'production' => :'production',
:'name' => :'name',
:'description' => :'description',
:'mechanism' => :'mechanism',
:'country' => :'country',
:'state' => :'state',
+ :'issuance_type' => :'issuance_type',
:'latitude' => :'latitude',
:'longitude' => :'longitude',
:'project_partner' => :'project_partner',
:'photos' => :'photos',
:'verifier' => :'verifier',
:'standard' => :'standard',
:'sdgs' => :'sdgs',
:'tagline' => :'tagline',
:'technology_type' => :'technology_type',
:'highlights' => :'highlights',
- :'inventory' => :'inventory'
+ :'inventory' => :'inventory',
+ :'disclaimers' => :'disclaimers'
}
end
# Returns all the JSON keys this model knows about
def self.acceptable_attributes
@@ -105,21 +135,23 @@
:'name' => :'String',
:'description' => :'String',
:'mechanism' => :'String',
:'country' => :'String',
:'state' => :'String',
+ :'issuance_type' => :'String',
:'latitude' => :'Float',
:'longitude' => :'Float',
:'project_partner' => :'String',
:'photos' => :'Array<Photo>',
:'verifier' => :'String',
:'standard' => :'Standard',
:'sdgs' => :'Array<Sdg>',
:'tagline' => :'String',
:'technology_type' => :'TechnologyType',
:'highlights' => :'Array<Highlight>',
- :'inventory' => :'Array<Inventory>'
+ :'inventory' => :'Array<Inventory>',
+ :'disclaimers' => :'Array<Disclaimer>'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
@@ -186,10 +218,14 @@
if attributes.key?(:'state')
self.state = attributes[:'state']
end
+ if attributes.key?(:'issuance_type')
+ self.issuance_type = attributes[:'issuance_type']
+ end
+
if attributes.key?(:'latitude')
self.latitude = attributes[:'latitude']
end
if attributes.key?(:'longitude')
@@ -240,10 +276,16 @@
if attributes.key?(:'inventory')
if (value = attributes[:'inventory']).is_a?(Array)
self.inventory = value
end
end
+
+ if attributes.key?(:'disclaimers')
+ if (value = attributes[:'disclaimers']).is_a?(Array)
+ self.disclaimers = value
+ end
+ 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
@@ -293,17 +335,29 @@
return false if @id.nil?
return false if @production.nil?
return false if @name.nil?
return false if @description.nil?
return false if @country.nil?
+ issuance_type_validator = EnumAttributeValidator.new('String', ["ex-ante", "ex-post"])
+ return false unless issuance_type_validator.valid?(@issuance_type)
return false if @project_partner.nil?
return false if @technology_type.nil?
return false if @highlights.nil?
return false if @inventory.nil?
true
end
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] issuance_type Object to be assigned
+ def issuance_type=(issuance_type)
+ validator = EnumAttributeValidator.new('String', ["ex-ante", "ex-post"])
+ unless validator.valid?(issuance_type)
+ fail ArgumentError, "invalid value for \"issuance_type\", must be one of #{validator.allowable_values}."
+ end
+ @issuance_type = issuance_type
+ end
+
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
@@ -312,21 +366,23 @@
name == o.name &&
description == o.description &&
mechanism == o.mechanism &&
country == o.country &&
state == o.state &&
+ issuance_type == o.issuance_type &&
latitude == o.latitude &&
longitude == o.longitude &&
project_partner == o.project_partner &&
photos == o.photos &&
verifier == o.verifier &&
standard == o.standard &&
sdgs == o.sdgs &&
tagline == o.tagline &&
technology_type == o.technology_type &&
highlights == o.highlights &&
- inventory == o.inventory
+ inventory == o.inventory &&
+ disclaimers == o.disclaimers
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
@@ -334,10 +390,10 @@
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [id, production, name, description, mechanism, country, state, latitude, longitude, project_partner, photos, verifier, standard, sdgs, tagline, technology_type, highlights, inventory].hash
+ [id, production, name, description, mechanism, country, state, issuance_type, latitude, longitude, project_partner, photos, verifier, standard, sdgs, tagline, technology_type, highlights, inventory, disclaimers].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself