class SamplifyAPIClient::LineItemResponseData

Attributes

country_iso_code[RW]

ISO country code

created_at[RW]

created time.

days_in_field[RW]

Duration of the project in days.

delivery_type[RW]

Delivery type: SLOW, BALANCED, FAST or BURST.

ext_line_item_id[RW]

Unique line item Id

indicative_incidence[RW]

Expected incidence of the survey

language_iso_code[RW]

ISO language code

launched_at[RW]

launched time.

length_of_interview[RW]

expected duration of the survey in minutes

quota_plan[RW]
required_completes[RW]

Number of complete required for the line item

state[RW]

state

state_last_updated_at[RW]

state last updated at.

state_reason[RW]

state reason

survey_test_url[RW]

Entry link for the user.

survey_url[RW]

Entry link for the user.

targets[RW]

Data of completes/starts required for the line item

title[RW]

A title for the line item

updated_at[RW]

updated time.

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/samplify_api_client/models/line_item_response_data.rb, line 98
def self.attribute_map
  {
    :'country_iso_code' => :'countryISOCode',
    :'created_at' => :'createdAt',
    :'days_in_field' => :'daysInField',
    :'delivery_type' => :'deliveryType',
    :'end_links' => :'endLinks',
    :'ext_line_item_id' => :'extLineItemId',
    :'indicative_incidence' => :'indicativeIncidence',
    :'language_iso_code' => :'languageISOCode',
    :'launched_at' => :'launchedAt',
    :'length_of_interview' => :'lengthOfInterview',
    :'quota_plan' => :'quotaPlan',
    :'required_completes' => :'requiredCompletes',
    :'state' => :'state',
    :'state_last_updated_at' => :'stateLastUpdatedAt',
    :'state_reason' => :'stateReason',
    :'survey_test_url' => :'surveyTestURL',
    :'survey_url' => :'surveyURL',
    :'targets' => :'targets',
    :'title' => :'title',
    :'updated_at' => :'updatedAt'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/samplify_api_client/models/line_item_response_data.rb, line 151
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?(:'daysInField')
    self.days_in_field = attributes[:'daysInField']
  end

  if attributes.has_key?(:'deliveryType')
    self.delivery_type = attributes[:'deliveryType']
  end

  if attributes.has_key?(:'endLinks')
    self.end_links = attributes[:'endLinks']
  end

  if attributes.has_key?(:'extLineItemId')
    self.ext_line_item_id = attributes[:'extLineItemId']
  end

  if attributes.has_key?(:'indicativeIncidence')
    self.indicative_incidence = attributes[:'indicativeIncidence']
  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?(:'lengthOfInterview')
    self.length_of_interview = attributes[:'lengthOfInterview']
  end

  if attributes.has_key?(:'quotaPlan')
    self.quota_plan = attributes[:'quotaPlan']
  end

  if attributes.has_key?(:'requiredCompletes')
    self.required_completes = attributes[:'requiredCompletes']
  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?(:'surveyTestURL')
    self.survey_test_url = attributes[:'surveyTestURL']
  end

  if attributes.has_key?(:'surveyURL')
    self.survey_url = attributes[:'surveyURL']
  end

  if attributes.has_key?(:'targets')
    if (value = attributes[:'targets']).is_a?(Array)
      self.targets = value
    end
  end

  if attributes.has_key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.has_key?(:'updatedAt')
    self.updated_at = attributes[:'updatedAt']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/samplify_api_client/models/line_item_response_data.rb, line 124
def self.swagger_types
  {
    :'country_iso_code' => :'String',
    :'created_at' => :'String',
    :'days_in_field' => :'Integer',
    :'delivery_type' => :'String',
    :'end_links' => :'EndLinks',
    :'ext_line_item_id' => :'String',
    :'indicative_incidence' => :'Float',
    :'language_iso_code' => :'String',
    :'launched_at' => :'String',
    :'length_of_interview' => :'Integer',
    :'quota_plan' => :'QuotaPlanData',
    :'required_completes' => :'Integer',
    :'state' => :'String',
    :'state_last_updated_at' => :'String',
    :'state_reason' => :'String',
    :'survey_test_url' => :'String',
    :'survey_url' => :'String',
    :'targets' => :'Array<Target>',
    :'title' => :'String',
    :'updated_at' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/samplify_api_client/models/line_item_response_data.rb, line 267
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      country_iso_code == o.country_iso_code &&
      created_at == o.created_at &&
      days_in_field == o.days_in_field &&
      delivery_type == o.delivery_type &&
      end_links == o.end_links &&
      ext_line_item_id == o.ext_line_item_id &&
      indicative_incidence == o.indicative_incidence &&
      language_iso_code == o.language_iso_code &&
      launched_at == o.launched_at &&
      length_of_interview == o.length_of_interview &&
      quota_plan == o.quota_plan &&
      required_completes == o.required_completes &&
      state == o.state &&
      state_last_updated_at == o.state_last_updated_at &&
      state_reason == o.state_reason &&
      survey_test_url == o.survey_test_url &&
      survey_url == o.survey_url &&
      targets == o.targets &&
      title == o.title &&
      updated_at == o.updated_at
end
_deserialize(type, value) click to toggle source

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_response_data.rb, line 328
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
_to_hash(value) click to toggle source

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_response_data.rb, line 394
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
build_from_hash(attributes) click to toggle source

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_response_data.rb, line 307
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
delivery_type=(delivery_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] delivery_type Object to be assigned

# File lib/samplify_api_client/models/line_item_response_data.rb, line 257
def delivery_type=(delivery_type)
  validator = EnumAttributeValidator.new('String', ['SLOW', 'BALANCED', 'FAST', 'BURST'])
  unless validator.valid?(delivery_type)
    fail ArgumentError, 'invalid value for "delivery_type", must be one of #{validator.allowable_values}.'
  end
  @delivery_type = delivery_type
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/samplify_api_client/models/line_item_response_data.rb, line 294
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/samplify_api_client/models/line_item_response_data.rb, line 300
def hash
  [country_iso_code, created_at, days_in_field, delivery_type, end_links, ext_line_item_id, indicative_incidence, language_iso_code, launched_at, length_of_interview, quota_plan, required_completes, state, state_last_updated_at, state_reason, survey_test_url, survey_url, targets, title, updated_at].hash
end
list_invalid_properties() click to toggle source

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_response_data.rb, line 242
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/samplify_api_client/models/line_item_response_data.rb, line 374
def to_body
  to_hash
end
to_hash() click to toggle source

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_response_data.rb, line 380
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
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/samplify_api_client/models/line_item_response_data.rb, line 368
def to_s
  to_hash.to_s
end
valid?() click to toggle source

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_response_data.rb, line 249
def valid?
  delivery_type_validator = EnumAttributeValidator.new('String', ['SLOW', 'BALANCED', 'FAST', 'BURST'])
  return false unless delivery_type_validator.valid?(@delivery_type)
  true
end