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

#to_hash, #to_json

Constructor Details

#initialize(device_id = nil, earliest = SKIP, latest = SKIP) ⇒ SMSEventHistoryRequest

Returns a new instance of SMSEventHistoryRequest.



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

def initialize(device_id = nil,
               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.



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

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,
                             earliest,
                             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

#to_custom_earliestObject



78
79
80
# File 'lib/verizon/models/sms_event_history_request.rb', line 78

def to_custom_earliest
  DateTimeHelper.to_rfc3339(earliest)
end

#to_custom_latestObject



82
83
84
# File 'lib/verizon/models/sms_event_history_request.rb', line 82

def to_custom_latest
  DateTimeHelper.to_rfc3339(latest)
end