Class: SI::CopyscapeResponse
- Inherits:
-
Object
- Object
- SI::CopyscapeResponse
- Defined in:
- lib/copyscape_response.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#initialize(raw_response:) ⇒ CopyscapeResponse
constructor
A new instance of CopyscapeResponse.
- #query_words ⇒ Object
- #raw_hash ⇒ Object
- #raw_xml ⇒ Object
- #remaining ⇒ Object
- #response ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(raw_response:) ⇒ CopyscapeResponse
Returns a new instance of CopyscapeResponse.
6 7 8 9 |
# File 'lib/copyscape_response.rb', line 6 def initialize raw_response: @raw_response ||= raw_response @error = _error_msg end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
4 5 6 |
# File 'lib/copyscape_response.rb', line 4 def error @error end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
4 5 6 |
# File 'lib/copyscape_response.rb', line 4 def raw_response @raw_response end |
Instance Method Details
#query_words ⇒ Object
32 33 34 |
# File 'lib/copyscape_response.rb', line 32 def query_words response['querywords'].to_i if response.is_a?(Hash) end |
#raw_hash ⇒ Object
15 16 17 |
# File 'lib/copyscape_response.rb', line 15 def raw_hash _to_hash end |
#raw_xml ⇒ Object
11 12 13 |
# File 'lib/copyscape_response.rb', line 11 def raw_xml raw_response.body end |
#remaining ⇒ Object
19 20 21 |
# File 'lib/copyscape_response.rb', line 19 def remaining raw_hash['remaining'] end |
#response ⇒ Object
23 24 25 |
# File 'lib/copyscape_response.rb', line 23 def response raw_hash['response'] end |
#results ⇒ Object
27 28 29 30 |
# File 'lib/copyscape_response.rb', line 27 def results result = response['result'] if response.is_a?(Hash) result.is_a?(Array) ? result : [result].compact end |