Class: SamplifyAPIClient::LineItemResponseData

Inherits:
Object
  • Object
show all
Defined in:
lib/samplify_api_client/models/line_item_response_data.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LineItemResponseData

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# 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

Instance Attribute Details

#country_iso_codeObject

ISO country code



18
19
20
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 18

def country_iso_code
  @country_iso_code
end

#created_atObject

created time.



21
22
23
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 21

def created_at
  @created_at
end

#days_in_fieldObject

Duration of the project in days.



24
25
26
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 24

def days_in_field
  @days_in_field
end

#delivery_typeObject

Delivery type: SLOW, BALANCED, FAST or BURST.



27
28
29
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 27

def delivery_type
  @delivery_type
end

Returns the value of attribute end_links.



29
30
31
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 29

def end_links
  @end_links
end

#ext_line_item_idObject

Unique line item Id



32
33
34
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 32

def ext_line_item_id
  @ext_line_item_id
end

#indicative_incidenceObject

Expected incidence of the survey



35
36
37
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 35

def indicative_incidence
  @indicative_incidence
end

#language_iso_codeObject

ISO language code



38
39
40
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 38

def language_iso_code
  @language_iso_code
end

#launched_atObject

launched time.



41
42
43
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 41

def launched_at
  @launched_at
end

#length_of_interviewObject

expected duration of the survey in minutes



44
45
46
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 44

def length_of_interview
  @length_of_interview
end

#quota_planObject

Returns the value of attribute quota_plan.



46
47
48
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 46

def quota_plan
  @quota_plan
end

#required_completesObject

Number of complete required for the line item



49
50
51
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 49

def required_completes
  @required_completes
end

#stateObject

state



52
53
54
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 52

def state
  @state
end

#state_last_updated_atObject

state last updated at.



55
56
57
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 55

def state_last_updated_at
  @state_last_updated_at
end

#state_reasonObject

state reason



58
59
60
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 58

def state_reason
  @state_reason
end

#survey_test_urlObject

Entry link for the user.



61
62
63
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 61

def survey_test_url
  @survey_test_url
end

#survey_urlObject

Entry link for the user.



64
65
66
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 64

def survey_url
  @survey_url
end

#targetsObject

Data of completes/starts required for the line item



67
68
69
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 67

def targets
  @targets
end

#titleObject

A title for the line item



70
71
72
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 70

def title
  @title
end

#updated_atObject

updated time.



73
74
75
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 73

def updated_at
  @updated_at
end

Class Method Details

.attribute_mapObject

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# 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

.swagger_typesObject

Attribute type mapping.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# 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) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# 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) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



394
395
396
397
398
399
400
401
402
403
404
405
406
# 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) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# 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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


294
295
296
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 294

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



300
301
302
# 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_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



242
243
244
245
# 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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



374
375
376
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 374

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



380
381
382
383
384
385
386
387
388
# 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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



368
369
370
# File 'lib/samplify_api_client/models/line_item_response_data.rb', line 368

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



249
250
251
252
253
# 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