Class: CloudflareClient::Organization::Railgun
- Inherits:
-
CloudflareClient::Organization
- Object
- CloudflareClient
- CloudflareClient::Organization
- CloudflareClient::Organization::Railgun
- Defined in:
- lib/cloudflare_client/organization/railgun.rb
Constant Summary
Constants inherited from CloudflareClient
API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION
Instance Attribute Summary
Attributes inherited from CloudflareClient::Organization
Instance Method Summary collapse
-
#create(name:) ⇒ Object
list railguns.
-
#delete(id:) ⇒ Object
delete an org railgun.
-
#disable(id:) ⇒ Object
disable a railgun.
-
#enable(id:) ⇒ Object
enable a railgun.
-
#list(page: 1, per_page: 50, direction: 'desc') ⇒ Object
list railguns.
-
#show(id:) ⇒ Object
show railgun details.
-
#zones(id:) ⇒ Object
get zones connected to a given railgun.
Methods inherited from CloudflareClient::Organization
Methods inherited from CloudflareClient
Constructor Details
This class inherits a constructor from CloudflareClient::Organization
Instance Method Details
#create(name:) ⇒ Object
list railguns
7 8 9 10 11 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 7 def create(name:) id_check('name', name) data = {name: name} cf_post(path: "/organizations/#{org_id}/railguns", data: data) end |
#delete(id:) ⇒ Object
delete an org railgun
66 67 68 69 70 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 66 def delete(id:) id_check(:id, id) cf_delete(path: "/organizations/#{org_id}/railguns/#{id}") end |
#disable(id:) ⇒ Object
disable a railgun
60 61 62 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 60 def disable(id:) update_enabled(id: id, enabled: false) end |
#enable(id:) ⇒ Object
enable a railgun
54 55 56 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 54 def enable(id:) update_enabled(id: id, enabled: true) end |
#list(page: 1, per_page: 50, direction: 'desc') ⇒ Object
list railguns
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 15 def list(page: 1, per_page: 50, direction: 'desc') params = {} unless direction.nil? valid_value_check(:direction, direction, VALID_DIRECTIONS) params[:direction] = direction end unless page.nil? range_check(:page, page, 1) params[:page] = page end unless per_page.nil? range_check(:per_page, per_page, 5, 50) params[:per_page] = per_page end cf_get(path: "/organizations/#{org_id}/railguns", params: params) end |
#show(id:) ⇒ Object
show railgun details
38 39 40 41 42 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 38 def show(id:) id_check(:id, id) cf_get(path: "/organizations/#{org_id}/railguns/#{id}") end |
#zones(id:) ⇒ Object
get zones connected to a given railgun
46 47 48 49 50 |
# File 'lib/cloudflare_client/organization/railgun.rb', line 46 def zones(id:) id_check(:id, id) cf_get(path: "/organizations/#{org_id}/railguns/#{id}/zones") end |