Class: RedboothRuby::Request::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/redbooth-ruby/request/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/redbooth-ruby/request/base.rb', line 7

def initialize(info)
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



4
5
6
# File 'lib/redbooth-ruby/request/base.rb', line 4

def info
  @info
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/redbooth-ruby/request/base.rb', line 5

def response
  @response
end

Instance Method Details

#performObject



11
12
13
14
15
16
17
# File 'lib/redbooth-ruby/request/base.rb', line 11

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

  validator.validated_response_for(response)
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
# File 'lib/redbooth-ruby/request/base.rb', line 19

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