Class: FlyingSphinx::API
- Inherits:
-
Object
- Object
- FlyingSphinx::API
- Defined in:
- lib/flying_sphinx/api.rb
Constant Summary collapse
- SERVER =
'https://staging.flying-sphinx.com'
- PUSHER_KEY =
'c5602d4909b5144321ce'
- PATH =
'/api/my/v5'
- HEADERS =
{'X-Flying-Sphinx-Version' => FlyingSphinx::Version}
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
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
Constructor Details
#initialize(identifier, api_key, adapter = Faraday.default_adapter) ⇒ API
Returns a new instance of API.
15 16 17 18 19 |
# File 'lib/flying_sphinx/api.rb', line 15 def initialize(identifier, api_key, adapter = Faraday.default_adapter) @api_key = api_key @identifier = identifier @adapter = adapter end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/flying_sphinx/api.rb', line 13 def api_key @api_key end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
13 14 15 |
# File 'lib/flying_sphinx/api.rb', line 13 def identifier @identifier end |
Instance Method Details
#get(path, data = {}) ⇒ Object
21 22 23 |
# File 'lib/flying_sphinx/api.rb', line 21 def get(path, data = {}) connection.get { |request| request.url normalize_path(path), data }.body end |
#post(path, data = {}) ⇒ Object
25 26 27 |
# File 'lib/flying_sphinx/api.rb', line 25 def post(path, data = {}) connection.post(normalize_path(path), data).body end |