Class: Verizon::ProvisioningHistory

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

Overview

The provisioning history of a specified device during a specified time period.

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(occurred_at: SKIP, status: SKIP, event_by: SKIP, event_type: SKIP, mdn: SKIP, msisdn: SKIP, service_plan: SKIP, extended_attributes: SKIP, additional_properties: nil) ⇒ ProvisioningHistory

Returns a new instance of ProvisioningHistory.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/verizon/models/provisioning_history.rb', line 78

def initialize(occurred_at: SKIP, status: SKIP, event_by: SKIP,
               event_type: SKIP, mdn: SKIP, msisdn: SKIP,
               service_plan: SKIP, extended_attributes: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @occurred_at = occurred_at unless occurred_at == SKIP
  @status = status unless status == SKIP
  @event_by = event_by unless event_by == SKIP
  @event_type = event_type unless event_type == SKIP
  @mdn = mdn unless mdn == SKIP
  @msisdn = msisdn unless msisdn == SKIP
  @service_plan = service_plan unless service_plan == SKIP
  @extended_attributes = extended_attributes unless extended_attributes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#event_byString

The user who performed the provisioning event.

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/provisioning_history.rb', line 23

def event_by
  @event_by
end

#event_typeString

The provisioning action:Activate,Suspend,Restore,Deactivate,Device Move.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/provisioning_history.rb', line 27

def event_type
  @event_type
end

#extended_attributesArray[CustomFields]

Any extended attributes for the event, as Key and Value pairs.

Returns:



43
44
45
# File 'lib/verizon/models/provisioning_history.rb', line 43

def extended_attributes
  @extended_attributes
end

#mdnString

The MDN assigned to the device after the provisioning event.

Returns:

  • (String)


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

def mdn
  @mdn
end

#msisdnString

The MSISDN assigned to the device after the provisioning event.

Returns:

  • (String)


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

def msisdn
  @msisdn
end

#occurred_atString

The date and time when the provisioning event occured.

Returns:

  • (String)


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

def occurred_at
  @occurred_at
end

#service_planString

The service plan of the device after the provisioning event occurred.

Returns:

  • (String)


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

def service_plan
  @service_plan
end

#statusString

The success or failure of the provisioning event.

Returns:

  • (String)


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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/verizon/models/provisioning_history.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  occurred_at = hash.key?('occurredAt') ? hash['occurredAt'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  event_by = hash.key?('eventBy') ? hash['eventBy'] : SKIP
  event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
  mdn = hash.key?('mdn') ? hash['mdn'] : SKIP
  msisdn = hash.key?('msisdn') ? hash['msisdn'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP
  # Parameter is an array, so we need to iterate through it
  extended_attributes = nil
  unless hash['extendedAttributes'].nil?
    extended_attributes = []
    hash['extendedAttributes'].each do |structure|
      extended_attributes << (CustomFields.from_hash(structure) if structure)
    end
  end

  extended_attributes = SKIP unless hash.key?('extendedAttributes')

  # 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.
  ProvisioningHistory.new(occurred_at: occurred_at,
                          status: status,
                          event_by: event_by,
                          event_type: event_type,
                          mdn: mdn,
                          msisdn: msisdn,
                          service_plan: service_plan,
                          extended_attributes: extended_attributes,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['occurred_at'] = 'occurredAt'
  @_hash['status'] = 'status'
  @_hash['event_by'] = 'eventBy'
  @_hash['event_type'] = 'eventType'
  @_hash['mdn'] = 'mdn'
  @_hash['msisdn'] = 'msisdn'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['extended_attributes'] = 'extendedAttributes'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/verizon/models/provisioning_history.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/verizon/models/provisioning_history.rb', line 60

def self.optionals
  %w[
    occurred_at
    status
    event_by
    event_type
    mdn
    msisdn
    service_plan
    extended_attributes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
# File 'lib/verizon/models/provisioning_history.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} occurred_at: #{@occurred_at.inspect}, status: #{@status.inspect}, event_by:"\
  " #{@event_by.inspect}, event_type: #{@event_type.inspect}, mdn: #{@mdn.inspect}, msisdn:"\
  " #{@msisdn.inspect}, service_plan: #{@service_plan.inspect}, extended_attributes:"\
  " #{@extended_attributes.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/verizon/models/provisioning_history.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} occurred_at: #{@occurred_at}, status: #{@status}, event_by: #{@event_by},"\
  " event_type: #{@event_type}, mdn: #{@mdn}, msisdn: #{@msisdn}, service_plan:"\
  " #{@service_plan}, extended_attributes: #{@extended_attributes}, additional_properties:"\
  " #{@additional_properties}>"
end