lib/scraperwiki-api.rb in scraperwiki-api-0.0.6 vs lib/scraperwiki-api.rb in scraperwiki-api-0.0.7
- old
+ new
@@ -6,15 +6,15 @@
class API
include HTTParty
base_uri 'api.scraperwiki.com/api/1.0'
RUN_INTERVALS = {
- never: -1,
- monthly: 2678400,
- weekly: 604800,
- daily: 86400,
- hourly: 3600,
+ :never => -1,
+ :monthly => 2678400,
+ :weekly => 604800,
+ :daily => 86400,
+ :hourly => 3600,
}
class << self
# Returns the URL to the scraper's overview.
#
@@ -85,11 +85,11 @@
# {https://scraperwiki.com/docs/api#sqlite as in the ScraperWiki docs}
def datastore_sqlite(shortname, query, opts = {})
if Array === opts[:attach]
opts[:attach] = opts[:attach].join ';'
end
- request_with_apikey '/datastore/sqlite', {name: shortname, query: query}.merge(opts)
+ request_with_apikey '/datastore/sqlite', {:name => shortname, :query => query}.merge(opts)
end
# Extracts data about a scraper's code, owner, history, etc.
#
# * +runid+ is a Unix timestamp with microseconds and a UUID.
@@ -197,11 +197,11 @@
# {https://scraperwiki.com/docs/api#getinfo as in the ScraperWiki docs}
def scraper_getinfo(shortname, opts = {})
if Array === opts[:quietfields]
opts[:quietfields] = opts[:quietfields].join '|'
end
- request_with_apikey '/scraper/getinfo', {name: shortname}.merge(opts)
+ request_with_apikey '/scraper/getinfo', {:name => shortname}.merge(opts)
end
# See what the scraper did during each run.
#
# Example output:
@@ -233,11 +233,11 @@
#
# @note Returns an array although the array seems to always have only one item
# @note The query string parameter is +name+, not +shortname+
# {https://scraperwiki.com/docs/api#getinfo as in the ScraperWiki docs}
def scraper_getruninfo(shortname, opts = {})
- request_with_apikey '/scraper/getruninfo', {name: shortname}.merge(opts)
+ request_with_apikey '/scraper/getruninfo', {:name => shortname}.merge(opts)
end
# Find out information about a user.
#
# Example output:
@@ -269,11 +269,11 @@
#
# @note Returns an array although the array seems to always have only one item
# @note The date joined field is +date_joined+ (with underscore) on
# {#scraper_usersearch}
def scraper_getuserinfo(username)
- request_with_apikey '/scraper/getuserinfo', username: username
+ request_with_apikey '/scraper/getuserinfo', :username => username
end
# Search the titles and descriptions of all the scrapers.
#
# Example output:
@@ -339,9 +339,9 @@
end
request path, opts
end
def request(path, opts)
- self.class.get(path, query: opts).parsed_response
+ self.class.get(path, :query => opts).parsed_response
end
end
end