Module: Little
- Defined in:
- lib/little.rb,
lib/little/tag.rb,
lib/little/user.rb,
lib/little/asset.rb,
lib/little/error.rb,
lib/little/sender.rb,
lib/little/version.rb,
lib/little/notification.rb,
lib/little/configuration.rb
Overview
:nodoc
Defined Under Namespace
Classes: Asset, Configuration, Error, Notification, Sender, Tag, User
Constant Summary collapse
- VERSION =
'0.0.8'
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, data, signature_keys, url = nil) ⇒ Object
Issues a DELETE request to the little.io service.
-
.get(resource, data, signature_keys = nil, url = nil) ⇒ Object
Issues a GET request to the little.io service.
-
.post(resource, data, signature_keys, url = nil) ⇒ Object
Issues a POST request to the little.io service.
-
.sign(resource, params) ⇒ Object
Can be used to generate a signature.
Class Attribute Details
.configuration ⇒ Object
Gets the current configuration
34 35 36 |
# File 'lib/little.rb', line 34 def configuration @configuration ||= Configuration.new end |
.sender ⇒ Object
Returns the value of attribute sender.
12 13 14 |
# File 'lib/little.rb', line 12 def sender @sender end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Sets the configuration options. Best used by passing a block, for example:
Little.configure do |config|
config.api_key = 'KEY'
config.api_secret = 'SECRET'
end
21 22 23 24 |
# File 'lib/little.rb', line 21 def configure yield(configuration) self.sender = Sender.new(configuration) end |
.delete(resource, data, signature_keys, url = nil) ⇒ Object
Issues a DELETE request to the little.io service
49 50 51 |
# File 'lib/little.rb', line 49 def delete(resource, data, signature_keys, url = nil) sender.delete_request(resource, data, signature_keys, url) end |
.get(resource, data, signature_keys = nil, url = nil) ⇒ Object
Issues a GET request to the little.io service
56 57 58 |
# File 'lib/little.rb', line 56 def get(resource, data, signature_keys = nil, url = nil) sender.get_request(resource, data, signature_keys, url) end |
.post(resource, data, signature_keys, url = nil) ⇒ Object
Issues a POST request to the little.io service
42 43 44 |
# File 'lib/little.rb', line 42 def post(resource, data, signature_keys, url = nil) sender.post_request(resource, data, signature_keys, url) end |
.sign(resource, params) ⇒ Object
Can be used to generate a signature. Best to use specific signature methods such as Little::Like.sign_add(user)
27 28 29 30 31 |
# File 'lib/little.rb', line 27 def sign(resource, params) params[:key] = configuration.api_key raw = params.sort{|a, b| a[0] <=> b[0]}.join('|') + '|' + configuration.api_secret + '|' + resource.to_s Digest::SHA1.hexdigest(raw) end |