Class: Verizon::LogInRequest

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

Overview

Request to initiate a Connectivity Management session and returns a VZ-M2M session token that is required in subsequent API requests.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(username = nil, password = nil) ⇒ LogInRequest

Returns a new instance of LogInRequest.



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

def initialize(username = nil, password = nil)
  @username = username
  @password = password
end

Instance Attribute Details

#passwordString

The password for authentication.

Returns:

  • (String)


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

def password
  @password
end

#usernameString

The username for authentication.

Returns:

  • (String)


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

def username
  @username
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/verizon/models/log_in_request.rb', line 45

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  username = hash.key?('username') ? hash['username'] : nil
  password = hash.key?('password') ? hash['password'] : nil

  # Create object from extracted values.
  LogInRequest.new(username,
                   password)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/verizon/models/log_in_request.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['username'] = 'username'
  @_hash['password'] = 'password'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
# File 'lib/verizon/models/log_in_request.rb', line 30

def self.optionals
  []
end