Sha256: 8bc5a19c0eb496890043820f9a14130059a32b7f7328f8ebe99ce06465816c7f

Contents?: true

Size: 445 Bytes

Versions: 3

Compression:

Stored size: 445 Bytes

Contents

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

      def success?
        @response.present? && (@response.status == 201 || @response.status == 200)
      end

      def body
        return {} unless @response.body.present? && @response.body != "null"
        JSON.parse(@response.body)
      end

      def status
        @response.status
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-afterpay-2.1.2 lib/workarea/afterpay/response.rb
workarea-afterpay-2.1.1 lib/workarea/afterpay/response.rb
workarea-afterpay-2.1.0 lib/workarea/afterpay/response.rb