Class: Cloudflare::Zones

Inherits:
Representation show all
Includes:
Paginate
Defined in:
lib/cloudflare/zones.rb

Constant Summary

Constants inherited from Representation

Representation::WRAPPER

Instance Method Summary collapse

Methods included from Paginate

#each, #empty?, #find_by_id

Methods inherited from Representation

#errors, #messages, #represent, #represent_message, #result, #results, #success?, #to_hash, #to_id

Instance Method Details

#create(name, account, jump_start: false, **options) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cloudflare/zones.rb', line 69

def create(name, , jump_start: false, **options)
	payload = {name: name, account: .to_id, jump_start: jump_start, **options}
	
	Zone.post(@resource, payload) do |resource, response|
		value = response.read
		result = value[:result]
		 = response.headers
		
		if id = result[:id]
			resource = resource.with(path: id)
		end
		
		Zone.new(resource, value: value, metadata: )
	end
end

#find_by_name(name) ⇒ Object



85
86
87
# File 'lib/cloudflare/zones.rb', line 85

def find_by_name(name)
	each(name: name).find{|zone| zone.name == name}
end

#representationObject



65
66
67
# File 'lib/cloudflare/zones.rb', line 65

def representation
	Zone
end