Class: Verizon::ProvhistoryRequest

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

Overview

ProvhistoryRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = SKIP, device_filter = SKIP, earliest = SKIP, latest = SKIP) ⇒ ProvhistoryRequest

Returns a new instance of ProvhistoryRequest.



54
55
56
57
58
59
60
# File 'lib/verizon/models/provhistory_request.rb', line 54

def initialize( = SKIP, device_filter = SKIP, earliest = SKIP,
               latest = SKIP)
  @account_name =  unless  == SKIP
  @device_filter = device_filter unless device_filter == SKIP
  @earliest = earliest unless earliest == SKIP
  @latest = latest unless latest == SKIP
end

Instance Attribute Details

#account_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def 
  @account_name
end

#device_filterArray[GIODeviceId]

TODO: Write general description for this method

Returns:



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

def device_filter
  @device_filter
end

#earliestDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def earliest
  @earliest
end

#latestDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


27
28
29
# File 'lib/verizon/models/provhistory_request.rb', line 27

def latest
  @latest
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/verizon/models/provhistory_request.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  # Parameter is an array, so we need to iterate through it
  device_filter = nil
  unless hash['deviceFilter'].nil?
    device_filter = []
    hash['deviceFilter'].each do |structure|
      device_filter << (GIODeviceId.from_hash(structure) if structure)
    end
  end

  device_filter = SKIP unless hash.key?('deviceFilter')
  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.
  ProvhistoryRequest.new(,
                         device_filter,
                         earliest,
                         latest)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/verizon/models/provhistory_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['device_filter'] = 'deviceFilter'
  @_hash['earliest'] = 'earliest'
  @_hash['latest'] = 'latest'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/verizon/models/provhistory_request.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/verizon/models/provhistory_request.rb', line 40

def self.optionals
  %w[
    account_name
    device_filter
    earliest
    latest
  ]
end

Instance Method Details

#to_custom_earliestObject



96
97
98
# File 'lib/verizon/models/provhistory_request.rb', line 96

def to_custom_earliest
  DateTimeHelper.to_rfc3339(earliest)
end

#to_custom_latestObject



100
101
102
# File 'lib/verizon/models/provhistory_request.rb', line 100

def to_custom_latest
  DateTimeHelper.to_rfc3339(latest)
end