Class: NewStoreApi::ResponseDeliveryWindow

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

Overview

ResponseDeliveryWindow 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(ends_at = nil, starts_at = nil) ⇒ ResponseDeliveryWindow

Returns a new instance of ResponseDeliveryWindow.



39
40
41
42
# File 'lib/new_store_api/models/response_delivery_window.rb', line 39

def initialize(ends_at = nil, starts_at = nil)
  @ends_at = ends_at
  @starts_at = starts_at
end

Instance Attribute Details

#ends_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def ends_at
  @ends_at
end

#starts_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def starts_at
  @starts_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/new_store_api/models/response_delivery_window.rb', line 45

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ends_at = if hash.key?('ends_at')
              (DateTimeHelper.from_rfc3339(hash['ends_at']) if hash['ends_at'])
            end
  starts_at = if hash.key?('starts_at')
                (DateTimeHelper.from_rfc3339(hash['starts_at']) if hash['starts_at'])
              end

  # Create object from extracted values.
  ResponseDeliveryWindow.new(ends_at,
                             starts_at)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



35
36
37
# File 'lib/new_store_api/models/response_delivery_window.rb', line 35

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_ends_atObject



61
62
63
# File 'lib/new_store_api/models/response_delivery_window.rb', line 61

def to_custom_ends_at
  DateTimeHelper.to_rfc3339(ends_at)
end

#to_custom_starts_atObject



65
66
67
# File 'lib/new_store_api/models/response_delivery_window.rb', line 65

def to_custom_starts_at
  DateTimeHelper.to_rfc3339(starts_at)
end

#to_sObject

Provides a human-readable string representation of the object.



70
71
72
73
# File 'lib/new_store_api/models/response_delivery_window.rb', line 70

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