Sha256: 72dbfcb5c6c5223807dc17e64b898ea6e696b1ea7d2080e6d4c8320afc2fc7e7
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true class Cognito class Client class Response class Builder include Concord.new(:response), Procto.call(:to_h), Adamantium def to_h { status: build_status, headers: response.headers.to_hash, data: build_data, json: json_body } end private def build_data return if response.body.empty? resource_class.build(document.data, document) end def json_body return if response.body.empty? JSON.parse(response) end def build_status Status.new( code: response.code, reason: response.reason ) end def resource_class data = parsed_response.fetch(:data) Resource::REGISTRY.lookup(data.fetch(:type).to_sym) end def document Document.new(parsed_response) end def parsed_response JSON.parse(response, symbolize_names: true) end memoize :parsed_response end # Builder end # Response end # Client end # Cognito
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cognito-client-0.5.4 | lib/cognito/client/response/builder.rb |
cognito-client-0.5.3 | lib/cognito/client/response/builder.rb |
cognito-client-0.5.2 | lib/cognito/client/response/builder.rb |