Class: Yahoo
- Inherits:
-
RCRest
- Object
- RCRest
- Yahoo
- Defined in:
- lib/yahoo.rb
Overview
Abstract class for implementing Yahoo APIs.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
This is the version of Yahoo you are using.
'2.0.0'
Instance Method Summary collapse
-
#check_error(xml) ⇒ Object
:nodoc:.
-
#initialize(appid) ⇒ Yahoo
constructor
Web services initializer.
-
#make_url(method, params) ⇒ Object
:nodoc:.
Constructor Details
#initialize(appid) ⇒ Yahoo
Web services initializer.
The appid
is the Application ID that uniquely identifies your application. See: developer.yahoo.com/faq/index.html#appid
Concrete web services implementations need to set the following instance variables then call super:
host
-
API endpoint hostname
service_name
-
service name
version
-
service name version number
37 38 39 40 |
# File 'lib/yahoo.rb', line 37 def initialize(appid) @appid = appid @url = URI.parse "http://#{@host}/#{@service_name}/#{@version}/" end |
Instance Method Details
#check_error(xml) ⇒ Object
:nodoc:
42 43 44 45 |
# File 'lib/yahoo.rb', line 42 def check_error(xml) # :nodoc: err = xml.at_xpath('Error') raise Error, err.at_xpath('Message').content if err end |
#make_url(method, params) ⇒ Object
:nodoc:
47 48 49 50 51 52 |
# File 'lib/yahoo.rb', line 47 def make_url(method, params) # :nodoc: params[:appid] = @appid params[:output] = 'xml' super method, params end |