Class: UltracartClient::ItemChannelPartnerMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/item_channel_partner_mapping.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ItemChannelPartnerMapping

Initializes the object

Parameters:

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

    Model attributes in the form of hash



121
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
190
191
192
193
194
195
196
197
198
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 121

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#barcode_uaObject

Barcode UA (EDI only)



18
19
20
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 18

def barcode_ua
  @barcode_ua
end

#barcode_ucObject

Barcode UC (EDI only)



21
22
23
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 21

def barcode_uc
  @barcode_uc
end

#barcode_uiObject

Barcode UI (EDI only)



24
25
26
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 24

def barcode_ui
  @barcode_ui
end

#barcode_ukObject

Barcode UK (EDI only)



27
28
29
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 27

def barcode_uk
  @barcode_uk
end

#buyer_catalog_numberObject

Buyer catalog number (EDI only)



30
31
32
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 30

def buyer_catalog_number
  @buyer_catalog_number
end

#buyer_dpciObject

Buyer DPCI (EDI only)



33
34
35
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 33

def buyer_dpci
  @buyer_dpci
end

#buyer_item_numberObject

Buyer item number (EDI only)



36
37
38
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 36

def buyer_item_number
  @buyer_item_number
end

#channel_partner_codeObject

Channel partner code



39
40
41
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 39

def channel_partner_code
  @channel_partner_code
end

#channel_partner_oidObject

Channel partner object identifier



42
43
44
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 42

def channel_partner_oid
  @channel_partner_oid
end

#from_item_idObject

From Item ID



45
46
47
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 45

def from_item_id
  @from_item_id
end

#from_skuObject

From SKU



48
49
50
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 48

def from_sku
  @from_sku
end

#mutually_defined_numberObject

Mutually defined number (EDI only)



51
52
53
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 51

def mutually_defined_number
  @mutually_defined_number
end

#quantity_ratio_cpObject

Ratio (Channel Partner)



54
55
56
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 54

def quantity_ratio_cp
  @quantity_ratio_cp
end

#quantity_ratio_ucObject

Ratio (UltraCart)



57
58
59
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 57

def quantity_ratio_uc
  @quantity_ratio_uc
end

#skuObject

SKU



60
61
62
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 60

def sku
  @sku
end

#unit_of_measureObject

Unit of measure



63
64
65
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 63

def unit_of_measure
  @unit_of_measure
end

#vendor_numberObject

Vendor number (EDI only)



66
67
68
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 66

def vendor_number
  @vendor_number
end

#vendor_style_numberObject

Vendor style number (EDI only)



69
70
71
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 69

def vendor_style_number
  @vendor_style_number
end

Class Method Details

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 72

def self.attribute_map
  {
    :'barcode_ua' => :'barcode_ua',
    :'barcode_uc' => :'barcode_uc',
    :'barcode_ui' => :'barcode_ui',
    :'barcode_uk' => :'barcode_uk',
    :'buyer_catalog_number' => :'buyer_catalog_number',
    :'buyer_dpci' => :'buyer_dpci',
    :'buyer_item_number' => :'buyer_item_number',
    :'channel_partner_code' => :'channel_partner_code',
    :'channel_partner_oid' => :'channel_partner_oid',
    :'from_item_id' => :'from_item_id',
    :'from_sku' => :'from_sku',
    :'mutually_defined_number' => :'mutually_defined_number',
    :'quantity_ratio_cp' => :'quantity_ratio_cp',
    :'quantity_ratio_uc' => :'quantity_ratio_uc',
    :'sku' => :'sku',
    :'unit_of_measure' => :'unit_of_measure',
    :'vendor_number' => :'vendor_number',
    :'vendor_style_number' => :'vendor_style_number'
  }
end

.swagger_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 96

def self.swagger_types
  {
    :'barcode_ua' => :'String',
    :'barcode_uc' => :'String',
    :'barcode_ui' => :'String',
    :'barcode_uk' => :'String',
    :'buyer_catalog_number' => :'String',
    :'buyer_dpci' => :'String',
    :'buyer_item_number' => :'String',
    :'channel_partner_code' => :'String',
    :'channel_partner_oid' => :'Integer',
    :'from_item_id' => :'String',
    :'from_sku' => :'String',
    :'mutually_defined_number' => :'String',
    :'quantity_ratio_cp' => :'Integer',
    :'quantity_ratio_uc' => :'Integer',
    :'sku' => :'String',
    :'unit_of_measure' => :'String',
    :'vendor_number' => :'String',
    :'vendor_style_number' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 260

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      barcode_ua == o.barcode_ua &&
      barcode_uc == o.barcode_uc &&
      barcode_ui == o.barcode_ui &&
      barcode_uk == o.barcode_uk &&
      buyer_catalog_number == o.buyer_catalog_number &&
      buyer_dpci == o.buyer_dpci &&
      buyer_item_number == o.buyer_item_number &&
      channel_partner_code == o.channel_partner_code &&
      channel_partner_oid == o.channel_partner_oid &&
      from_item_id == o.from_item_id &&
      from_sku == o.from_sku &&
      mutually_defined_number == o.mutually_defined_number &&
      quantity_ratio_cp == o.quantity_ratio_cp &&
      quantity_ratio_uc == o.quantity_ratio_uc &&
      sku == o.sku &&
      unit_of_measure == o.unit_of_measure &&
      vendor_number == o.vendor_number &&
      vendor_style_number == o.vendor_style_number
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



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
355
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 319

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 = UltracartClient.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



385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 385

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



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 298

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 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


285
286
287
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 285

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



291
292
293
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 291

def hash
  [barcode_ua, barcode_uc, barcode_ui, barcode_uk, buyer_catalog_number, buyer_dpci, buyer_item_number, channel_partner_code, channel_partner_oid, from_item_id, from_sku, mutually_defined_number, quantity_ratio_cp, quantity_ratio_uc, sku, unit_of_measure, vendor_number, vendor_style_number].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 202

def list_invalid_properties
  invalid_properties = Array.new
  if !@from_item_id.nil? && @from_item_id.to_s.length > 30
    invalid_properties.push('invalid value for "from_item_id", the character length must be smaller than or equal to 30.')
  end

  if !@from_sku.nil? && @from_sku.to_s.length > 50
    invalid_properties.push('invalid value for "from_sku", the character length must be smaller than or equal to 50.')
  end

  if !@sku.nil? && @sku.to_s.length > 50
    invalid_properties.push('invalid value for "sku", the character length must be smaller than or equal to 50.')
  end

  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



365
366
367
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 365

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



371
372
373
374
375
376
377
378
379
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 371

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



359
360
361
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 359

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



221
222
223
224
225
226
# File 'lib/ultracart_api/models/item_channel_partner_mapping.rb', line 221

def valid?
  return false if !@from_item_id.nil? && @from_item_id.to_s.length > 30
  return false if !@from_sku.nil? && @from_sku.to_s.length > 50
  return false if !@sku.nil? && @sku.to_s.length > 50
  true
end