Sha256: 967b835cc3cc495503181afa78982b51cb8d5cb453fd6c794ed9e4dcbb138d58
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
module LucidHttp class Response attr_reader :base_url attr_reader :path def initialize(base_url:, path:, formatter:, follower:, verb: :get, form: {}) @base_url = base_url @path = path @formatter = LucidHttp::Formatter.for(formatter) @follower = LucidHttp::Follower.for(follower).client @verb = verb @form = form @response = @follower.send(@verb, url, params: form) end def body @formatter.call(@response.body.to_s) end def status @response.status.to_s end def content_type @response.content_type.mime_type end def url "#{base_url}#{path}" end def error body.split("\n").first end def verb @verb.to_s.upcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lucid_http-1.1.0 | lib/lucid_http/response.rb |
lucid_http-1.0.0 | lib/lucid_http/response.rb |