Class: Fastly::Version
Overview
An iteration of your configuration
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#deployed ⇒ Object
Returns the value of attribute deployed.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#service_id ⇒ Object
Returns the value of attribute service_id.
-
#staging ⇒ Object
Returns the value of attribute staging.
-
#testing ⇒ Object
Returns the value of attribute testing.
Attributes inherited from Base
Instance Method Summary collapse
-
#activate! ⇒ Object
Activate this version.
-
#active? ⇒ Boolean
Is version active?.
-
#clone ⇒ Object
Clone this Version.
-
#deactivate! ⇒ Object
Deactivate this version.
-
#generated_vcl(opts = {}) ⇒ Object
Get the generated VCL object for this Version (which must have been activated first).
-
#locked=(is_locked) ⇒ Object
Set whether this Version is locked.
-
#locked? ⇒ Boolean
Is this Version locked.
-
#service ⇒ Object
Get the Service object this Version belongs to.
-
#settings ⇒ Object
Get the Settings object for this Version.
-
#upload_vcl(name, content) ⇒ Object
Upload a VCL file for this Version.
-
#validate ⇒ Object
Validate this Version.
-
#vcl(name, opts = {}) ⇒ Object
Get the named VCL for this version.
Methods inherited from Base
#as_hash, #delete!, #initialize, list_path, path, #save!
Constructor Details
This class inherits a constructor from Fastly::Base
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def active @active end |
#comment ⇒ Object
Returns the value of attribute comment.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def comment @comment end |
#deployed ⇒ Object
Returns the value of attribute deployed.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def deployed @deployed end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def number @number end |
#service_id ⇒ Object
Returns the value of attribute service_id.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def service_id @service_id end |
#staging ⇒ Object
Returns the value of attribute staging.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def staging @staging end |
#testing ⇒ Object
Returns the value of attribute testing.
4 5 6 |
# File 'lib/fastly/version.rb', line 4 def testing @testing end |
Instance Method Details
#activate! ⇒ Object
Activate this version
81 82 83 84 |
# File 'lib/fastly/version.rb', line 81 def activate! hash = fetcher.client.put(Fastly::Version.put_path(self)+"/activate") return !hash.nil? end |
#active? ⇒ Boolean
Is version active?
76 77 78 |
# File 'lib/fastly/version.rb', line 76 def active? return @active.to_i > 0 end |
#clone ⇒ Object
Clone this Version
93 94 95 96 97 |
# File 'lib/fastly/version.rb', line 93 def clone hash = fetcher.client.put(Fastly::Version.put_path(self)+"/clone") return nil if hash.nil? return Fastly::Version.new(hash, fetcher) end |
#deactivate! ⇒ Object
Deactivate this version
87 88 89 90 |
# File 'lib/fastly/version.rb', line 87 def deactivate! hash = fetcher.client.put(Fastly::Version.put_path(self)+"/deactivate") return !hash.nil? end |
#generated_vcl(opts = {}) ⇒ Object
Get the generated VCL object for this Version (which must have been activated first)
Won’t return the content of the VCL unless you pass in
:include_content => true
in the opts
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/fastly/version.rb', line 104 def generated_vcl(opts={}) hash = fetcher.client.get(Fastly::Version.put_path(self)+"/generated_vcl", opts) opts = { 'content' => hash['vcl'] || hash['content'], 'name' => hash['md5'], 'version' => hash['version'], 'service_id' => hash['service'] } return Fastly::VCL.new(opts, fetcher) end |
#locked=(is_locked) ⇒ Object
Set whether this Version is locked
61 62 63 |
# File 'lib/fastly/version.rb', line 61 def locked=(is_locked) @locked = is_locked ? "1" : "0" end |
#locked? ⇒ Boolean
Is this Version locked
56 57 58 |
# File 'lib/fastly/version.rb', line 56 def locked? return @locked.to_i > 0 end |
#service ⇒ Object
Get the Service object this Version belongs to
66 67 68 |
# File 'lib/fastly/version.rb', line 66 def service fetcher.get(Fastly::Service, service_id) end |
#settings ⇒ Object
Get the Settings object for this Version
71 72 73 |
# File 'lib/fastly/version.rb', line 71 def settings fetcher.get_settings(service_id, number) end |
#upload_vcl(name, content) ⇒ Object
Upload a VCL file for this Version
116 117 118 119 120 |
# File 'lib/fastly/version.rb', line 116 def upload_vcl(name, content) hash = fetcher.client.post(Fastly::Version.put_path(self)+"/vcl", :name => name, :content => content) return nil if hash.nil? return Fastly::VCL.new(hash, fetcher) end |
#validate ⇒ Object
Validate this Version
132 133 134 135 |
# File 'lib/fastly/version.rb', line 132 def validate hash = fetcher.client.get(Fastly::Version.put_path(self)+"/validate") return !hash.nil? end |
#vcl(name, opts = {}) ⇒ Object
Get the named VCL for this version
Won’t return the content of the VCL unless you pass in
:include_content => true
in the opts
127 128 129 |
# File 'lib/fastly/version.rb', line 127 def vcl(name, opts={}) fetcher.get_vcl(service_id, number, name, opts) end |