Sha256: 0b1cec3868411d0ef734e4187825384cf6174a9dcdb6ba9305db866f7cb46ab9
Contents?: true
Size: 638 Bytes
Versions: 1
Compression:
Stored size: 638 Bytes
Contents
module Troo module API class Responder include Virtus.value_object values do attribute :body, String attribute :code, String end class << self # @param [Hash] # @return [Response, ErrorResponse] def build(response) new(response).build end end # @return [Response, ErrorResponse] def build ok? ? Response.new(attributes) : ErrorResponse.new(attributes) end private def ok? code == '200' end end class Response < Responder; end class ErrorResponse < Responder; end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.11 | lib/troo/api/response.rb |