class VertexClient::Resource::Base

Public Class Methods

new(params) click to toggle source
# File lib/vertex_client/resources/base.rb, line 6
def initialize(params)
  @payload = payload_type.new(params)
end

Public Instance Methods

config_key() click to toggle source
# File lib/vertex_client/resources/base.rb, line 14
def config_key
  demodulized_class_name.underscore.to_sym
end
result() click to toggle source
# File lib/vertex_client/resources/base.rb, line 10
def result
  @result ||= (response ? formatted_response : fallback_response)
end

Private Instance Methods

connection() click to toggle source
# File lib/vertex_client/resources/base.rb, line 24
def connection
  @connection ||= Connection.new(self.class::ENDPOINT, config_key)
end
demodulized_class_name() click to toggle source
# File lib/vertex_client/resources/base.rb, line 40
def demodulized_class_name
  self.class.name.demodulize
end
formatted_response() click to toggle source
# File lib/vertex_client/resources/base.rb, line 28
def formatted_response
  response_type.new(response)
end
payload_type() click to toggle source
# File lib/vertex_client/resources/base.rb, line 32
def payload_type
  Kernel.const_get("VertexClient::Payload::#{demodulized_class_name}")
end
response() click to toggle source
# File lib/vertex_client/resources/base.rb, line 20
def response
  @response ||= connection.request(@payload.transform)
end
response_type() click to toggle source
# File lib/vertex_client/resources/base.rb, line 36
def response_type
  Kernel.const_get("VertexClient::Response::#{demodulized_class_name}")
end