Class: NewStoreApi::Config
- Defined in:
- lib/new_store_api/models/config.rb
Overview
Config Model.
Instance Attribute Summary collapse
-
#exclude_historical_orders ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#exclude_web_orders_in_returns ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#excluded_products ⇒ Array[ExcludedProduct]
TODO: Write general description for this method.
-
#include_tax ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#return_location_calculation ⇒ String
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(exclude_historical_orders = true, exclude_web_orders_in_returns = true, excluded_products = nil, include_tax = false, return_location_calculation = nil) ⇒ Config
constructor
A new instance of Config.
-
#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(exclude_historical_orders = true, exclude_web_orders_in_returns = true, excluded_products = nil, include_tax = false, return_location_calculation = nil) ⇒ Config
Returns a new instance of Config.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/new_store_api/models/config.rb', line 54 def initialize(exclude_historical_orders = true, exclude_web_orders_in_returns = true, excluded_products = nil, include_tax = false, return_location_calculation = nil) @exclude_historical_orders = exclude_historical_orders @exclude_web_orders_in_returns = exclude_web_orders_in_returns @excluded_products = excluded_products @include_tax = include_tax @return_location_calculation = return_location_calculation end |
Instance Attribute Details
#exclude_historical_orders ⇒ TrueClass | FalseClass
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/config.rb', line 14 def exclude_historical_orders @exclude_historical_orders end |
#exclude_web_orders_in_returns ⇒ TrueClass | FalseClass
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/config.rb', line 18 def exclude_web_orders_in_returns @exclude_web_orders_in_returns end |
#excluded_products ⇒ Array[ExcludedProduct]
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/config.rb', line 22 def excluded_products @excluded_products end |
#include_tax ⇒ TrueClass | FalseClass
TODO: Write general description for this method
26 27 28 |
# File 'lib/new_store_api/models/config.rb', line 26 def include_tax @include_tax end |
#return_location_calculation ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/new_store_api/models/config.rb', line 30 def return_location_calculation @return_location_calculation end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/new_store_api/models/config.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. exclude_historical_orders = hash['exclude_historical_orders'] ||= true exclude_web_orders_in_returns = hash['exclude_web_orders_in_returns'] ||= true # Parameter is an array, so we need to iterate through it excluded_products = nil unless hash['excluded_products'].nil? excluded_products = [] hash['excluded_products'].each do |structure| excluded_products << (ExcludedProduct.from_hash(structure) if structure) end end excluded_products = nil unless hash.key?('excluded_products') include_tax = hash['include_tax'] ||= false return_location_calculation = hash.key?('return_location_calculation') ? hash['return_location_calculation'] : nil # Create object from extracted values. Config.new(exclude_historical_orders, exclude_web_orders_in_returns, excluded_products, include_tax, return_location_calculation) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/config.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['exclude_historical_orders'] = 'exclude_historical_orders' @_hash['exclude_web_orders_in_returns'] = 'exclude_web_orders_in_returns' @_hash['excluded_products'] = 'excluded_products' @_hash['include_tax'] = 'include_tax' @_hash['return_location_calculation'] = 'return_location_calculation' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/new_store_api/models/config.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 |
# File 'lib/new_store_api/models/config.rb', line 45 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 110 111 |
# File 'lib/new_store_api/models/config.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} exclude_historical_orders: #{@exclude_historical_orders.inspect},"\ " exclude_web_orders_in_returns: #{@exclude_web_orders_in_returns.inspect},"\ " excluded_products: #{@excluded_products.inspect}, include_tax: #{@include_tax.inspect},"\ " return_location_calculation: #{@return_location_calculation.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 102 |
# File 'lib/new_store_api/models/config.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} exclude_historical_orders: #{@exclude_historical_orders},"\ " exclude_web_orders_in_returns: #{@exclude_web_orders_in_returns}, excluded_products:"\ " #{@excluded_products}, include_tax: #{@include_tax}, return_location_calculation:"\ " #{@return_location_calculation}>" end |