Class: SamplifyAPIClient::LineItemData
- Inherits:
-
Object
- Object
- SamplifyAPIClient::LineItemData
- Defined in:
- lib/samplify_api_client/models/line_item_data.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#country_iso_code ⇒ Object
ISO country code.
-
#days_in_field ⇒ Object
Duration of the project in days.
-
#delivery_type ⇒ Object
Delivery type: SLOW, BALANCED,FAST or BURST.
-
#ext_line_item_id ⇒ Object
Unique line item Id.
-
#indicative_incidence ⇒ Object
Expected incidence of the survey.
-
#language_iso_code ⇒ Object
ISO language code.
-
#length_of_interview ⇒ Object
expected duration of the survey in minutes.
-
#quota_plan ⇒ Object
Returns the value of attribute quota_plan.
-
#required_completes ⇒ Object
Number of complete required for the line item.
-
#survey_test_url ⇒ Object
Entry link for the user.
-
#survey_test_url_params ⇒ Object
SurveyTestURL Params of the line item.
-
#survey_url ⇒ Object
Entry link for the user.
-
#survey_url_params ⇒ Object
SurveyURL Params of the line item.
-
#targets ⇒ Object
Data of completes/starts required for the line item.
-
#title ⇒ Object
A title for the line item.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ LineItemData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ LineItemData
Initializes the object
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 190 191 192 193 194 195 196 197 198 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 127 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?(:'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?(:'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_code ⇒ Object
ISO country code
18 19 20 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 18 def country_iso_code @country_iso_code end |
#days_in_field ⇒ Object
Duration of the project in days.
21 22 23 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 21 def days_in_field @days_in_field end |
#delivery_type ⇒ Object
Delivery type: SLOW, BALANCED,FAST or BURST.
24 25 26 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 24 def delivery_type @delivery_type end |
#ext_line_item_id ⇒ Object
Unique line item Id
27 28 29 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 27 def ext_line_item_id @ext_line_item_id end |
#indicative_incidence ⇒ Object
Expected incidence of the survey
30 31 32 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 30 def indicative_incidence @indicative_incidence end |
#language_iso_code ⇒ Object
ISO language code
33 34 35 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 33 def language_iso_code @language_iso_code end |
#length_of_interview ⇒ Object
expected duration of the survey in minutes
36 37 38 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 36 def length_of_interview @length_of_interview end |
#quota_plan ⇒ Object
Returns the value of attribute quota_plan.
38 39 40 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 38 def quota_plan @quota_plan end |
#required_completes ⇒ Object
Number of complete required for the line item
41 42 43 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 41 def required_completes @required_completes end |
#survey_test_url ⇒ Object
Entry link for the user.
44 45 46 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 44 def survey_test_url @survey_test_url end |
#survey_test_url_params ⇒ Object
SurveyTestURL Params of the line item.
47 48 49 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 47 def survey_test_url_params @survey_test_url_params end |
#survey_url ⇒ Object
Entry link for the user.
50 51 52 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 50 def survey_url @survey_url end |
#survey_url_params ⇒ Object
SurveyURL Params of the line item.
53 54 55 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 53 def survey_url_params @survey_url_params end |
#targets ⇒ Object
Data of completes/starts required for the line item
56 57 58 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 56 def targets @targets end |
#title ⇒ Object
A title for the line item
59 60 61 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 59 def title @title end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 84 def self.attribute_map { :'country_iso_code' => :'countryISOCode', :'days_in_field' => :'daysInField', :'delivery_type' => :'deliveryType', :'ext_line_item_id' => :'extLineItemId', :'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_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 105 def self.swagger_types { :'country_iso_code' => :'String', :'days_in_field' => :'Integer', :'delivery_type' => :'String', :'ext_line_item_id' => :'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.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 262 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 && ext_line_item_id == o.ext_line_item_id && 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
318 319 320 321 322 323 324 325 326 327 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 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 318 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
384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 384 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
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 297 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
284 285 286 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 284 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
290 291 292 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 290 def hash [country_iso_code, days_in_field, delivery_type, ext_line_item_id, 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_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 202 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 @days_in_field.nil? invalid_properties.push('invalid value for "days_in_field", days_in_field 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 @indicative_incidence.nil? invalid_properties.push('invalid value for "indicative_incidence", indicative_incidence 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 @length_of_interview.nil? invalid_properties.push('invalid value for "length_of_interview", length_of_interview cannot be nil.') end if @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
364 365 366 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 364 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
370 371 372 373 374 375 376 377 378 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 370 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 ⇒ String
Returns the string representation of the object
358 359 360 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 358 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/samplify_api_client/models/line_item_data.rb', line 237 def valid? return false if @country_iso_code.nil? return false if @days_in_field.nil? delivery_type_validator = EnumAttributeValidator.new('String', ['SLOW', 'BALANCED', 'FAST', 'BURST']) return false unless delivery_type_validator.valid?(@delivery_type) return false if @ext_line_item_id.nil? return false if @indicative_incidence.nil? return false if @language_iso_code.nil? return false if @length_of_interview.nil? return false if @title.nil? true end |