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.
9 10 11 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 9 def initialize(zone_id) @zone_id = zone_id end |
Instance Attribute Details
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
5 6 7 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 5 def zone_id @zone_id end |
Instance Method Details
#everything(purge_everything) ⇒ Object
15 16 17 18 19 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 15 def everything(purge_everything) resp = connection.post(path) { |req| req.body = { purge_everything: purge_everything } } response resp self end |
#path ⇒ Object
31 32 33 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 31 def path "zones/#{zone_id}/purge_cache" end |
#selective(cache_identifier = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cloudflair/api/zone/purge_cache.rb', line 23 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 |