Class: Verizon::SmsEventHistoryRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/sms_event_history_request.rb

Overview

SmsEventHistoryRequest 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(device_id:, earliest: SKIP, latest: SKIP) ⇒ SmsEventHistoryRequest

Returns a new instance of SmsEventHistoryRequest.



47
48
49
50
51
# File 'lib/verizon/models/sms_event_history_request.rb', line 47

def initialize(device_id:, earliest: SKIP, latest: SKIP)
  @device_id = device_id
  @earliest = earliest unless earliest == SKIP
  @latest = latest unless latest == SKIP
end

Instance Attribute Details

#device_idGioDeviceId

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/verizon/models/sms_event_history_request.rb', line 15

def device_id
  @device_id
end

#earliestDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


19
20
21
# File 'lib/verizon/models/sms_event_history_request.rb', line 19

def earliest
  @earliest
end

#latestDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


23
24
25
# File 'lib/verizon/models/sms_event_history_request.rb', line 23

def latest
  @latest
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/verizon/models/sms_event_history_request.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = GioDeviceId.from_hash(hash['deviceId']) if hash['deviceId']
  earliest = if hash.key?('earliest')
               (DateTimeHelper.from_rfc3339(hash['earliest']) if hash['earliest'])
             else
               SKIP
             end
  latest = if hash.key?('latest')
             (DateTimeHelper.from_rfc3339(hash['latest']) if hash['latest'])
           else
             SKIP
           end

  # Create object from extracted values.
  SmsEventHistoryRequest.new(device_id: device_id,
                             earliest: earliest,
                             latest: latest)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/verizon/models/sms_event_history_request.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['earliest'] = 'earliest'
  @_hash['latest'] = 'latest'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/verizon/models/sms_event_history_request.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
# File 'lib/verizon/models/sms_event_history_request.rb', line 35

def self.optionals
  %w[
    earliest
    latest
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/verizon/models/sms_event_history_request.rb', line 91

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

#to_custom_earliestObject



76
77
78
# File 'lib/verizon/models/sms_event_history_request.rb', line 76

def to_custom_earliest
  DateTimeHelper.to_rfc3339(earliest)
end

#to_custom_latestObject



80
81
82
# File 'lib/verizon/models/sms_event_history_request.rb', line 80

def to_custom_latest
  DateTimeHelper.to_rfc3339(latest)
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
# File 'lib/verizon/models/sms_event_history_request.rb', line 85

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