Class: TwitterImages::Parser
- Inherits:
-
Object
- Object
- TwitterImages::Parser
- Defined in:
- lib/twitter_images/parser.rb
Instance Attribute Summary collapse
-
#max_id ⇒ Object
Returns the value of attribute max_id.
-
#parsed_links ⇒ Object
Returns the value of attribute parsed_links.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #parse(response) ⇒ Object
- #trim_links(amount) ⇒ Object
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
6 7 8 |
# File 'lib/twitter_images/parser.rb', line 6 def initialize @parsed_links = [] end |
Instance Attribute Details
#max_id ⇒ Object
Returns the value of attribute max_id.
4 5 6 |
# File 'lib/twitter_images/parser.rb', line 4 def max_id @max_id end |
#parsed_links ⇒ Object
Returns the value of attribute parsed_links.
4 5 6 |
# File 'lib/twitter_images/parser.rb', line 4 def parsed_links @parsed_links end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/twitter_images/parser.rb', line 3 def response @response end |
Instance Method Details
#parse(response) ⇒ Object
10 11 12 13 14 |
# File 'lib/twitter_images/parser.rb', line 10 def parse(response) parsed = JSON.parse(response.body) get_max_id(parsed) collect_responses(parsed) end |
#trim_links(amount) ⇒ Object
16 17 18 |
# File 'lib/twitter_images/parser.rb', line 16 def trim_links(amount) @parsed_links = @parsed_links.slice!(0...amount) end |