Module: Teapi
- Defined in:
- lib/teapi.rb,
lib/teapi/lists.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, Lists, Sender
Constant Summary collapse
- VERSION =
'0.0.6'
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
24 25 26 |
# File 'lib/teapi.rb', line 24 def configuration @configuration ||= Configuration.new end |
.sender ⇒ Object
Returns the value of attribute sender.
9 10 11 |
# File 'lib/teapi.rb', line 9 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
18 19 20 21 |
# File 'lib/teapi.rb', line 18 def configure yield(configuration) self.sender = Sender.new(configuration) end |
.delete(resource, body) ⇒ Object
Issues a DELETE request to the teapi.io service
47 48 49 50 |
# File 'lib/teapi.rb', line 47 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
31 32 33 34 |
# File 'lib/teapi.rb', line 31 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
39 40 41 42 |
# File 'lib/teapi.rb', line 39 def put(resource, body) assert_configured() sender.request(:put, resource, {body: body}) end |