Sha256: 8c0f1307bbb909ca0272117894a2707edc2f96181e7b274c9e366930c553bfb7

Contents?: true

Size: 790 Bytes

Versions: 10

Compression:

Stored size: 790 Bytes

Contents

module RedboothRuby
  module Request
    class Base
      attr_reader :info
      attr_accessor :response

      def initialize(info)
        @info = info
      end

      def perform
        fail RedboothRuby::AuthenticationError unless valid?
        connection.set_request_data
        send_request

        validator.validated_response_for(response)
      end

      def valid?
        return false unless info
        return false unless info.session
        return false unless info.session.valid?
        true
      end

      protected

      def send_request
        self.response = connection.request
      end

      def connection
        @connection ||= Connection.new(info)
      end

      def validator
        @validator ||= Validator.new(info)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
redbooth-ruby-0.2.3 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.2.2 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.2.1 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.2.0 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.1.4 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.1.3 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.1.1 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.1.0 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.0.5 lib/redbooth-ruby/request/base.rb
redbooth-ruby-0.0.4 lib/redbooth-ruby/request/base.rb