Sha256: 7f3ee2ca7ec4ee9cfb71d484a28c2a9a7e731d7080a22a80204ce2b90a97959c

Contents?: true

Size: 517 Bytes

Versions: 5

Compression:

Stored size: 517 Bytes

Contents

module Rbox
  module Response
    module Base
      def initialize(response, client)
        @response = response
        @body_response = response.body['response']
        @client = client
        raise "Response failure with status code \"#{status}\"" unless success?
      end

      def success?
        !!(status =~ /_ok\z/)
      end

      def status
        @body_response['status']
      end

      def method_missing(name, *args, &block)
        @client.send(name, *args, &block)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbox-0.1.4 lib/rbox/response/base.rb
rbox-0.1.3 lib/rbox/response/base.rb
rbox-0.1.2 lib/rbox/response/base.rb
rbox-0.1.1 lib/rbox/response/base.rb
rbox-0.1.0 lib/rbox/response/base.rb