Module: Teapi
- Defined in:
- lib/teapi.rb,
lib/teapi/sender.rb,
lib/teapi/version.rb,
lib/teapi/documents.rb,
lib/teapi/configuration.rb
Overview
:nodoc
Defined Under Namespace
Classes: Configuration, Documents, Sender
Constant Summary collapse
- VERSION =
'0.0.5'
Class Attribute Summary collapse
-
.configuration ⇒ Object
Gets the current configuration.
-
.sender ⇒ Object
Returns the value of attribute sender.
Class Method Summary collapse
-
.configure {|configuration| ... } ⇒ Object
Sets the configuration options.
-
.delete(resource, body) ⇒ Object
Issues a DELETE request to the teapi.io service.
-
.post(resource, body) ⇒ Object
Issues a POST request to the teapi.io service.
-
.put(resource, body) ⇒ Object
Issues a PUT request to the teapi.io service.
Class Attribute Details
.configuration ⇒ Object
Gets the current configuration
23 24 25 |
# File 'lib/teapi.rb', line 23 def configuration @configuration ||= Configuration.new end |
.sender ⇒ Object
Returns the value of attribute sender.
8 9 10 |
# File 'lib/teapi.rb', line 8 def sender @sender end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Sets the configuration options. Teapi.configure do |config|
config.host = 'HOST'
config.sync_key = 'KEY'
config.sync_secret = 'SECRET'
end
17 18 19 20 |
# File 'lib/teapi.rb', line 17 def configure yield(configuration) self.sender = Sender.new(configuration) end |
.delete(resource, body) ⇒ Object
Issues a DELETE request to the teapi.io service
46 47 48 49 |
# File 'lib/teapi.rb', line 46 def delete(resource, body) assert_configured() sender.request(:delete, resource, {body: body}) end |
.post(resource, body) ⇒ Object
Issues a POST request to the teapi.io service
30 31 32 33 |
# File 'lib/teapi.rb', line 30 def post(resource, body) assert_configured() sender.request(:post, resource, {body: body}) end |
.put(resource, body) ⇒ Object
Issues a PUT request to the teapi.io service
38 39 40 41 |
# File 'lib/teapi.rb', line 38 def put(resource, body) assert_configured() sender.request(:put, resource, {body: body}) end |