class Bfwd::ComponentChange
Attributes
{ "description" : "", "verbs":[] }
{ "description" : "<span class=\"label label-default\">immediate</span> applies the changes to the subscription straight away. <span class=\"label label-default\">delayed</span> applies the changes to the subscription at the start of the next billing period", "verbs":["POST","GET"] }
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
id
{ "description" : "Value of the pricing component that the subscription is moving to", "verbs":["POST","GET"] }
{ "description" : "", "verbs":[] }
{ "description" : "ID of the pricing component, that will not change with versioning. (Must be provided if pricingComponentName is empty)", "verbs":["POST","GET"] }
{ "description" : "Name of the pricing component. (Must be provided if pricingComponentID is empty)", "verbs":["POST","GET"] }
{ "description" : "", "verbs":["GET"] }
{ "description" : "ID of the updateComponentValueAmendment object that is responsible for actioning the change.", "verbs":["GET"] }
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }
{ "description" : "Date when the value becomes active. For example when an upgrade will come into effect.", "verbs":["GET"] }
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/bf_ruby2/models/component_change.rb, line 80 def self.attribute_map { :'id' => :'id', :'organization_id' => :'organizationID', :'amendment_id' => :'amendmentID', :'update_pricing_component_value_id' => :'updatePricingComponentValueID', :'pricing_component_id' => :'pricingComponentID', :'pricing_component_name' => :'pricingComponentName', :'state' => :'state', :'change_mode' => :'changeMode', :'new_value' => :'newValue', :'created' => :'created', :'changed_by' => :'changedBy', :'updated' => :'updated', :'value_effective' => :'valueEffective' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/bf_ruby2/models/component_change.rb, line 119 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'amendmentID') self.amendment_id = attributes[:'amendmentID'] end if attributes.has_key?(:'updatePricingComponentValueID') self.update_pricing_component_value_id = attributes[:'updatePricingComponentValueID'] end if attributes.has_key?(:'pricingComponentID') self.pricing_component_id = attributes[:'pricingComponentID'] end if attributes.has_key?(:'pricingComponentName') self.pricing_component_name = attributes[:'pricingComponentName'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'changeMode') self.change_mode = attributes[:'changeMode'] end if attributes.has_key?(:'newValue') self.new_value = attributes[:'newValue'] end if attributes.has_key?(:'created') self.created = attributes[:'created'] end if attributes.has_key?(:'changedBy') self.changed_by = attributes[:'changedBy'] end if attributes.has_key?(:'updated') self.updated = attributes[:'updated'] end if attributes.has_key?(:'valueEffective') self.value_effective = attributes[:'valueEffective'] end end
Attribute type mapping.
# File lib/bf_ruby2/models/component_change.rb, line 99 def self.swagger_types { :'id' => :'String', :'organization_id' => :'String', :'amendment_id' => :'String', :'update_pricing_component_value_id' => :'String', :'pricing_component_id' => :'String', :'pricing_component_name' => :'String', :'state' => :'String', :'change_mode' => :'String', :'new_value' => :'Integer', :'created' => :'DateTime', :'changed_by' => :'String', :'updated' => :'DateTime', :'value_effective' => :'DateTime' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/bf_ruby2/models/component_change.rb, line 258 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && organization_id == o.organization_id && amendment_id == o.amendment_id && update_pricing_component_value_id == o.update_pricing_component_value_id && pricing_component_id == o.pricing_component_id && pricing_component_name == o.pricing_component_name && state == o.state && change_mode == o.change_mode && new_value == o.new_value && created == o.created && changed_by == o.changed_by && updated == o.updated && value_effective == o.value_effective end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/bf_ruby2/models/component_change.rb, line 312 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Bfwd.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/bf_ruby2/models/component_change.rb, line 378 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/bf_ruby2/models/component_change.rb, line 291 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
Custom attribute writer method checking allowed values (enum). @param [Object] change_mode
Object to be assigned
# File lib/bf_ruby2/models/component_change.rb, line 248 def change_mode=(change_mode) validator = EnumAttributeValidator.new('String', ["immediate", "delayed"]) unless validator.valid?(change_mode) fail ArgumentError, "invalid value for 'change_mode', must be one of #{validator.allowable_values}." end @change_mode = change_mode end
@see the `==` method @param [Object] Object to be compared
# File lib/bf_ruby2/models/component_change.rb, line 278 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/bf_ruby2/models/component_change.rb, line 284 def hash [id, organization_id, amendment_id, update_pricing_component_value_id, pricing_component_id, pricing_component_name, state, change_mode, new_value, created, changed_by, updated, value_effective].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/bf_ruby2/models/component_change.rb, line 181 def list_invalid_properties invalid_properties = Array.new if @id.nil? invalid_properties.push("invalid value for 'id', id cannot be nil.") end if @organization_id.nil? invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.") end if @amendment_id.nil? invalid_properties.push("invalid value for 'amendment_id', amendment_id cannot be nil.") end if @pricing_component_id.nil? invalid_properties.push("invalid value for 'pricing_component_id', pricing_component_id cannot be nil.") end if @pricing_component_name.nil? invalid_properties.push("invalid value for 'pricing_component_name', pricing_component_name cannot be nil.") end if @state.nil? invalid_properties.push("invalid value for 'state', state cannot be nil.") end if @change_mode.nil? invalid_properties.push("invalid value for 'change_mode', change_mode cannot be nil.") end if @new_value.nil? invalid_properties.push("invalid value for 'new_value', new_value cannot be nil.") end return invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] state Object to be assigned
# File lib/bf_ruby2/models/component_change.rb, line 238 def state=(state) validator = EnumAttributeValidator.new('String', ["Failed", "Pending", "Succeeded"]) unless validator.valid?(state) fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}." end @state = state end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/bf_ruby2/models/component_change.rb, line 364 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/bf_ruby2/models/component_change.rb, line 352 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/bf_ruby2/models/component_change.rb, line 220 def valid? return false if @id.nil? return false if @organization_id.nil? return false if @amendment_id.nil? return false if @pricing_component_id.nil? return false if @pricing_component_name.nil? return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ["Failed", "Pending", "Succeeded"]) return false unless state_validator.valid?(@state) return false if @change_mode.nil? change_mode_validator = EnumAttributeValidator.new('String', ["immediate", "delayed"]) return false unless change_mode_validator.valid?(@change_mode) return false if @new_value.nil? return true end