Class: Datashake::ReviewScraper::Client
- Inherits:
-
Object
- Object
- Datashake::ReviewScraper::Client
- Defined in:
- lib/datashake-ruby-sdk/review_scraper/client.rb
Constant Summary collapse
- BASE_URL =
"https://app.datashake.com"
Instance Method Summary collapse
- #add_profile ⇒ Object
- #add_profiles ⇒ Object
- #connection ⇒ Object
- #info(job_id) ⇒ Object
-
#initialize(token:, adapter: Faraday.default_adapter, endpoint: nil, timeout: 30, open_timeout: 30) ⇒ Client
constructor
A new instance of Client.
- #job(job_id) ⇒ Object
- #jobs ⇒ Object
- #profiles ⇒ Object
- #reviews(job_id) ⇒ Object
- #v2 ⇒ Object
Constructor Details
#initialize(token:, adapter: Faraday.default_adapter, endpoint: nil, timeout: 30, open_timeout: 30) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 10 def initialize(token:, adapter: Faraday.default_adapter, endpoint: nil, timeout: 30, open_timeout: 30) @token = token @base_url = endpoint || BASE_URL @adapter = adapter @timeout = timeout @open_timeout = open_timeout end |
Instance Method Details
#add_profile ⇒ Object
38 39 40 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 38 def add_profile v2.profiles.add end |
#add_profiles ⇒ Object
42 43 44 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 42 def add_profiles v2.profiles.add_bulk end |
#connection ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 18 def connection @connection ||= Faraday.new do |conn| conn.headers = {"spiderman-token" => token} conn.url_prefix = base_url conn.request(:json) conn.response(:json, content_type: "application/json") conn..timeout = timeout conn..open_timeout = open_timeout conn.adapter(adapter) end end |
#info(job_id) ⇒ Object
54 55 56 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 54 def info(job_id) v2.profiles.info.job_id(job_id) end |
#job(job_id) ⇒ Object
50 51 52 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 50 def job(job_id) v2.profiles.job.job_id(job_id) end |
#jobs ⇒ Object
46 47 48 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 46 def jobs v2.profiles.jobs end |
#profiles ⇒ Object
34 35 36 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 34 def profiles v2.profiles end |
#reviews(job_id) ⇒ Object
58 59 60 |
# File 'lib/datashake-ruby-sdk/review_scraper/client.rb', line 58 def reviews(job_id) v2.profiles.reviews.job_id(job_id) end |