Class: Verizon::SessionReportRequest

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

Overview

Request for obtaining a session report.

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(account_number = nil, imei = nil, start_date = SKIP, end_date = SKIP, duration_low = SKIP, duration_high = SKIP) ⇒ SessionReportRequest

Returns a new instance of SessionReportRequest.



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

def initialize( = nil, imei = nil, start_date = SKIP,
               end_date = SKIP, duration_low = SKIP, duration_high = SKIP)
  @account_number = 
  @imei = imei
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @duration_low = duration_low unless duration_low == SKIP
  @duration_high = duration_high unless duration_high == SKIP
end

Instance Attribute Details

#account_numberString

The numeric ID of the account and must include leading zeroes. This value is indentical to ‘accountName`.

Returns:

  • (String)


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

def 
  @account_number
end

#duration_highInteger

Optional filter — maximum session duration

Returns:

  • (Integer)


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

def duration_high
  @duration_high
end

#duration_lowInteger

Optional filter — minimum session duration

Returns:

  • (Integer)


35
36
37
# File 'lib/verizon/models/session_report_request.rb', line 35

def duration_low
  @duration_low
end

#end_dateString

End date of session to include. If not specified information will be shown to the latest available. Can be either date in ISO 8601 format or predefined constants.

Returns:

  • (String)


31
32
33
# File 'lib/verizon/models/session_report_request.rb', line 31

def end_date
  @end_date
end

#imeiString

The International Mobile Equipment Identifier of the device.

Returns:

  • (String)


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

def imei
  @imei
end

#start_dateString

Start date of session to include. If not specified information will be shown from the earliest available (180 days). Can be either date in ISO 8601 format or predefined constants.

Returns:

  • (String)


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

def start_date
  @start_date
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
# File 'lib/verizon/models/session_report_request.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountNumber') ? hash['accountNumber'] : nil
  imei = hash.key?('imei') ? hash['imei'] : nil
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  end_date = hash.key?('endDate') ? hash['endDate'] : SKIP
  duration_low = hash.key?('durationLow') ? hash['durationLow'] : SKIP
  duration_high = hash.key?('durationHigh') ? hash['durationHigh'] : SKIP

  # Create object from extracted values.
  SessionReportRequest.new(,
                           imei,
                           start_date,
                           end_date,
                           duration_low,
                           duration_high)
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/session_report_request.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'accountNumber'
  @_hash['imei'] = 'imei'
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash['duration_low'] = 'durationLow'
  @_hash['duration_high'] = 'durationHigh'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/verizon/models/session_report_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/session_report_request.rb', line 54

def self.optionals
  %w[
    start_date
    end_date
    duration_low
    duration_high
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/verizon/models/session_report_request.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number.inspect}, imei: #{@imei.inspect},"\
  " start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect}, duration_low:"\
  " #{@duration_low.inspect}, duration_high: #{@duration_high.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
105
# File 'lib/verizon/models/session_report_request.rb', line 100

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_number: #{@account_number}, imei: #{@imei}, start_date:"\
  " #{@start_date}, end_date: #{@end_date}, duration_low: #{@duration_low}, duration_high:"\
  " #{@duration_high}>"
end