Class: Verizon::DeviceUsageListRequest

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

Overview

Request to return the daily network data usage of a single device during a specified time period.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

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

Returns a new instance of DeviceUsageListRequest.



52
53
54
55
56
57
# File 'lib/verizon/models/device_usage_list_request.rb', line 52

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

Instance Attribute Details

#device_idDeviceId

An identifier for a single device.

Returns:



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

def device_id
  @device_id
end

#earliestString

The earliest date for which you want usage data.

Returns:

  • (String)


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

def earliest
  @earliest
end

#labelLabel

An identifier for a single device.

Returns:



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

def label
  @label
end

#latestString

The last date for which you want usage data.

Returns:

  • (String)


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

def latest
  @latest
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/verizon/models/device_usage_list_request.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  earliest = hash.key?('earliest') ? hash['earliest'] : nil
  latest = hash.key?('latest') ? hash['latest'] : nil
  device_id = DeviceId.from_hash(hash['deviceId']) if hash['deviceId']
  label = Label.from_hash(hash['label']) if hash['label']

  # Create object from extracted values.
  DeviceUsageListRequest.new(earliest,
                             latest,
                             device_id,
                             label)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/verizon/models/device_usage_list_request.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    device_id
    label
  ]
end