Class: Cloudflare::Representation

Inherits:
Async::REST::Representation
  • Object
show all
Defined in:
lib/cloudflare/representation.rb

Instance Method Summary collapse

Instance Method Details

#process_responseObject



81
82
83
84
85
86
87
88
89
# File 'lib/cloudflare/representation.rb', line 81

def process_response(*)
	message = Message.new(super)

	unless message.success?
		raise RequestError.new(@resource, message.errors)
	end

	return message
end

#represent(metadata, attributes) ⇒ Object



95
96
97
98
99
# File 'lib/cloudflare/representation.rb', line 95

def represent(, attributes)
	resource = @resource.with(path: attributes[:id])

	representation.new(resource, metadata: , value: attributes)
end

#represent_message(message) ⇒ Object



101
102
103
# File 'lib/cloudflare/representation.rb', line 101

def represent_message(message)
	represent(message.headers, message.result)
end

#representationObject



91
92
93
# File 'lib/cloudflare/representation.rb', line 91

def representation
	Representation
end

#to_hashObject



105
106
107
108
109
# File 'lib/cloudflare/representation.rb', line 105

def to_hash
	if value.is_a?(Hash)
		return value
	end
end