class ReviewsCatcher::Client
Attributes
api_key[R]
app_id[R]
base_url[R]
Public Class Methods
new(app_id: 'my_app_id', api_key: 'my_api_key')
click to toggle source
# File lib/reviews_catcher/client.rb, line 6 def initialize(app_id: 'my_app_id', api_key: 'my_api_key') @app_id = app_id @api_key = api_key validate_credentials! @base_url = build_base_url end
Public Instance Methods
account()
click to toggle source
# File lib/reviews_catcher/client.rb, line 15 def account @account ||= ReviewsCatcher::Account.new(self) end
reviews()
click to toggle source
# File lib/reviews_catcher/client.rb, line 19 def reviews @reviews ||= ReviewsCatcher::Reviews.new(self) end
Private Instance Methods
build_base_url()
click to toggle source
# File lib/reviews_catcher/client.rb, line 30 def build_base_url "http://#{@app_id}.reviewscatcher.io" end
validate_credentials!()
click to toggle source
# File lib/reviews_catcher/client.rb, line 25 def validate_credentials! error = MisconfiguredClientError.new('app_id and api_key must not be nil') fail error if @app_id.nil? || @api_key.nil? end