Class: SoftLayer::NetworkMessageDelivery

Inherits:
ModelBase
  • Object
show all
Includes:
DynamicAttribute
Defined in:
lib/softlayer/NetworkMessageDelivery.rb

Overview

Each SoftLayer NetworkMessageDelivery instance provides information about the username/password combination for a specific Network Message Delivery account.

This class roughly corresponds to the entity SoftLayer_Network_Message_Delivery in the API.

Instance Attribute Summary

Attributes inherited from ModelBase

#softlayer_client

Instance Method Summary collapse

Methods included from DynamicAttribute

included

Methods inherited from ModelBase

#[], #has_sl_property?, #initialize, #refresh_details, sl_attr, #to_ary

Constructor Details

This class inherits a constructor from SoftLayer::ModelBase

Instance Method Details

#createdObject

:attr_reader: The date this username/password pair was created.


22
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 22

sl_attr :created,  'createDate'

#descriptionObject

The message delivery type description of a network message delivery account.


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 41

sl_dynamic_attr :description do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @description == nil
  end

  resource.to_update do
    type = self.service.getType
    type['description']
  end
end

#modifiedObject

:attr_reader: The date of the last modification to this username/password pair.


27
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 27

sl_attr :modified, 'modifyDate'

#nameObject

The message delivery type name of a network message delivery account.


55
56
57
58
59
60
61
62
63
64
65
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 55

sl_dynamic_attr :name do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @name == nil
  end

  resource.to_update do
    type = self.service.getType
    type['name']
  end
end

#passwordObject

:attr_reader: The password part of the username/password pair.


32
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 32

sl_attr :password

#password=(password) ⇒ Object

Updates the password for the current account password.

Raises:

  • (ArgumentError)

84
85
86
87
88
89
90
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 84

def password=(password)
  raise ArgumentError, "The new password cannot be nil"   unless password
  raise ArgumentError, "The new password cannot be empty" if password.empty?

  self.service.editObject({ "password" => password.to_s })
  self.refresh_details()
end

#serviceObject

Returns the service for interacting with the network message delivery instance through the network API


96
97
98
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 96

def service
  softlayer_client[:Network_Message_Delivery].object_with_id(self.id)
end

#softlayer_properties(object_mask = nil) ⇒ Object

Make an API request to SoftLayer and return the latest properties hash for this object.


104
105
106
107
108
109
110
111
112
113
114
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 104

def softlayer_properties(object_mask = nil)
  my_service = self.service

  if(object_mask)
    my_service = my_service.object_mask(object_mask)
  else
    my_service = my_service.object_mask(self.class.default_object_mask)
  end

  my_service.getObject()
end

#usernameObject

:attr_reader: The username part of the username/password pair.


37
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 37

sl_attr :username

#vendorObject

The vendor name for a network message delivery account.


69
70
71
72
73
74
75
76
77
78
79
# File 'lib/softlayer/NetworkMessageDelivery.rb', line 69

sl_dynamic_attr :vendor do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @vendor == nil
  end

  resource.to_update do
    vendor = self.service.getVendor
    vendor['name']
  end
end