Module: Jeckle::HTTP::APIMapping
- Defined in:
- lib/jeckle/http.rb
Instance Method Summary collapse
-
#api(registered_api_name) ⇒ Object
The API name that Jeckle uses to find all the api settings like domain, headers, etc.
- #api_mapping ⇒ Object
-
#default_api(registered_api_name) ⇒ Object
deprecated
Deprecated.
Please use #api instead
- #inherited(base) ⇒ Object
-
#resource_name ⇒ Object
The name of the resource that Jeckle uses to make the request.
- #run_request(endpoint, options = {}) ⇒ Object
Instance Method Details
#api(registered_api_name) ⇒ Object
The API name that Jeckle uses to find all the api settings like domain, headers, etc.
57 58 59 60 61 |
# File 'lib/jeckle/http.rb', line 57 def api(registered_api_name) api_mapping[:default_api] = Jeckle::Setup.registered_apis.fetch(registered_api_name) rescue KeyError => e raise Jeckle::NoSuchAPIError, registered_api_name end |
#api_mapping ⇒ Object
70 71 72 |
# File 'lib/jeckle/http.rb', line 70 def api_mapping @api_mapping ||= {} end |
#default_api(registered_api_name) ⇒ Object
Deprecated.
Please use #api instead
65 66 67 68 |
# File 'lib/jeckle/http.rb', line 65 def default_api(registered_api_name) warn "[DEPRECATION] `default_api` is deprecated. Please use `api` instead." api(registered_api_name) end |
#inherited(base) ⇒ Object
8 9 10 11 12 |
# File 'lib/jeckle/http.rb', line 8 def inherited(base) base.class_eval do @api_mapping = superclass.api_mapping.dup end end |
#resource_name ⇒ Object
38 39 40 |
# File 'lib/jeckle/http.rb', line 38 def resource_name @resource_name ||= model_name.element.pluralize end |