Class: TwitterImages::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_images/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

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_idObject

Returns the value of attribute max_id.



4
5
6
# File 'lib/twitter_images/parser.rb', line 4

def max_id
  @max_id
end

Returns the value of attribute parsed_links.



4
5
6
# File 'lib/twitter_images/parser.rb', line 4

def parsed_links
  @parsed_links
end

#responseObject (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


16
17
18
# File 'lib/twitter_images/parser.rb', line 16

def trim_links(amount)
  @parsed_links = @parsed_links.slice!(0...amount)
end