closeio 0.0.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -7
- data/lib/closeio.rb +6 -0
- data/lib/closeio/base.rb +11 -7
- data/lib/closeio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8a7a4b35e0d609b13ec45b4fd743ddfc82eb7d9
|
4
|
+
data.tar.gz: 60c26a812eb6fc5d5d2fecd4e2c286073b6017da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75d9f6b832bc73cbc5237c45418643e6a04933642b73352e1bed8e35efad0a7631054e24e5f22498af24ad133e97b1bd8c2b726e4d26f1335f1cabafc679cb41
|
7
|
+
data.tar.gz: edd1e41ba79df58e83d0402c27d710c3325f83781f86cfa147c044f5f34c2d3134d1fdb83efd747cb4d33655a5777317c9157ee5cf6a37cee6bfbdbe5a848788
|
data/README.md
CHANGED
@@ -11,13 +11,8 @@ Add this line to your application's Gemfile:
|
|
11
11
|
# then...
|
12
12
|
bundle install
|
13
13
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
# or if you're using Rails
|
18
|
-
1. Create a `closeio.yml` file
|
19
|
-
2. Set `api_key:` to your Closeio api key
|
20
|
-
3. Place it in `/config/initializers/`
|
14
|
+
# Set your Api Key (in a `config/initializer` or `config/environment/*`)
|
15
|
+
Closeio.configure("xxxxxx")
|
21
16
|
````
|
22
17
|
|
23
18
|
### Usage
|
data/lib/closeio.rb
CHANGED
data/lib/closeio/base.rb
CHANGED
@@ -3,7 +3,6 @@ module Closeio
|
|
3
3
|
|
4
4
|
include HTTParty
|
5
5
|
base_uri 'https://app.close.io/api/v1'
|
6
|
-
basic_auth ENV['CLOSEIO_API_KEY'], ''
|
7
6
|
headers 'Content-Type' => 'application/json'
|
8
7
|
#debug_output $stdout
|
9
8
|
format :json
|
@@ -26,11 +25,16 @@ module Closeio
|
|
26
25
|
end
|
27
26
|
|
28
27
|
class << self
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
def configure(api_key)
|
29
|
+
@default_options.merge!(basic_auth: {
|
30
|
+
username: api_key,
|
31
|
+
password: ''
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
def bad_response(response)
|
36
|
+
raise "Unauthorized" if response.values.include? "Unauthorized"
|
37
|
+
raise response
|
34
38
|
end
|
35
39
|
|
36
40
|
def all response = nil, opts={}
|
@@ -39,7 +43,7 @@ module Closeio
|
|
39
43
|
if res.success?
|
40
44
|
res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
|
41
45
|
else
|
42
|
-
bad_response
|
46
|
+
bad_response(res)
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
data/lib/closeio/version.rb
CHANGED