Class: Bunny::PullZone

Inherits:
Object
  • Object
show all
Defined in:
lib/bunny/models/pull_zone.rb

Class Method Summary collapse

Methods inherited from Object

#camel_to_snake, #initialize, #to_ostruct

Constructor Details

This class inherits a constructor from Bunny::Object

Class Method Details

.create(name:, **attributes) ⇒ Object



9
10
11
12
# File 'lib/bunny/models/pull_zone.rb', line 9

def create(name:, **attributes)
  response = Client.post_request("pullzone", body: attributes.merge(name: name))
  PullZone.new(response.body)
end

.delete(id:) ⇒ Object



24
25
26
# File 'lib/bunny/models/pull_zone.rb', line 24

def delete(id:)
  Client.delete_request("pullzone/#{id}")
end

.listObject



4
5
6
7
# File 'lib/bunny/models/pull_zone.rb', line 4

def list
  response = Client.get_request("pullzone")
  Collection.from_response(response, type: PullZone)
end

.purge(id:) ⇒ Object



28
29
30
# File 'lib/bunny/models/pull_zone.rb', line 28

def purge(id:)
  Client.post_request("pullzone/#{id}/purgeCache", body: {})
end

.retrieve(id:) ⇒ Object



14
15
16
17
# File 'lib/bunny/models/pull_zone.rb', line 14

def retrieve(id:)
  response = Client.get_request("pullzone/#{id}")
  PullZone.new(response.body)
end

.update(id:, **attributes) ⇒ Object



19
20
21
22
# File 'lib/bunny/models/pull_zone.rb', line 19

def update(id:, **attributes)
  response = Client.post_request("pullzone/#{id}", body: attributes)
  PullZone.new(response.body)
end