Class: PaypalServerSdk::OrderTrackerItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/order_tracker_item.rb

Overview

The details of the items in the shipment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name: SKIP, quantity: SKIP, sku: SKIP, url: SKIP, image_url: SKIP, upc: SKIP) ⇒ OrderTrackerItem

Returns a new instance of OrderTrackerItem.



68
69
70
71
72
73
74
75
76
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 68

def initialize(name: SKIP, quantity: SKIP, sku: SKIP, url: SKIP,
               image_url: SKIP, upc: SKIP)
  @name = name unless name == SKIP
  @quantity = quantity unless quantity == SKIP
  @sku = sku unless sku == SKIP
  @url = url unless url == SKIP
  @image_url = image_url unless image_url == SKIP
  @upc = upc unless upc == SKIP
end

Instance Attribute Details

#image_urlString

The URL of the item’s image. File type and size restrictions apply. An image that violates these restrictions will not be honored.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 33

def image_url
  @image_url
end

#nameString

The item name or title.

Returns:

  • (String)


14
15
16
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 14

def name
  @name
end

#quantityString

The item quantity. Must be a whole number.

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 18

def quantity
  @quantity
end

#skuString

The stock keeping unit (SKU) for the item. This can contain unicode characters.

Returns:

  • (String)


23
24
25
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 23

def sku
  @sku
end

#upcUniversalProductCode

The Universal Product Code of the item.



37
38
39
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 37

def upc
  @upc
end

#urlString

The URL to the item being purchased. Visible to buyer and used in buyer experiences.

Returns:

  • (String)


28
29
30
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 28

def url
  @url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
  sku = hash.key?('sku') ? hash['sku'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  image_url = hash.key?('image_url') ? hash['image_url'] : SKIP
  upc = UniversalProductCode.from_hash(hash['upc']) if hash['upc']

  # Create object from extracted values.
  OrderTrackerItem.new(name: name,
                       quantity: quantity,
                       sku: sku,
                       url: url,
                       image_url: image_url,
                       upc: upc)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['quantity'] = 'quantity'
  @_hash['sku'] = 'sku'
  @_hash['url'] = 'url'
  @_hash['image_url'] = 'image_url'
  @_hash['upc'] = 'upc'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 52

def self.optionals
  %w[
    name
    quantity
    sku
    url
    image_url
    upc
  ]
end