Class: NewStoreApi::ResponseBookedPackage
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::ResponseBookedPackage
- Defined in:
- lib/new_store_api/models/response_booked_package.rb
Overview
ResponseBookedPackage Model.
Instance Attribute Summary collapse
-
#canceled_at ⇒ String
TODO: Write general description for this method.
-
#carrier_code ⇒ String
TODO: Write general description for this method.
-
#commercial_invoice_url ⇒ String
commercial invoice URL after re-upload by newstore.
-
#cost ⇒ BookingResponseCost
commercial invoice URL after re-upload by newstore.
-
#label_url ⇒ String
label URL after re-upload by newstore.
-
#offer ⇒ String
label URL after re-upload by newstore.
-
#original_commercial_invoice_url ⇒ String
commercial invoice URL as returned from carrier/adapter.
-
#original_label_url ⇒ String
label URL as returned from carrier/adapter.
-
#tracking ⇒ Array[PackageTracking]
label URL as returned from carrier/adapter.
-
#tracking_code ⇒ String
label URL as returned from carrier/adapter.
-
#tracking_url ⇒ String
label URL as returned from carrier/adapter.
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(carrier_code = nil, original_label_url = nil, tracking_code = nil, canceled_at = SKIP, commercial_invoice_url = SKIP, cost = SKIP, label_url = SKIP, offer = SKIP, original_commercial_invoice_url = SKIP, tracking = SKIP, tracking_url = SKIP) ⇒ ResponseBookedPackage
constructor
A new instance of ResponseBookedPackage.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(carrier_code = nil, original_label_url = nil, tracking_code = nil, canceled_at = SKIP, commercial_invoice_url = SKIP, cost = SKIP, label_url = SKIP, offer = SKIP, original_commercial_invoice_url = SKIP, tracking = SKIP, tracking_url = SKIP) ⇒ ResponseBookedPackage
Returns a new instance of ResponseBookedPackage.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 109 def initialize(carrier_code = nil, original_label_url = nil, tracking_code = nil, canceled_at = SKIP, commercial_invoice_url = SKIP, cost = SKIP, label_url = SKIP, offer = SKIP, original_commercial_invoice_url = SKIP, tracking = SKIP, tracking_url = SKIP) @canceled_at = canceled_at unless canceled_at == SKIP @carrier_code = carrier_code @commercial_invoice_url = commercial_invoice_url unless commercial_invoice_url == SKIP @cost = cost unless cost == SKIP @label_url = label_url unless label_url == SKIP @offer = offer unless offer == SKIP unless original_commercial_invoice_url == SKIP @original_commercial_invoice_url = original_commercial_invoice_url end @original_label_url = original_label_url @tracking = tracking unless tracking == SKIP @tracking_code = tracking_code @tracking_url = tracking_url unless tracking_url == SKIP end |
Instance Attribute Details
#canceled_at ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 14 def canceled_at @canceled_at end |
#carrier_code ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 18 def carrier_code @carrier_code end |
#commercial_invoice_url ⇒ String
commercial invoice URL after re-upload by newstore. this is the URL we want to expose to customers.
23 24 25 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 23 def commercial_invoice_url @commercial_invoice_url end |
#cost ⇒ BookingResponseCost
commercial invoice URL after re-upload by newstore. this is the URL we want to expose to customers.
28 29 30 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 28 def cost @cost end |
#label_url ⇒ String
label URL after re-upload by newstore. this is the URL we want to expose to customers.
33 34 35 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 33 def label_url @label_url end |
#offer ⇒ String
label URL after re-upload by newstore. this is the URL we want to expose to customers.
38 39 40 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 38 def offer @offer end |
#original_commercial_invoice_url ⇒ String
commercial invoice URL as returned from carrier/adapter.
42 43 44 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 42 def original_commercial_invoice_url @original_commercial_invoice_url end |
#original_label_url ⇒ String
label URL as returned from carrier/adapter. this should stay internal: can be used for background re-upload for example.
47 48 49 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 47 def original_label_url @original_label_url end |
#tracking ⇒ Array[PackageTracking]
label URL as returned from carrier/adapter. this should stay internal: can be used for background re-upload for example.
52 53 54 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 52 def tracking @tracking end |
#tracking_code ⇒ String
label URL as returned from carrier/adapter. this should stay internal: can be used for background re-upload for example.
57 58 59 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 57 def tracking_code @tracking_code end |
#tracking_url ⇒ String
label URL as returned from carrier/adapter. this should stay internal: can be used for background re-upload for example.
62 63 64 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 62 def tracking_url @tracking_url end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 131 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier_code = hash.key?('carrier_code') ? hash['carrier_code'] : nil original_label_url = hash.key?('original_label_url') ? hash['original_label_url'] : nil tracking_code = hash.key?('tracking_code') ? hash['tracking_code'] : nil canceled_at = hash.key?('canceled_at') ? hash['canceled_at'] : SKIP commercial_invoice_url = hash.key?('commercial_invoice_url') ? hash['commercial_invoice_url'] : SKIP cost = BookingResponseCost.from_hash(hash['cost']) if hash['cost'] label_url = hash.key?('label_url') ? hash['label_url'] : SKIP offer = hash.key?('offer') ? hash['offer'] : SKIP original_commercial_invoice_url = hash.key?('original_commercial_invoice_url') ? hash['original_commercial_invoice_url'] : SKIP # Parameter is an array, so we need to iterate through it tracking = nil unless hash['tracking'].nil? tracking = [] hash['tracking'].each do |structure| tracking << (PackageTracking.from_hash(structure) if structure) end end tracking = SKIP unless hash.key?('tracking') tracking_url = hash.key?('tracking_url') ? hash['tracking_url'] : SKIP # Create object from extracted values. ResponseBookedPackage.new(carrier_code, original_label_url, tracking_code, canceled_at, commercial_invoice_url, cost, label_url, offer, original_commercial_invoice_url, tracking, tracking_url) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['canceled_at'] = 'canceled_at' @_hash['carrier_code'] = 'carrier_code' @_hash['commercial_invoice_url'] = 'commercial_invoice_url' @_hash['cost'] = 'cost' @_hash['label_url'] = 'label_url' @_hash['offer'] = 'offer' @_hash['original_commercial_invoice_url'] = 'original_commercial_invoice_url' @_hash['original_label_url'] = 'original_label_url' @_hash['tracking'] = 'tracking' @_hash['tracking_code'] = 'tracking_code' @_hash['tracking_url'] = 'tracking_url' @_hash end |
.nullables ⇒ Object
An array for nullable fields
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 97 def self.nullables %w[ canceled_at commercial_invoice_url cost label_url offer original_commercial_invoice_url tracking_url ] end |
.optionals ⇒ Object
An array for optional fields
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 83 def self.optionals %w[ canceled_at commercial_invoice_url cost label_url offer original_commercial_invoice_url tracking tracking_url ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
184 185 186 187 188 189 190 191 192 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 184 def inspect class_name = self.class.name.split('::').last "<#{class_name} canceled_at: #{@canceled_at.inspect}, carrier_code:"\ " #{@carrier_code.inspect}, commercial_invoice_url: #{@commercial_invoice_url.inspect},"\ " cost: #{@cost.inspect}, label_url: #{@label_url.inspect}, offer: #{@offer.inspect},"\ " original_commercial_invoice_url: #{@original_commercial_invoice_url.inspect},"\ " original_label_url: #{@original_label_url.inspect}, tracking: #{@tracking.inspect},"\ " tracking_code: #{@tracking_code.inspect}, tracking_url: #{@tracking_url.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
174 175 176 177 178 179 180 181 |
# File 'lib/new_store_api/models/response_booked_package.rb', line 174 def to_s class_name = self.class.name.split('::').last "<#{class_name} canceled_at: #{@canceled_at}, carrier_code: #{@carrier_code},"\ " commercial_invoice_url: #{@commercial_invoice_url}, cost: #{@cost}, label_url:"\ " #{@label_url}, offer: #{@offer}, original_commercial_invoice_url:"\ " #{@original_commercial_invoice_url}, original_label_url: #{@original_label_url}, tracking:"\ " #{@tracking}, tracking_code: #{@tracking_code}, tracking_url: #{@tracking_url}>" end |