Class: Pokeedex::Pokemon::Scrapper::Parsers::Base
- Inherits:
-
Object
- Object
- Pokeedex::Pokemon::Scrapper::Parsers::Base
- Defined in:
- lib/pokeedex/pokemon/scrapper/parsers/base.rb
Overview
Base class for the Pokemon parser. It holds the response and the methods to parse the response and return the Pokemon attributes from a HTML response
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Response from the Pokemon::Pokemon::Scrapper::Fetcher::Base website (HTML response) to parse.
Instance Method Summary collapse
-
#as_json ⇒ Hash
Return the Pokemon attributes as a JSON object.
-
#initialize(response) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(response) ⇒ Base
Returns a new instance of Base.
17 18 19 |
# File 'lib/pokeedex/pokemon/scrapper/parsers/base.rb', line 17 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Response from the Pokemon::Pokemon::Scrapper::Fetcher::Base website (HTML response) to parse
15 16 17 |
# File 'lib/pokeedex/pokemon/scrapper/parsers/base.rb', line 15 def response @response end |
Instance Method Details
#as_json ⇒ Hash
Return the Pokemon attributes as a JSON object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pokeedex/pokemon/scrapper/parsers/base.rb', line 24 def as_json(*) { number: number, name: name, description: description, hight: hight, weight: weight, category: category, abilities: abilities, gender: gender, types: types, weakness: weakness, stats: stats } end |