Class: FlyingSphinx::API
- Inherits:
-
Object
- Object
- FlyingSphinx::API
- Defined in:
- lib/flying_sphinx/api.rb
Constant Summary collapse
- SERVER =
'https://flying-sphinx.com'
- STAGING_SERVER =
'https://staging.flying-sphinx.com'
- PATH =
"/api/my/app"
- VERSION =
3
Instance Method Summary collapse
- #get(path, data = {}) ⇒ Object
-
#initialize(identifier, api_key, adapter = Faraday.default_adapter) ⇒ API
constructor
A new instance of API.
- #post(path, data = {}) ⇒ Object
- #put(path, data = {}) ⇒ Object
Constructor Details
#initialize(identifier, api_key, adapter = Faraday.default_adapter) ⇒ API
Returns a new instance of API.
7 8 9 10 11 |
# File 'lib/flying_sphinx/api.rb', line 7 def initialize(identifier, api_key, adapter = Faraday.default_adapter) @api_key = api_key @identifier = identifier @adapter = adapter end |
Instance Method Details
#get(path, data = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/flying_sphinx/api.rb', line 13 def get(path, data = {}) log('GET', path, data) do connection.get do |request| request.url normalize_path(path), data end end end |
#post(path, data = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/flying_sphinx/api.rb', line 21 def post(path, data = {}) log('POST', path, data) do connection.post normalize_path(path), data end end |
#put(path, data = {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/flying_sphinx/api.rb', line 27 def put(path, data = {}) log('PUT', path, data) do connection.put normalize_path(path), data end end |