Class: ChromeData::CollectionRequest
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- ChromeData::CollectionRequest
- Defined in:
- lib/chrome_data/collection_request.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.parse_response(response) ⇒ Object
Find elements matching class name and instantiate them using their id attribute and text.
- .request_name ⇒ Object
Methods inherited from BaseRequest
build_request, client, endpoint_uri, find_elements, #initialize, make_request, request, wsdl_body
Constructor Details
This class inherits a constructor from ChromeData::BaseRequest
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/chrome_data/collection_request.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/chrome_data/collection_request.rb', line 3 def name @name end |
Class Method Details
.parse_response(response) ⇒ Object
Find elements matching class name and instantiate them using their id attribute and text
12 13 14 15 16 |
# File 'lib/chrome_data/collection_request.rb', line 12 def parse_response(response) find_elements(name.split('::').last.downcase, response).map do |e| new id: e.attr('id').to_i, name: e.text end end |
.request_name ⇒ Object
6 7 8 9 |
# File 'lib/chrome_data/collection_request.rb', line 6 def request_name # Cheap-o inflector "get#{name.split('::').last}s" end |