Class: SamplifyAPIClient::UpdateLineItem

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UpdateLineItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
# File 'lib/samplify_api_client/models/update_line_item.rb', line 122

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?(:'daysInField')
    self.days_in_field = attributes[:'daysInField']
  end

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

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

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

  if attributes.has_key?(:'surveyURLParams')
    if (value = attributes[:'surveyURLParams']).is_a?(Array)
      self.survey_url_params = value
    end
  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
end

Instance Attribute Details

#country_iso_codeObject

ISO country code



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

def country_iso_code
  @country_iso_code
end

#days_in_fieldObject

Duration of the project in days.



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

def days_in_field
  @days_in_field
end

#delivery_typeObject

Delivery type: SLOW, BALANCED, FAST, or BURST.



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

def delivery_type
  @delivery_type
end

#indicative_incidenceObject

Expected incidence of the survey



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

def indicative_incidence
  @indicative_incidence
end

#language_iso_codeObject

ISO language code



30
31
32
# File 'lib/samplify_api_client/models/update_line_item.rb', line 30

def language_iso_code
  @language_iso_code
end

#length_of_interviewObject

expected duration of the survey in minutes



33
34
35
# File 'lib/samplify_api_client/models/update_line_item.rb', line 33

def length_of_interview
  @length_of_interview
end

#quota_planObject

Returns the value of attribute quota_plan.



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

def quota_plan
  @quota_plan
end

#required_completesObject

Number of complete required for the line item



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

def required_completes
  @required_completes
end

#survey_test_urlObject

Entry link for the user.



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

def survey_test_url
  @survey_test_url
end

#survey_test_url_paramsObject

SurveyTestURL Params of the line item.



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

def survey_test_url_params
  @survey_test_url_params
end

#survey_urlObject

Entry link for the user.



47
48
49
# File 'lib/samplify_api_client/models/update_line_item.rb', line 47

def survey_url
  @survey_url
end

#survey_url_paramsObject

SurveyURL Params of the line item.



50
51
52
# File 'lib/samplify_api_client/models/update_line_item.rb', line 50

def survey_url_params
  @survey_url_params
end

#targetsObject

Data of completes/starts required for the line item



53
54
55
# File 'lib/samplify_api_client/models/update_line_item.rb', line 53

def targets
  @targets
end

#titleObject

A title for the line item



56
57
58
# File 'lib/samplify_api_client/models/update_line_item.rb', line 56

def title
  @title
end

Class Method Details

.attribute_mapObject

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/samplify_api_client/models/update_line_item.rb', line 81

def self.attribute_map
  {
    :'country_iso_code' => :'countryISOCode',
    :'days_in_field' => :'daysInField',
    :'delivery_type' => :'deliveryType',
    :'indicative_incidence' => :'indicativeIncidence',
    :'language_iso_code' => :'languageISOCode',
    :'length_of_interview' => :'lengthOfInterview',
    :'quota_plan' => :'quotaPlan',
    :'required_completes' => :'requiredCompletes',
    :'survey_test_url' => :'surveyTestURL',
    :'survey_test_url_params' => :'surveyTestURLParams',
    :'survey_url' => :'surveyURL',
    :'survey_url_params' => :'surveyURLParams',
    :'targets' => :'targets',
    :'title' => :'title'
  }
end

.swagger_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/samplify_api_client/models/update_line_item.rb', line 101

def self.swagger_types
  {
    :'country_iso_code' => :'String',
    :'days_in_field' => :'Integer',
    :'delivery_type' => :'String',
    :'indicative_incidence' => :'Float',
    :'language_iso_code' => :'String',
    :'length_of_interview' => :'Integer',
    :'quota_plan' => :'QuotaPlanData',
    :'required_completes' => :'Integer',
    :'survey_test_url' => :'String',
    :'survey_test_url_params' => :'Array<URLParam>',
    :'survey_url' => :'String',
    :'survey_url_params' => :'Array<URLParam>',
    :'targets' => :'Array<Target>',
    :'title' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/samplify_api_client/models/update_line_item.rb', line 218

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      country_iso_code == o.country_iso_code &&
      days_in_field == o.days_in_field &&
      delivery_type == o.delivery_type &&
      indicative_incidence == o.indicative_incidence &&
      language_iso_code == o.language_iso_code &&
      length_of_interview == o.length_of_interview &&
      quota_plan == o.quota_plan &&
      required_completes == o.required_completes &&
      survey_test_url == o.survey_test_url &&
      survey_test_url_params == o.survey_test_url_params &&
      survey_url == o.survey_url &&
      survey_url_params == o.survey_url_params &&
      targets == o.targets &&
      title == o.title
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



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/samplify_api_client/models/update_line_item.rb', line 273

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



339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/samplify_api_client/models/update_line_item.rb', line 339

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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/samplify_api_client/models/update_line_item.rb', line 252

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


239
240
241
# File 'lib/samplify_api_client/models/update_line_item.rb', line 239

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



245
246
247
# File 'lib/samplify_api_client/models/update_line_item.rb', line 245

def hash
  [country_iso_code, days_in_field, delivery_type, indicative_incidence, language_iso_code, length_of_interview, quota_plan, required_completes, survey_test_url, survey_test_url_params, survey_url, survey_url_params, targets, title].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



193
194
195
196
# File 'lib/samplify_api_client/models/update_line_item.rb', line 193

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



319
320
321
# File 'lib/samplify_api_client/models/update_line_item.rb', line 319

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



325
326
327
328
329
330
331
332
333
# File 'lib/samplify_api_client/models/update_line_item.rb', line 325

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



313
314
315
# File 'lib/samplify_api_client/models/update_line_item.rb', line 313

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



200
201
202
203
204
# File 'lib/samplify_api_client/models/update_line_item.rb', line 200

def valid?
  delivery_type_validator = EnumAttributeValidator.new('String', ['SLOW', 'BALANCED', 'FAST', 'BURST'])
  return false unless delivery_type_validator.valid?(@delivery_type)
  true
end