Class: NewStoreApi::FulfillmentConfigDestinationRegion

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

Overview

Destination region for a fulfillment config route (Routes.json).

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(country = nil, zip_code_region = nil) ⇒ FulfillmentConfigDestinationRegion

Returns a new instance of FulfillmentConfigDestinationRegion.



38
39
40
41
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 38

def initialize(country = nil, zip_code_region = nil)
  @country = country
  @zip_code_region = zip_code_region
end

Instance Attribute Details

#countryString

Two-letter ISO 3166-1 alpha-2 country code for the route destination.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 14

def country
  @country
end

#zip_code_regionString

Zip code region identifier; keys into zip_code_regions.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 18

def zip_code_region
  @zip_code_region
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 44

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country = hash.key?('country') ? hash['country'] : nil
  zip_code_region =
    hash.key?('zip_code_region') ? hash['zip_code_region'] : nil

  # Create object from extracted values.
  FulfillmentConfigDestinationRegion.new(country,
                                         zip_code_region)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['country'] = 'country'
  @_hash['zip_code_region'] = 'zip_code_region'
  @_hash
end

.nullablesObject

An array for nullable fields



34
35
36
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 34

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 29

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



64
65
66
67
68
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 64

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

#to_sObject

Provides a human-readable string representation of the object.



58
59
60
61
# File 'lib/new_store_api/models/fulfillment_config_destination_region.rb', line 58

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} country: #{@country}, zip_code_region: #{@zip_code_region}>"
end