Class: RedboothRuby::Request::Validator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Validator

Returns a new instance of Validator.



7
8
9
# File 'lib/redbooth-ruby/request/validator.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/validator.rb', line 4

def info
  @info
end

#raw_responseObject

Returns the value of attribute raw_response.



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

def raw_response
  @raw_response
end

#responseObject

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#validated_response_for(incoming_response) ⇒ Object

Validates the given http response creating a response object or failing with an error and description

param incoming_response [] http response object return [RedboothRuby::Request::Response]



16
17
18
19
20
21
22
23
# File 'lib/redbooth-ruby/request/validator.rb', line 16

def validated_response_for(incoming_response)
  self.raw_response = incoming_response
  @response = response_from_raw
  verify_response_code
  info.data = response.data
  validate_response_data
  response
end