class SamplifyAPIClient::LineItemItemData
Attributes
2 letter ISO Country Code
Timestamp of when the line item was created
A unique identifier for your Line Item
2 letter ISO Language Code
Timestamp of when the line item launched on RN SSI panelists
The current state of the line item: PROVISIONED, AWAITING_APPROVAL, LAUNCHED, PAUSED, CLOSED, INVOICED
Timestamp of when the line item last changed its state
Reason for the current state of the line item
A Line Item title
Timestamp of when the line item was updated
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/samplify_api_client/models/line_item_item_data.rb, line 70 def self.attribute_map { :'country_iso_code' => :'countryISOCode', :'created_at' => :'createdAt', :'ext_line_item_id' => :'extLineItemId', :'language_iso_code' => :'languageISOCode', :'launched_at' => :'launchedAt', :'state' => :'state', :'state_last_updated_at' => :'stateLastUpdatedAt', :'state_reason' => :'stateReason', :'title' => :'title', :'updated_at' => :'updatedAt' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/samplify_api_client/models/line_item_item_data.rb, line 103 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?(:'countryISOCode') self.country_iso_code = attributes[:'countryISOCode'] end if attributes.has_key?(:'createdAt') self.created_at = attributes[:'createdAt'] end if attributes.has_key?(:'extLineItemId') self.ext_line_item_id = attributes[:'extLineItemId'] end if attributes.has_key?(:'languageISOCode') self.language_iso_code = attributes[:'languageISOCode'] end if attributes.has_key?(:'launchedAt') self.launched_at = attributes[:'launchedAt'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'stateLastUpdatedAt') self.state_last_updated_at = attributes[:'stateLastUpdatedAt'] end if attributes.has_key?(:'stateReason') self.state_reason = attributes[:'stateReason'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'updatedAt') self.updated_at = attributes[:'updatedAt'] end end
Attribute type mapping.
# File lib/samplify_api_client/models/line_item_item_data.rb, line 86 def self.swagger_types { :'country_iso_code' => :'String', :'created_at' => :'String', :'ext_line_item_id' => :'String', :'language_iso_code' => :'String', :'launched_at' => :'', :'state' => :'String', :'state_last_updated_at' => :'String', :'state_reason' => :'String', :'title' => :'String', :'updated_at' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/samplify_api_client/models/line_item_item_data.rb, line 227 def ==(o) return true if self.equal?(o) self.class == o.class && country_iso_code == o.country_iso_code && created_at == o.created_at && ext_line_item_id == o.ext_line_item_id && language_iso_code == o.language_iso_code && launched_at == o.launched_at && state == o.state && state_last_updated_at == o.state_last_updated_at && state_reason == o.state_reason && title == o.title && updated_at == o.updated_at 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/samplify_api_client/models/line_item_item_data.rb, line 278 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 = SamplifyAPIClient.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/samplify_api_client/models/line_item_item_data.rb, line 344 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/samplify_api_client/models/line_item_item_data.rb, line 257 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
@see the `==` method @param [Object] Object to be compared
# File lib/samplify_api_client/models/line_item_item_data.rb, line 244 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/samplify_api_client/models/line_item_item_data.rb, line 250 def hash [country_iso_code, created_at, ext_line_item_id, language_iso_code, launched_at, state, state_last_updated_at, state_reason, title, updated_at].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/samplify_api_client/models/line_item_item_data.rb, line 152 def list_invalid_properties invalid_properties = Array.new if @country_iso_code.nil? invalid_properties.push('invalid value for "country_iso_code", country_iso_code cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @ext_line_item_id.nil? invalid_properties.push('invalid value for "ext_line_item_id", ext_line_item_id cannot be nil.') end if @language_iso_code.nil? invalid_properties.push('invalid value for "language_iso_code", language_iso_code cannot be nil.') end if @launched_at.nil? invalid_properties.push('invalid value for "launched_at", launched_at cannot be nil.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @state_last_updated_at.nil? invalid_properties.push('invalid value for "state_last_updated_at", state_last_updated_at cannot be nil.') end if @state_reason.nil? invalid_properties.push('invalid value for "state_reason", state_reason cannot be nil.') end if @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] state Object to be assigned
# File lib/samplify_api_client/models/line_item_item_data.rb, line 217 def state=(state) validator = EnumAttributeValidator.new('String', ['PROVISIONED', 'AWAITING_APPROVAL', 'LAUNCHED', 'PAUSED', 'CLOSED', 'INVOICED']) 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/samplify_api_client/models/line_item_item_data.rb, line 330 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/samplify_api_client/models/line_item_item_data.rb, line 318 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/samplify_api_client/models/line_item_item_data.rb, line 199 def valid? return false if @country_iso_code.nil? return false if @created_at.nil? return false if @ext_line_item_id.nil? return false if @language_iso_code.nil? return false if @launched_at.nil? return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ['PROVISIONED', 'AWAITING_APPROVAL', 'LAUNCHED', 'PAUSED', 'CLOSED', 'INVOICED']) return false unless state_validator.valid?(@state) return false if @state_last_updated_at.nil? return false if @state_reason.nil? return false if @title.nil? return false if @updated_at.nil? true end