Class: Verizon::DeviceAggregateUsageListRequest

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

Overview

Request to list device aggregate usage.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(start_time = nil, end_time = nil, device_ids = SKIP, account_name = SKIP, group_name = SKIP, label = SKIP) ⇒ DeviceAggregateUsageListRequest

Returns a new instance of DeviceAggregateUsageListRequest.



68
69
70
71
72
73
74
75
76
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 68

def initialize(start_time = nil, end_time = nil, device_ids = SKIP,
                = SKIP, group_name = SKIP, label = SKIP)
  @start_time = start_time
  @end_time = end_time
  @device_ids = device_ids unless device_ids == SKIP
  @account_name =  unless  == SKIP
  @group_name = group_name unless group_name == SKIP
  @label = label unless label == SKIP
end

Instance Attribute Details

#account_nameString

The name of a billing account.

Returns:

  • (String)


29
30
31
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 29

def 
  @account_name
end

#device_idsArray[DeviceId]

One or more devices for which you want aggregate data, specified by device ID.

Returns:



25
26
27
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 25

def device_ids
  @device_ids
end

#end_timeString

The end of the reporting period. The endTime date must be within on month of the startTime date.

Returns:

  • (String)


20
21
22
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 20

def end_time
  @end_time
end

#group_nameString

The name of a device group, if you want to only include devices in that group.

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 34

def group_name
  @group_name
end

#labelArray[Label]

The name of a device group, if you want to only include devices in that group.

Returns:



39
40
41
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 39

def label
  @label
end

#start_timeString

The beginning of the reporting period. The startTime cannot be more than 6 months before the current date.

Returns:

  • (String)


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

def start_time
  @start_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  start_time = hash.key?('startTime') ? hash['startTime'] : nil
  end_time = hash.key?('endTime') ? hash['endTime'] : nil
  # Parameter is an array, so we need to iterate through it
  device_ids = nil
  unless hash['deviceIds'].nil?
    device_ids = []
    hash['deviceIds'].each do |structure|
      device_ids << (DeviceId.from_hash(structure) if structure)
    end
  end

  device_ids = SKIP unless hash.key?('deviceIds')
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  group_name = hash.key?('groupName') ? hash['groupName'] : SKIP
  # Parameter is an array, so we need to iterate through it
  label = nil
  unless hash['label'].nil?
    label = []
    hash['label'].each do |structure|
      label << (Label.from_hash(structure) if structure)
    end
  end

  label = SKIP unless hash.key?('label')

  # Create object from extracted values.
  DeviceAggregateUsageListRequest.new(start_time,
                                      end_time,
                                      device_ids,
                                      ,
                                      group_name,
                                      label)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_time'] = 'startTime'
  @_hash['end_time'] = 'endTime'
  @_hash['device_ids'] = 'deviceIds'
  @_hash['account_name'] = 'accountName'
  @_hash['group_name'] = 'groupName'
  @_hash['label'] = 'label'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/verizon/models/device_aggregate_usage_list_request.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    device_ids
    account_name
    group_name
    label
  ]
end