Class: Fog::Rackspace::AutoScale::Webhook
- Defined in:
- lib/fog/rackspace/models/auto_scale/webhook.rb
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The policy id (i.e. parent).
-
#links ⇒ Array
readonly
The webhook links.
-
#metadata ⇒ Hash
readonly
The metadata.
-
#name ⇒ String
readonly
The webhook name.
Attributes inherited from Model
Instance Method Summary collapse
-
#destroy ⇒ Boolean
Returns true if webhook has started deleting.
-
#execution_url ⇒ String
Retrieves the URL for anonymously executing the policy webhook.
-
#save ⇒ Boolean
Creates webhook * requires attribute: :name.
-
#update ⇒ Boolean
Returns true if webhook has started updating.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#id ⇒ String (readonly)
Returns The policy id (i.e. parent).
|
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 8
|
#links ⇒ Array (readonly)
Returns The webhook links.
30 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 30 attribute :links |
#metadata ⇒ Hash (readonly)
Returns The metadata.
26 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 26 attribute :metadata |
#name ⇒ String (readonly)
Returns The webhook name.
|
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 20
|
Instance Method Details
#destroy ⇒ Boolean
Returns true if webhook has started deleting
88 89 90 91 92 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 88 def destroy requires :identity service.delete_webhook(group_id, policy_id, identity) true end |
#execution_url ⇒ String
Retrieves the URL for anonymously executing the policy webhook
96 97 98 99 100 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 96 def execution_url requires :links link = links.find { |l| l['rel'] == 'capability' } link['href'] rescue nil end |
#save ⇒ Boolean
Creates webhook
-
requires attribute: :name
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 44 def save requires :name = {} ['name'] = name if name ['metadata'] = if data = service.create_webhook(group_id, policy_id, ) merge_attributes(data.body['webhooks'][0]) true end |
#update ⇒ Boolean
Returns true if webhook has started updating
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 66 def update requires :identity = { 'name' => name, 'metadata' => } data = service.update_webhook(group_id, policy_id, identity, ) merge_attributes(data.body) end |