Class: Cloudflare::KV::Namespaces
Constant Summary
Representation::WRAPPER
Instance Method Summary
collapse
Methods included from Paginate
#each, #empty?, #find_by_id
#errors, #messages, #represent, #represent_message, #result, #results, #success?, #to_hash, #to_id
Instance Method Details
#create(title, **options) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/cloudflare/kv/namespaces.rb', line 93
def create(title, **options)
payload = {title: title, **options}
Namespace.post(@resource, payload) do |resource, response|
value = response.read
result = value[:result]
metadata = response.
if id = result[:id]
resource = resource.with(path: id)
end
Namespace.new(resource, value: value, metadata: metadata)
end
end
|
#find_by_title(title) ⇒ Object
109
110
111
|
# File 'lib/cloudflare/kv/namespaces.rb', line 109
def find_by_title(title)
each.find {|namespace| namespace.title == title }
end
|
#representation ⇒ Object
89
90
91
|
# File 'lib/cloudflare/kv/namespaces.rb', line 89
def representation
Namespace
end
|