Class: NewStoreApi::StockProductAvailabilityRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/stock_product_availability_request.rb

Overview

Use this API to fetch ATP information, filtered by products. The response will be paginated, with a max page size of 2000 items

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(page_number = nil, page_size = nil, products = nil) ⇒ StockProductAvailabilityRequest

Returns a new instance of StockProductAvailabilityRequest.



46
47
48
49
50
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 46

def initialize(page_number = nil, page_size = nil, products = nil)
  @page_number = page_number
  @page_size = page_size
  @products = products
end

Instance Attribute Details

#page_numberFloat

The page number of paginated response. The page number starts at 1

Returns:

  • (Float)


15
16
17
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 15

def page_number
  @page_number
end

#page_sizeFloat

The max size of the paginated response. This value should not be more than 2000.

Returns:

  • (Float)


20
21
22
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 20

def page_size
  @page_size
end

#productsArray[String]

The max size of the paginated response. This value should not be more than 2000.

Returns:

  • (Array[String])


25
26
27
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 25

def products
  @products
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  page_number = hash.key?('page_number') ? hash['page_number'] : nil
  page_size = hash.key?('page_size') ? hash['page_size'] : nil
  products = hash.key?('products') ? hash['products'] : nil

  # Create object from extracted values.
  StockProductAvailabilityRequest.new(page_number,
                                      page_size,
                                      products)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['page_number'] = 'page_number'
  @_hash['page_size'] = 'page_size'
  @_hash['products'] = 'products'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 37

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



75
76
77
78
79
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 75

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} page_number: #{@page_number.inspect}, page_size: #{@page_size.inspect},"\
  " products: #{@products.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



68
69
70
71
72
# File 'lib/new_store_api/models/stock_product_availability_request.rb', line 68

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} page_number: #{@page_number}, page_size: #{@page_size}, products:"\
  " #{@products}>"
end