Module: DiffbotSimple::V2::ApiHelper
- Includes:
- Symbolize
- Defined in:
- lib/diffbot_simple/v2/api_helper.rb
Instance Method Summary collapse
- #initialize(api_client: nil, token: nil) ⇒ Object
- #post_initialize ⇒ Object
-
#request(url: nil, **options) ⇒ Object
overload if necessary.
- #to_api_url ⇒ Object
Methods included from Symbolize
Instance Method Details
#initialize(api_client: nil, token: nil) ⇒ Object
4 5 6 7 8 |
# File 'lib/diffbot_simple/v2/api_helper.rb', line 4 def initialize api_client: nil, token: nil @api_client = api_client @token = token post_initialize end |
#post_initialize ⇒ Object
9 10 11 |
# File 'lib/diffbot_simple/v2/api_helper.rb', line 9 def post_initialize raise "Must overload to set api path" end |
#request(url: nil, **options) ⇒ Object
overload if necessary
16 17 18 19 |
# File 'lib/diffbot_simple/v2/api_helper.rb', line 16 def request url: nil, ** raise ArgumentError.new "Must pass an url for the request to work" unless url execute_call .merge(url: url) end |
#to_api_url ⇒ Object
12 13 14 |
# File 'lib/diffbot_simple/v2/api_helper.rb', line 12 def to_api_url "#{api_client.site}#{api}" end |