Class: NewStoreApi::RequestPackage
- Defined in:
- lib/new_store_api/models/request_package.rb
Overview
RequestPackage Model.
Instance Attribute Summary collapse
-
#customs ⇒ RequestPackageCustoms
TODO: Write general description for this method.
-
#external_package_id ⇒ String
TODO: Write general description for this method.
-
#package_option ⇒ PackageOption
TODO: Write general description for this method.
-
#products ⇒ Array[BookingProduct]
TODO: Write general description for this method.
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(products = nil, customs = SKIP, external_package_id = SKIP, package_option = SKIP) ⇒ RequestPackage
constructor
A new instance of RequestPackage.
-
#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(products = nil, customs = SKIP, external_package_id = SKIP, package_option = SKIP) ⇒ RequestPackage
Returns a new instance of RequestPackage.
56 57 58 59 60 61 62 |
# File 'lib/new_store_api/models/request_package.rb', line 56 def initialize(products = nil, customs = SKIP, external_package_id = SKIP, package_option = SKIP) @customs = customs unless customs == SKIP @external_package_id = external_package_id unless external_package_id == SKIP @package_option = package_option unless package_option == SKIP @products = products end |
Instance Attribute Details
#customs ⇒ RequestPackageCustoms
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/request_package.rb', line 14 def customs @customs end |
#external_package_id ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/request_package.rb', line 18 def external_package_id @external_package_id end |
#package_option ⇒ PackageOption
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/request_package.rb', line 22 def package_option @package_option end |
#products ⇒ Array[BookingProduct]
TODO: Write general description for this method
26 27 28 |
# File 'lib/new_store_api/models/request_package.rb', line 26 def products @products end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/new_store_api/models/request_package.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it products = nil unless hash['products'].nil? products = [] hash['products'].each do |structure| products << (BookingProduct.from_hash(structure) if structure) end end products = nil unless hash.key?('products') customs = RequestPackageCustoms.from_hash(hash['customs']) if hash['customs'] external_package_id = hash.key?('external_package_id') ? hash['external_package_id'] : SKIP package_option = PackageOption.from_hash(hash['package_option']) if hash['package_option'] # Create object from extracted values. RequestPackage.new(products, customs, external_package_id, package_option) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/new_store_api/models/request_package.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['customs'] = 'customs' @_hash['external_package_id'] = 'external_package_id' @_hash['package_option'] = 'package_option' @_hash['products'] = 'products' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 51 52 53 54 |
# File 'lib/new_store_api/models/request_package.rb', line 48 def self.nullables %w[ customs external_package_id package_option ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 |
# File 'lib/new_store_api/models/request_package.rb', line 39 def self.optionals %w[ customs external_package_id package_option ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/new_store_api/models/request_package.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} customs: #{@customs.inspect}, external_package_id:"\ " #{@external_package_id.inspect}, package_option: #{@package_option.inspect}, products:"\ " #{@products.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/new_store_api/models/request_package.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} customs: #{@customs}, external_package_id: #{@external_package_id},"\ " package_option: #{@package_option}, products: #{@products}>" end |