Class: Cloudflair::PurgeCache
- Inherits:
-
Object
- Object
- Cloudflair::PurgeCache
- Includes:
- Communication
- Defined in:
- lib/cloudflair/api/zone/purge_cache.rb
Instance Attribute Summary collapse
-
#zone_id ⇒ Object
readonly
Returns the value of attribute zone_id.
Instance Method Summary collapse
- #everything(purge_everything) ⇒ Object
-
#initialize(zone_id) ⇒ PurgeCache
constructor
A new instance of PurgeCache.
- #path ⇒ Object
- #selective(cache_identifier = {}) ⇒ Object
Methods included from Communication
#connection, #hash_to_object, #response
Constructor Details
#initialize(zone_id) ⇒ PurgeCache
Returns a new instance of PurgeCache.
11 12 13 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 11 def initialize(zone_id) @zone_id = zone_id end |
Instance Attribute Details
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
7 8 9 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 7 def zone_id @zone_id end |
Instance Method Details
#everything(purge_everything) ⇒ Object
17 18 19 20 21 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 17 def everything(purge_everything) resp = connection.post(path) { |req| req.body = { purge_everything: purge_everything } } response resp self end |
#path ⇒ Object
33 34 35 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 33 def path "zones/#{zone_id}/purge_cache" end |
#selective(cache_identifier = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 25 def selective(cache_identifier = {}) return self if cache_identifier.nil? || cache_identifier.empty? resp = connection.post(path) { |req| req.body = cache_identifier } response resp self end |