Class: NewStoreApi::ReservationConfigResponse

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

Overview

ReservationConfigResponse Model.

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(expires_in_min = nil, send_accepted_emails = nil, send_rejected_emails = nil) ⇒ ReservationConfigResponse

Returns a new instance of ReservationConfigResponse.



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

def initialize(expires_in_min = nil, send_accepted_emails = nil,
               send_rejected_emails = nil)
  @expires_in_min = expires_in_min
  @send_accepted_emails = send_accepted_emails
  @send_rejected_emails = send_rejected_emails
end

Instance Attribute Details

#expires_in_minInteger

Duration of the reservation in minutes

Returns:

  • (Integer)


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

def expires_in_min
  @expires_in_min
end

#send_accepted_emailsTrueClass | FalseClass

Whether to send emails to customers when a pending reservation is accepted by a store.

Returns:

  • (TrueClass | FalseClass)


19
20
21
# File 'lib/new_store_api/models/reservation_config_response.rb', line 19

def send_accepted_emails
  @send_accepted_emails
end

#send_rejected_emailsTrueClass | FalseClass

Whether to send emails to customers when a pending reservation is rejected by a store.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/new_store_api/models/reservation_config_response.rb', line 24

def send_rejected_emails
  @send_rejected_emails
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
66
67
68
# File 'lib/new_store_api/models/reservation_config_response.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  expires_in_min =
    hash.key?('expires_in_min') ? hash['expires_in_min'] : nil
  send_accepted_emails =
    hash.key?('send_accepted_emails') ? hash['send_accepted_emails'] : nil
  send_rejected_emails =
    hash.key?('send_rejected_emails') ? hash['send_rejected_emails'] : nil

  # Create object from extracted values.
  ReservationConfigResponse.new(expires_in_min,
                                send_accepted_emails,
                                send_rejected_emails)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['expires_in_min'] = 'expires_in_min'
  @_hash['send_accepted_emails'] = 'send_accepted_emails'
  @_hash['send_rejected_emails'] = 'send_rejected_emails'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/new_store_api/models/reservation_config_response.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
# File 'lib/new_store_api/models/reservation_config_response.rb', line 36

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/new_store_api/models/reservation_config_response.rb', line 78

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

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
# File 'lib/new_store_api/models/reservation_config_response.rb', line 71

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