Class: Verizon::DeviceDiagnosticsCallback

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

Overview

Callback information of an existing diagnostics subscription.

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:, service_name:, endpoint:, created_on:, http_headers: SKIP, additional_properties: nil) ⇒ DeviceDiagnosticsCallback

Returns a new instance of DeviceDiagnosticsCallback.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 58

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

  @account_name = 
  @service_name = service_name
  @endpoint = endpoint
  @created_on = created_on
  @http_headers = http_headers unless http_headers == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The name of the billing account for which callback messages will be sent. Format: “##########-#####”.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 16

def 
  @account_name
end

#created_onDateTime

The date and time of when this request was created.

Returns:

  • (DateTime)


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

def created_on
  @created_on
end

#endpointString

The URL for your web server.

Returns:

  • (String)


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

def endpoint
  @endpoint
end

#http_headersObject

Your HTTP headers.

Returns:

  • (Object)


33
34
35
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 33

def http_headers
  @http_headers
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)


21
22
23
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 21

def service_name
  @service_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  service_name = hash.key?('serviceName') ? hash['serviceName'] : nil
  endpoint = hash.key?('endpoint') ? hash['endpoint'] : nil
  created_on = if hash.key?('createdOn')
                 (DateTimeHelper.from_rfc3339(hash['createdOn']) if hash['createdOn'])
               end
  http_headers = hash.key?('httpHeaders') ? hash['httpHeaders'] : 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.
  DeviceDiagnosticsCallback.new(account_name: ,
                                service_name: service_name,
                                endpoint: endpoint,
                                created_on: created_on,
                                http_headers: http_headers,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['service_name'] = 'serviceName'
  @_hash['endpoint'] = 'endpoint'
  @_hash['created_on'] = 'createdOn'
  @_hash['http_headers'] = 'httpHeaders'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 47

def self.optionals
  %w[
    http_headers
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_created_onObject



100
101
102
# File 'lib/verizon/models/device_diagnostics_callback.rb', line 100

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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