Class: Copy::Request::Validator
- Inherits:
-
Object
- Object
- Copy::Request::Validator
- Defined in:
- lib/copy/request/validator.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(info) ⇒ Validator
constructor
A new instance of Validator.
- #validated_data_for(incoming_response) ⇒ Object
Constructor Details
#initialize(info) ⇒ Validator
Returns a new instance of Validator.
7 8 9 |
# File 'lib/copy/request/validator.rb', line 7 def initialize(info) @info = info end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
4 5 6 |
# File 'lib/copy/request/validator.rb', line 4 def info @info end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/copy/request/validator.rb', line 5 def response @response end |
Instance Method Details
#validated_data_for(incoming_response) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/copy/request/validator.rb', line 11 def validated_data_for(incoming_response) self.response = incoming_response verify_response_code info.data = JSON.parse(response.body) if response.code.to_i != 204 info.data ||= {} validate_response_data info.data end |