Class: MotionTube::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-tube/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Parser

Returns a new instance of Parser.



4
5
6
7
# File 'lib/motion-tube/parser.rb', line 4

def initialize(options = {})
  self.options = options
  set_rest_client "http://www.youtube.com"
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/motion-tube/parser.rb', line 3

def options
  @options
end

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/motion-tube/parser.rb', line 3

def response
  @response
end

#rest_clientObject

Returns the value of attribute rest_client.



3
4
5
# File 'lib/motion-tube/parser.rb', line 3

def rest_client
  @rest_client
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/motion-tube/parser.rb', line 3

def url
  @url
end

Instance Method Details

#parse(options, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/motion-tube/parser.rb', line 9

def parse(options, &block)
  self.options.merge! options
  if block
    get_response(&block)
  else
    raise "need a block to parse result"
  end
end