Class: Fog::Rackspace::CDNV2::Service
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::CDNV2::Service
- Defined in:
- lib/fog/rackspace/models/cdn_v2/service.rb
Constant Summary collapse
- UUID_REGEX =
/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
Instance Attribute Summary collapse
-
#operations ⇒ Object
Returns the value of attribute operations.
Instance Method Summary collapse
- #add_domain(domain, options = {}) ⇒ Object
- #add_operation(options = {}) ⇒ Object
- #add_origin(origin, options = {}) ⇒ Object
- #destroy ⇒ Object
- #destroy_assets(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Service
constructor
A new instance of Service.
- #save ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Service
Returns a new instance of Service.
23 24 25 26 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 23 def initialize(={}) self.operations = [] super end |
Instance Attribute Details
#operations ⇒ Object
Returns the value of attribute operations.
8 9 10 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 8 def operations @operations end |
Instance Method Details
#add_domain(domain, options = {}) ⇒ Object
28 29 30 31 32 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 28 def add_domain(domain, ={}) self.domains ||= [] self.domains << {domain: domain}.merge() self.domains end |
#add_operation(options = {}) ⇒ Object
40 41 42 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 40 def add_operation(={}) self.operations << end |
#add_origin(origin, options = {}) ⇒ Object
34 35 36 37 38 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 34 def add_origin(origin, ={}) self.origins ||= [] self.origins << {origin: origin}.merge() self.origins end |
#destroy ⇒ Object
55 56 57 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 55 def destroy service.delete_service(self) end |
#destroy_assets(options = {}) ⇒ Object
59 60 61 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 59 def destroy_assets(={}) service.delete_assets(self, ) end |
#save ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/rackspace/models/cdn_v2/service.rb', line 44 def save if id.nil? data = service.create_service(self) loc = data.headers["Location"] id = UUID_REGEX.match(loc)[0] merge_attributes(id: id) else service.update_service(self) end end |