Class: Spidra::Client
- Inherits:
-
Object
- Object
- Spidra::Client
- Defined in:
- lib/spidra/client.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://api.spidra.io/api"- DEFAULT_TIMEOUT =
30
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#crawl ⇒ Object
readonly
Returns the value of attribute crawl.
-
#logs ⇒ Object
readonly
Returns the value of attribute logs.
-
#scrape ⇒ Object
readonly
Returns the value of attribute scrape.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
-
#initialize(api_key, base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT) ⇒ Client
constructor
Create a new Spidra client.
Constructor Details
#initialize(api_key, base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT) ⇒ Client
Create a new Spidra client.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/spidra/client.rb', line 20 def initialize(api_key, base_url: DEFAULT_BASE_URL, timeout: DEFAULT_TIMEOUT) raise ArgumentError, "api_key is required" if api_key.nil? || api_key.empty? http = HTTP.new(api_key: api_key, base_url: base_url, timeout: timeout) @scrape = Resources::Scrape.new(http) @batch = Resources::Batch.new(http) @crawl = Resources::Crawl.new(http) @logs = Resources::Logs.new(http) @usage = Resources::Usage.new(http) end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
13 14 15 |
# File 'lib/spidra/client.rb', line 13 def batch @batch end |
#crawl ⇒ Object (readonly)
Returns the value of attribute crawl.
13 14 15 |
# File 'lib/spidra/client.rb', line 13 def crawl @crawl end |
#logs ⇒ Object (readonly)
Returns the value of attribute logs.
13 14 15 |
# File 'lib/spidra/client.rb', line 13 def logs @logs end |
#scrape ⇒ Object (readonly)
Returns the value of attribute scrape.
13 14 15 |
# File 'lib/spidra/client.rb', line 13 def scrape @scrape end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
13 14 15 |
# File 'lib/spidra/client.rb', line 13 def usage @usage end |