Class: Cloudflare::Representation
- Inherits:
-
Async::REST::Representation
- Object
- Async::REST::Representation
- Cloudflare::Representation
show all
- Defined in:
- lib/cloudflare/representation.rb
Direct Known Subclasses
Account, Accounts, CustomHostname, CustomHostnames, DNS::Record, DNS::Records, Firewall::Rule, Firewall::Rules, KV::Key, KV::Keys, KV::Namespace, KV::Namespaces, Logs::Entry, Logs::Received, User, Zone, Zones
Constant Summary
collapse
- WRAPPER =
Wrapper.new
Instance Method Summary
collapse
Instance Method Details
#errors ⇒ Object
75
76
77
|
# File 'lib/cloudflare/representation.rb', line 75
def errors
value[:errors]
end
|
#messages ⇒ Object
79
80
81
|
# File 'lib/cloudflare/representation.rb', line 79
def messages
value[:messages]
end
|
#represent(metadata, attributes) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/cloudflare/representation.rb', line 47
def represent(metadata, attributes)
resource = @resource.with(path: attributes[:id])
representation.new(resource, metadata: metadata, value: {
success: true, result: attributes
})
end
|
#represent_message(message) ⇒ Object
55
56
57
|
# File 'lib/cloudflare/representation.rb', line 55
def represent_message(message)
represent(message., message.result)
end
|
#representation ⇒ Object
43
44
45
|
# File 'lib/cloudflare/representation.rb', line 43
def representation
Representation
end
|
#result ⇒ Object
59
60
61
|
# File 'lib/cloudflare/representation.rb', line 59
def result
value[:result]
end
|
#results ⇒ Object
71
72
73
|
# File 'lib/cloudflare/representation.rb', line 71
def results
Array(result)
end
|
#success? ⇒ Boolean
83
84
85
|
# File 'lib/cloudflare/representation.rb', line 83
def success?
value[:success]
end
|
#to_hash ⇒ Object
63
64
65
|
# File 'lib/cloudflare/representation.rb', line 63
def to_hash
result
end
|
#to_id ⇒ Object
67
68
69
|
# File 'lib/cloudflare/representation.rb', line 67
def to_id
{id: result[:id]}
end
|