Sha256: 909a8a7804126d1ac5fcf3581a0e7b35de0ed6d46595d5843870b143d8bbb522

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

module Workarea
  module Orderbot
    class Response
      def initialize(response)
        @response = response
      end

      def success?
        @response.success?
      end

      def body
        @body ||= JSON.parse(@response.body)
      end

      def headers
        @headers ||= @response.headers
      end

      def total_pages
        headers["x-total-pages"]
      end

      def error_details
        body["errors"].to_s
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-orderbot-1.0.2 lib/workarea/orderbot/response.rb
workarea-orderbot-1.0.1 lib/workarea/orderbot/response.rb
workarea-orderbot-1.0.0 lib/workarea/orderbot/response.rb