Sha256: 5035b8003741b72066d7c1ec94909b95db6969b0eee5e99fdf7263e181892deb

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

module ActionTexter
  module Messagebird
    
    class Response
      attr_reader :net_http_response, :body, :code

      def initialize(net_http_response)
        @net_http_response = net_http_response
        @body              = @net_http_response.body
        @code              = @net_http_response.code
      end

      def success?
        code.to_i == 201
      end

      def failure?
        !success?
      end

      def body
        if success?
          SuccessResponse.new(@body)
        else
          ErrorResponse.new(@body)
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action-texter-0.2.1.pre lib/action_texter/provider/messagebird/response.rb