Class: NewStoreApi::Value

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

Overview

fulfillment node ID to customs signer config

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(base_url = nil, api_base_url = nil, customs_signer = nil, api_key = SKIP, booking_includes_return = false, return_deliveries_should_be_canceled = false) ⇒ Value

Returns a new instance of Value.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/new_store_api/models/value.rb', line 67

def initialize(base_url = nil, api_base_url = nil, customs_signer = nil,
               api_key = SKIP, booking_includes_return = false,
               return_deliveries_should_be_canceled = false)
  @base_url = base_url
  @api_base_url = api_base_url
  @api_key = api_key unless api_key == SKIP
  @booking_includes_return = booking_includes_return unless booking_includes_return == SKIP
  unless return_deliveries_should_be_canceled == SKIP
    @return_deliveries_should_be_canceled =
      return_deliveries_should_be_canceled
  end
  @customs_signer = customs_signer
end

Instance Attribute Details

#api_base_urlString

The shipping provider adapter URL. Must end with a slash /

Returns:

  • (String)


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

def api_base_url
  @api_base_url
end

#api_keyString

The shipping provider adapter URL. Must end with a slash /

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/value.rb', line 22

def api_key
  @api_key
end

#base_urlString

The Provider Rate customization adapter URL. Must end with a slash /

Returns:

  • (String)


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

def base_url
  @base_url
end

#booking_includes_returnTrueClass | FalseClass

The shipping provider adapter URL. Must end with a slash /

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/new_store_api/models/value.rb', line 26

def booking_includes_return
  @booking_includes_return
end

#customs_signerString

The shipping provider adapter URL. Must end with a slash /

Returns:

  • (String)


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

def customs_signer
  @customs_signer
end

#return_deliveries_should_be_canceledTrueClass | FalseClass

The shipping provider adapter URL. Must end with a slash /

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/new_store_api/models/value.rb', line 30

def return_deliveries_should_be_canceled
  @return_deliveries_should_be_canceled
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/new_store_api/models/value.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  base_url = hash.key?('base_url') ? hash['base_url'] : nil
  api_base_url = hash.key?('api_base_url') ? hash['api_base_url'] : nil
  customs_signer =
    hash.key?('customs_signer') ? hash['customs_signer'] : nil
  api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
  booking_includes_return = hash['booking_includes_return'] ||= false
  return_deliveries_should_be_canceled =
    hash['return_deliveries_should_be_canceled'] ||= false

  # Create object from extracted values.
  Value.new(base_url,
            api_base_url,
            customs_signer,
            api_key,
            booking_includes_return,
            return_deliveries_should_be_canceled)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/new_store_api/models/value.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['base_url'] = 'base_url'
  @_hash['api_base_url'] = 'api_base_url'
  @_hash['api_key'] = 'api_key'
  @_hash['booking_includes_return'] = 'booking_includes_return'
  @_hash['return_deliveries_should_be_canceled'] =
    'return_deliveries_should_be_canceled'
  @_hash['customs_signer'] = 'customs_signer'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
62
63
64
65
# File 'lib/new_store_api/models/value.rb', line 59

def self.nullables
  %w[
    api_key
    booking_includes_return
    return_deliveries_should_be_canceled
  ]
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
# File 'lib/new_store_api/models/value.rb', line 50

def self.optionals
  %w[
    api_key
    booking_includes_return
    return_deliveries_should_be_canceled
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



114
115
116
117
118
119
120
121
# File 'lib/new_store_api/models/value.rb', line 114

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} base_url: #{@base_url.inspect}, api_base_url: #{@api_base_url.inspect},"\
  " api_key: #{@api_key.inspect}, booking_includes_return:"\
  " #{@booking_includes_return.inspect}, return_deliveries_should_be_canceled:"\
  " #{@return_deliveries_should_be_canceled.inspect}, customs_signer:"\
  " #{@customs_signer.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
111
# File 'lib/new_store_api/models/value.rb', line 105

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} base_url: #{@base_url}, api_base_url: #{@api_base_url}, api_key:"\
  " #{@api_key}, booking_includes_return: #{@booking_includes_return},"\
  " return_deliveries_should_be_canceled: #{@return_deliveries_should_be_canceled},"\
  " customs_signer: #{@customs_signer}>"
end