Sha256: 81ac5004e70a5a3b5fc70ca4cd65c63f3d1a29b87de032eebfb18b947e9d4e70

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

# frozen_string_literal: true

module Talkbird
  module Result
    # Encapsulates a response from the API which should be considered a failed
    # request.
    class Failure

      attr_reader :body
      attr_reader :result

      def initialize(result)
        @result = result
        @body = MultiJson.load(result.body.to_s, symbolize_keys: true)
      end

      def code
        @body[:code]
      end

      def message
        @body[:message]
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
talkbird-0.0.5 lib/talkbird/result/failure.rb
talkbird-0.0.4 lib/talkbird/result/failure.rb