Class: Verizon::ConnectivityManagementCallback

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

Overview

Includes callback listeners that were registered through the Connectivity Management API.

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_name: SKIP, password: SKIP, service_name: SKIP, url: SKIP, username: SKIP, additional_properties: nil) ⇒ ConnectivityManagementCallback

Returns a new instance of ConnectivityManagementCallback.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/verizon/models/connectivity_management_callback.rb', line 64

def initialize(account_name: SKIP, password: SKIP, service_name: SKIP,
               url: SKIP, username: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_name =  unless  == SKIP
  @password = password unless password == SKIP
  @service_name = service_name unless service_name == SKIP
  @url = url unless url == SKIP
  @username = username unless username == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The name of the billing account for which callback messages will be sent.

Returns:

  • (String)


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

def 
  @account_name
end

#passwordString

The password defined when a URL was registered for the callback service, or an empty string if no password was defined.

Returns:

  • (String)


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

def password
  @password
end

#service_nameString

The name of the callback service, which identifies the type and format of messages that will be sent to the registered URL.

Returns:

  • (String)


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

def service_name
  @service_name
end

#urlString

The address of the callback listening service where the ThingSpace Platform will send callback messages for the service type.

Returns:

  • (String)


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

def url
  @url
end

#usernameString

The username defined when a URL was registered for the callback service, or an empty string if no username was defined.

Returns:

  • (String)


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

def username
  @username
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/verizon/models/connectivity_management_callback.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  password = hash.key?('password') ? hash['password'] : SKIP
  service_name = hash.key?('serviceName') ? hash['serviceName'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  username = hash.key?('username') ? hash['username'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ConnectivityManagementCallback.new(account_name: ,
                                     password: password,
                                     service_name: service_name,
                                     url: url,
                                     username: username,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
# File 'lib/verizon/models/connectivity_management_callback.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['password'] = 'password'
  @_hash['service_name'] = 'serviceName'
  @_hash['url'] = 'url'
  @_hash['username'] = 'username'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/verizon/models/connectivity_management_callback.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
# File 'lib/verizon/models/connectivity_management_callback.rb', line 49

def self.optionals
  %w[
    account_name
    password
    service_name
    url
    username
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/verizon/models/connectivity_management_callback.rb', line 113

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, password: #{@password.inspect},"\
  " service_name: #{@service_name.inspect}, url: #{@url.inspect}, username:"\
  " #{@username.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
110
# File 'lib/verizon/models/connectivity_management_callback.rb', line 105

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, password: #{@password}, service_name:"\
  " #{@service_name}, url: #{@url}, username: #{@username}, additional_properties:"\
  " #{@additional_properties}>"
end