stickybits 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ The gem is tested with Ruby 1.9.2 but may well work with other versions of Ruby.
12
12
 
13
13
  == Examples
14
14
 
15
- Stickybits::Code.scan("843163066946")
15
+ Stickybits::Code.get("843163066946")
16
16
 
17
17
  == Copyright
18
18
 
@@ -1,22 +1,26 @@
1
- require "stickybits/version"
2
-
3
1
  require 'httparty'
4
2
 
5
3
  module Stickybits
6
4
 
7
5
  URL = "http://api.stickybits.com/api/1/"
8
- APIKEY = "04b8665194e9f36fb44cd54ced43a980"
6
+
7
+ class << self
8
+
9
+ attr_accessor :apikey
10
+
11
+ def configure
12
+ yield self
13
+ end
14
+
15
+ end
9
16
 
10
17
  module Code
11
18
 
12
- def self.get(codeid, options = {})
13
- limit = options[:limit] || 30
14
- order = options[:order] || 'date desc'
15
- responses = options[:responses] || true
16
-
17
- url = "#{URL}code.get?apikey=#{APIKEY}&codeid=#{codeid}&limit=#{limit}&order=#{order}&responses=#{responses}"
19
+ def self.get(codeid, parameters = {})
20
+ parameters.merge!(apikey: Stickybits.apikey)
21
+ parameters.merge!(codeid: codeid)
18
22
 
19
- HTTParty.get(URI.escape(url))
23
+ HTTParty.get(URI.escape("#{URL}code.get"), query: parameters)
20
24
  end
21
25
 
22
26
  end
@@ -1,3 +1,3 @@
1
1
  module Stickybits
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: stickybits
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Sylvestre
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-28 00:00:00 Z
13
+ date: 2011-06-29 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty