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

#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) ⇒ ProvisioningHistory

Returns a new instance of ProvisioningHistory.



78
79
80
81
82
83
84
85
86
87
88
89
# 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)
  @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
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.



92
93
94
95
96
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
# File 'lib/verizon/models/provisioning_history.rb', line 92

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 object from extracted values.
  ProvisioningHistory.new(occurred_at,
                          status,
                          event_by,
                          event_type,
                          mdn,
                          msisdn,
                          service_plan,
                          extended_attributes)
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