Class: PaypalServerSdk::OrderTrackerItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::OrderTrackerItem
- Defined in:
- lib/paypal_server_sdk/models/order_tracker_item.rb
Overview
The details of the items in the shipment.
Instance Attribute Summary collapse
-
#image_url ⇒ String
The URL of the item’s image.
-
#name ⇒ String
The item name or title.
-
#quantity ⇒ String
The item quantity.
-
#sku ⇒ String
The stock keeping unit (SKU) for the item.
-
#upc ⇒ UniversalProductCode
The Universal Product Code of the item.
-
#url ⇒ String
The URL to the item being purchased.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name: SKIP, quantity: SKIP, sku: SKIP, url: SKIP, image_url: SKIP, upc: SKIP) ⇒ OrderTrackerItem
constructor
A new instance of OrderTrackerItem.
Methods inherited from BaseModel
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_url ⇒ String
The URL of the item’s image. File type and size restrictions apply. An image that violates these restrictions will not be honored.
33 34 35 |
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 33 def image_url @image_url end |
#name ⇒ String
The item name or title.
14 15 16 |
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 14 def name @name end |
#quantity ⇒ String
The item quantity. Must be a whole number.
18 19 20 |
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 18 def quantity @quantity end |
#sku ⇒ String
The stock keeping unit (SKU) for the item. This can contain unicode characters.
23 24 25 |
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 23 def sku @sku end |
#upc ⇒ UniversalProductCode
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 |
#url ⇒ String
The URL to the item being purchased. Visible to buyer and used in buyer experiences.
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/paypal_server_sdk/models/order_tracker_item.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
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 |