Class: CloudflareClient::Zone::CustomPage

Inherits:
Base show all
Defined in:
lib/cloudflare_client/zone/custom_page.rb

Constant Summary

Constants inherited from CloudflareClient::Zone

VALID_ZONE_STATUSES

Constants inherited from CloudflareClient

API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION

Instance Attribute Summary

Attributes inherited from Base

#zone_id

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from CloudflareClient::Zone

#create_zone, #delete_zone, #edit_zone, #purge_zone_cache, #update_zone_settings, #zone, #zone_activation_check, #zone_setting, #zone_settings, #zones

Methods inherited from CloudflareClient

#initialize

Constructor Details

This class inherits a constructor from CloudflareClient::Zone::Base

Instance Method Details

#listObject

Custom pages for a zone

custom_pages list all avaialble custom_pages



6
7
8
# File 'lib/cloudflare_client/zone/custom_page.rb', line 6

def list
  cf_get(path: "/zones/#{zone_id}/custom_pages")
end

#show(id:) ⇒ Object

custom_page details



12
13
14
15
# File 'lib/cloudflare_client/zone/custom_page.rb', line 12

def show(id:)
  raise 'id must not be nil' if id.nil?
  cf_get(path: "/zones/#{zone_id}/custom_pages/#{id}")
end

#update(id:, url:, state:) ⇒ Object

update_custom_page



19
20
21
22
23
24
25
26
27
# File 'lib/cloudflare_client/zone/custom_page.rb', line 19

def update(id:, url:, state:)
  id_check('id', id)
  id_check('url', url)
  raise 'state must be either default | customized' unless %w[default customized].include?(state)

  data = {url: url, state: state}

  cf_put(path: "/zones/#{zone_id}/custom_pages/#{id}", data: data)
end