gratitude 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +2 -1
- data/CHANGELOG.md +4 -4
- data/Gemfile +4 -0
- data/README.md +5 -0
- data/lib/gratitude/profile.rb +4 -4
- data/lib/gratitude/version.rb +1 -1
- data/spec/cassettes/complete_profile.json +119 -0
- data/spec/cassettes/goal_profile.json +121 -0
- data/spec/cassettes/{profile.json → incomplete_profile.json} +8 -8
- data/spec/gratitude/profile_spec.rb +154 -74
- data/spec/spec_helper.rb +4 -0
- metadata +13 -9
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTAxNGRhMWEzNWJkYjBkNjkxZTM3OWZlNWE1YzYwZDk2NDQwOTI1Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 473713e402afb411f3cfbae68c5bba2ce0fa5bdd
|
4
|
+
data.tar.gz: f122eed37c115bd91210ab8e37969e5b9ad36706
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWFlNGEwNzQzODE1OTM4YjkwN2U2OTQ5OGI5NGYzNmU2NDYzNDZiM2ZkZmU4
|
11
|
-
NzJlNTIzNjdjYjg0Mjg0NTMwMDIyMGNlYmM0MjU1MjlkNTE5Njg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWEzY2M5ZTNmZWUzNTM4MzhlMzBkMmNhNDk4MDk0YTVkNjc1ZjZhYzY5OTMw
|
14
|
-
OWEzMWYxYTY5ZmM3ZjQxMWU2NDcwZjI2MDg0NWJiOTE3OWJlMWI0MWNiZjRk
|
15
|
-
YTY5NTQ4YmRhY2UyNGI4MDZlNzcwODI2YjlkNzNlZDlmZDhmOWM=
|
6
|
+
metadata.gz: bc90a61ecf75e50f611ffe9ba38e07d73fed3fa00a657ca1864b4e90e9bcc3814dd237ea13088856a47d4cafb6f22e1d8033f5448a029bf980db8a3b78a43dde
|
7
|
+
data.tar.gz: bb860da6574eca73ecf4209b854d13dfd93f8cc57ca32e48a8319d704196b794a2ce834e27819090fa32004cc00a79695df07be33323e6438c3f1e216a5d2aa7
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
### 0.1.0 (Upcoming Stable Release)
|
2
2
|
* Implement all aspects of the Gittip API.
|
3
3
|
|
4
|
-
### 0.0.4 (
|
5
|
-
* Improve integration with Gittip's Public User API to account for
|
4
|
+
### 0.0.4 (9/14/2013)
|
5
|
+
* Improve integration with Gittip's Public User API to better account for different user settings.
|
6
6
|
|
7
7
|
### 0.0.3 (9/11/2013)
|
8
8
|
* Fix release version.
|
9
9
|
|
10
|
-
###
|
10
|
+
### 0.0.2 (9/11/2013)
|
11
11
|
* Add ability to get a Gittip user's public information.
|
12
12
|
|
13
13
|
### 0.0.1 (9/10/2013)
|
14
|
-
* Initial release.
|
14
|
+
* Initial release.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
gratitude
|
2
2
|
=========
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/gratitude.png)](http://badge.fury.io/rb/gratitude)
|
3
4
|
[![Build Status](https://travis-ci.org/JohnKellyFerguson/gratitude.png?branch=master)](https://travis-ci.org/JohnKellyFerguson/gratitude)
|
5
|
+
[![Dependency Status](https://gemnasium.com/JohnKellyFerguson/gratitude.png)](https://gemnasium.com/JohnKellyFerguson/gratitude)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/JohnKellyFerguson/gratitude.png)](https://codeclimate.com/github/JohnKellyFerguson/gratitude)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/JohnKellyFerguson/gratitude/badge.png)](https://coveralls.io/r/JohnKellyFerguson/gratitude)
|
8
|
+
|
4
9
|
|
5
10
|
A simple Ruby wrapper for the Gittip API.
|
6
11
|
|
data/lib/gratitude/profile.rb
CHANGED
@@ -20,7 +20,7 @@ module Gratitude
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def bitbucket_username
|
23
|
-
bitbucket_api_url.gsub("https://bitbucket.org/api/1.0/users/", "")
|
23
|
+
bitbucket_api_url.gsub("https://bitbucket.org/api/1.0/users/", "") if bitbucket_api_url
|
24
24
|
end
|
25
25
|
|
26
26
|
def bountysource_api_url
|
@@ -28,7 +28,7 @@ module Gratitude
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def bountysource_username
|
31
|
-
bountysource_api_url.gsub("https://api.bountysource.com/users/", "")
|
31
|
+
bountysource_api_url.gsub("https://api.bountysource.com/users/", "") if bountysource_api_url
|
32
32
|
end
|
33
33
|
|
34
34
|
def github_api_url
|
@@ -36,7 +36,7 @@ module Gratitude
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def github_username
|
39
|
-
github_api_url.gsub("https://api.github.com/users/", "")
|
39
|
+
github_api_url.gsub("https://api.github.com/users/", "") if github_api_url
|
40
40
|
end
|
41
41
|
|
42
42
|
def twitter_api_url
|
@@ -56,7 +56,7 @@ module Gratitude
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def goal
|
59
|
-
response["goal"]
|
59
|
+
response["goal"].to_f if response["goal"]
|
60
60
|
end
|
61
61
|
|
62
62
|
def number
|
data/lib/gratitude/version.rb
CHANGED
@@ -0,0 +1,119 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "get",
|
6
|
+
"uri": "https://www.gittip.com/whit537/public.json",
|
7
|
+
"body": {
|
8
|
+
"encoding": "US-ASCII",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"response": {
|
16
|
+
"status": {
|
17
|
+
"code": 200,
|
18
|
+
"message": "OK"
|
19
|
+
},
|
20
|
+
"headers": {
|
21
|
+
"Access-Control-Allow-Origin": [
|
22
|
+
"*"
|
23
|
+
],
|
24
|
+
"Content-Type": [
|
25
|
+
"application/json"
|
26
|
+
],
|
27
|
+
"Date": [
|
28
|
+
"Sat, 14 Sep 2013 23:31:10 GMT"
|
29
|
+
],
|
30
|
+
"Server": [
|
31
|
+
"Aspen! Cheroot!"
|
32
|
+
],
|
33
|
+
"Set-Cookie": [
|
34
|
+
"csrf_token=aFFfMm7sTDPXzAZ0y59E1EI1dqeMvTxl; expires=Sat, 13 Sep 2014 23:31:10 GMT; Path=/"
|
35
|
+
],
|
36
|
+
"Vary": [
|
37
|
+
"Cookie"
|
38
|
+
],
|
39
|
+
"X-Frame-Options": [
|
40
|
+
"SAMEORIGIN"
|
41
|
+
],
|
42
|
+
"X-Gittip-Version": [
|
43
|
+
"10.1.20"
|
44
|
+
],
|
45
|
+
"Content-Length": [
|
46
|
+
"550"
|
47
|
+
],
|
48
|
+
"Connection": [
|
49
|
+
"keep-alive"
|
50
|
+
]
|
51
|
+
},
|
52
|
+
"body": {
|
53
|
+
"encoding": "UTF-8",
|
54
|
+
"string": "{\n \"avatar\": \"https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128\",\n \"elsewhere\": {\n \"bitbucket\": \"https://bitbucket.org/api/1.0/users/whit537\",\n \"bountysource\": \"https://api.bountysource.com/users/whit537\",\n \"github\": \"https://api.github.com/users/whit537\",\n \"twitter\": \"https://api.twitter.com/1.1/users/show.json?id=34175404&include_entities=1\"\n },\n \"giving\": \"101.41\",\n \"goal\": null,\n \"id\": 1451,\n \"number\": \"singular\",\n \"receiving\": \"434.25\",\n \"username\": \"whit537\"\n}"
|
55
|
+
},
|
56
|
+
"http_version": null
|
57
|
+
},
|
58
|
+
"recorded_at": "Sat, 14 Sep 2013 23:31:11 GMT"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"request": {
|
62
|
+
"method": "get",
|
63
|
+
"uri": "https://www.gittip.com/gratitude_test/public.json",
|
64
|
+
"body": {
|
65
|
+
"encoding": "US-ASCII",
|
66
|
+
"string": ""
|
67
|
+
},
|
68
|
+
"headers": {
|
69
|
+
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"response": {
|
73
|
+
"status": {
|
74
|
+
"code": 200,
|
75
|
+
"message": "OK"
|
76
|
+
},
|
77
|
+
"headers": {
|
78
|
+
"Access-Control-Allow-Origin": [
|
79
|
+
"*"
|
80
|
+
],
|
81
|
+
"Content-Type": [
|
82
|
+
"application/json"
|
83
|
+
],
|
84
|
+
"Date": [
|
85
|
+
"Sat, 14 Sep 2013 23:38:18 GMT"
|
86
|
+
],
|
87
|
+
"Server": [
|
88
|
+
"Aspen! Cheroot!"
|
89
|
+
],
|
90
|
+
"Set-Cookie": [
|
91
|
+
"csrf_token=gfzaLTHIVEHm8wQ1xToeV9xBYnglHuLK; expires=Sat, 13 Sep 2014 23:38:18 GMT; Path=/"
|
92
|
+
],
|
93
|
+
"Vary": [
|
94
|
+
"Cookie"
|
95
|
+
],
|
96
|
+
"X-Frame-Options": [
|
97
|
+
"SAMEORIGIN"
|
98
|
+
],
|
99
|
+
"X-Gittip-Version": [
|
100
|
+
"10.1.20"
|
101
|
+
],
|
102
|
+
"Content-Length": [
|
103
|
+
"441"
|
104
|
+
],
|
105
|
+
"Connection": [
|
106
|
+
"keep-alive"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
"body": {
|
110
|
+
"encoding": "UTF-8",
|
111
|
+
"string": "{\n \"avatar\": \"https://abs.twimg.com/sticky/default_profile_images/default_profile_3.png\",\n \"elsewhere\": {\n \"bitbucket\": null,\n \"bountysource\": null,\n \"github\": null,\n \"twitter\": \"https://api.twitter.com/1.1/users/show.json?id=1865385980&include_entities=1\"\n },\n \"giving\": \"0.00\",\n \"goal\": null,\n \"id\": 196181,\n \"number\": \"singular\",\n \"receiving\": \"0.00\",\n \"username\": \"gratitude_test\"\n}"
|
112
|
+
},
|
113
|
+
"http_version": null
|
114
|
+
},
|
115
|
+
"recorded_at": "Sat, 14 Sep 2013 23:38:19 GMT"
|
116
|
+
}
|
117
|
+
],
|
118
|
+
"recorded_with": "VCR 2.5.0"
|
119
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
{
|
2
|
+
"http_interactions": [
|
3
|
+
{
|
4
|
+
"request": {
|
5
|
+
"method": "get",
|
6
|
+
"uri": "https://www.gittip.com/johnkellyferguson/public.json",
|
7
|
+
"body": {
|
8
|
+
"encoding": "US-ASCII",
|
9
|
+
"string": ""
|
10
|
+
},
|
11
|
+
"headers": {
|
12
|
+
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"response": {
|
16
|
+
"status": {
|
17
|
+
"code": 302,
|
18
|
+
"message": "Found"
|
19
|
+
},
|
20
|
+
"headers": {
|
21
|
+
"Content-Type": [
|
22
|
+
"application/json"
|
23
|
+
],
|
24
|
+
"Date": [
|
25
|
+
"Sun, 15 Sep 2013 00:15:37 GMT"
|
26
|
+
],
|
27
|
+
"Location": [
|
28
|
+
"/JohnKellyFerguson/public.json"
|
29
|
+
],
|
30
|
+
"Server": [
|
31
|
+
"Aspen! Cheroot!"
|
32
|
+
],
|
33
|
+
"Set-Cookie": [
|
34
|
+
"csrf_token=wCYRGR91AtPXQ01kbdciHHjszc6D3rhj; expires=Sun, 14 Sep 2014 00:15:37 GMT; Path=/"
|
35
|
+
],
|
36
|
+
"Vary": [
|
37
|
+
"Cookie"
|
38
|
+
],
|
39
|
+
"X-Frame-Options": [
|
40
|
+
"SAMEORIGIN"
|
41
|
+
],
|
42
|
+
"X-Gittip-Version": [
|
43
|
+
"10.1.20"
|
44
|
+
],
|
45
|
+
"Content-Length": [
|
46
|
+
"525"
|
47
|
+
],
|
48
|
+
"Connection": [
|
49
|
+
"keep-alive"
|
50
|
+
]
|
51
|
+
},
|
52
|
+
"body": {
|
53
|
+
"encoding": "UTF-8",
|
54
|
+
"string": "<html>\n <head>\n <title>302 Found</title>\n <style>\n \n BODY {\n margin: 0;\n padding: 200px 0 0;\n text-align: center;\n font: normal 18pt/18pt Georgia, serif;\n }\n PRE {\n text-align: left;\n font: normal 10pt/12pt monospace;\n margin: 50px 200px 0;\n }\n </style>\n </head>\n <body>\n Found, program!\n <pre></pre>\n </body>\n</html>\n"
|
55
|
+
},
|
56
|
+
"http_version": null
|
57
|
+
},
|
58
|
+
"recorded_at": "Sun, 15 Sep 2013 00:15:38 GMT"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"request": {
|
62
|
+
"method": "get",
|
63
|
+
"uri": "https://www.gittip.com/JohnKellyFerguson/public.json",
|
64
|
+
"body": {
|
65
|
+
"encoding": "US-ASCII",
|
66
|
+
"string": ""
|
67
|
+
},
|
68
|
+
"headers": {
|
69
|
+
"Cookie": [
|
70
|
+
"csrf_token=wCYRGR91AtPXQ01kbdciHHjszc6D3rhj"
|
71
|
+
]
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"response": {
|
75
|
+
"status": {
|
76
|
+
"code": 200,
|
77
|
+
"message": "OK"
|
78
|
+
},
|
79
|
+
"headers": {
|
80
|
+
"Access-Control-Allow-Origin": [
|
81
|
+
"*"
|
82
|
+
],
|
83
|
+
"Content-Type": [
|
84
|
+
"application/json"
|
85
|
+
],
|
86
|
+
"Date": [
|
87
|
+
"Sun, 15 Sep 2013 00:15:38 GMT"
|
88
|
+
],
|
89
|
+
"Server": [
|
90
|
+
"Aspen! Cheroot!"
|
91
|
+
],
|
92
|
+
"Set-Cookie": [
|
93
|
+
"csrf_token=wCYRGR91AtPXQ01kbdciHHjszc6D3rhj; expires=Sun, 14 Sep 2014 00:15:38 GMT; Path=/"
|
94
|
+
],
|
95
|
+
"Vary": [
|
96
|
+
"Cookie"
|
97
|
+
],
|
98
|
+
"X-Frame-Options": [
|
99
|
+
"SAMEORIGIN"
|
100
|
+
],
|
101
|
+
"X-Gittip-Version": [
|
102
|
+
"10.1.20"
|
103
|
+
],
|
104
|
+
"Content-Length": [
|
105
|
+
"487"
|
106
|
+
],
|
107
|
+
"Connection": [
|
108
|
+
"keep-alive"
|
109
|
+
]
|
110
|
+
},
|
111
|
+
"body": {
|
112
|
+
"encoding": "UTF-8",
|
113
|
+
"string": "{\n \"avatar\": \"https://www.gravatar.com/avatar/b58b357a352eda178941fd2dfd5c6d5d.jpg?s=128\",\n \"elsewhere\": {\n \"bitbucket\": null,\n \"bountysource\": null,\n \"github\": \"https://api.github.com/users/JohnKellyFerguson\",\n \"twitter\": \"https://api.twitter.com/1.1/users/show.json?id=954373436&include_entities=1\"\n },\n \"giving\": null,\n \"goal\": \"5.00\",\n \"id\": 15885,\n \"number\": \"singular\",\n \"receiving\": \"0.00\",\n \"username\": \"JohnKellyFerguson\"\n}"
|
114
|
+
},
|
115
|
+
"http_version": null
|
116
|
+
},
|
117
|
+
"recorded_at": "Sun, 15 Sep 2013 00:15:39 GMT"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
"recorded_with": "VCR 2.5.0"
|
121
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
{
|
4
4
|
"request": {
|
5
5
|
"method": "get",
|
6
|
-
"uri": "https://www.gittip.com/
|
6
|
+
"uri": "https://www.gittip.com/gratitude_test/public.json",
|
7
7
|
"body": {
|
8
8
|
"encoding": "US-ASCII",
|
9
9
|
"string": ""
|
@@ -25,13 +25,13 @@
|
|
25
25
|
"application/json"
|
26
26
|
],
|
27
27
|
"Date": [
|
28
|
-
"
|
28
|
+
"Sun, 15 Sep 2013 00:01:27 GMT"
|
29
29
|
],
|
30
30
|
"Server": [
|
31
31
|
"Aspen! Cheroot!"
|
32
32
|
],
|
33
33
|
"Set-Cookie": [
|
34
|
-
"csrf_token=
|
34
|
+
"csrf_token=QdabBkoZ59hLsOWzefPWoY2YGTzrOuvT; expires=Sun, 14 Sep 2014 00:01:27 GMT; Path=/"
|
35
35
|
],
|
36
36
|
"Vary": [
|
37
37
|
"Cookie"
|
@@ -40,22 +40,22 @@
|
|
40
40
|
"SAMEORIGIN"
|
41
41
|
],
|
42
42
|
"X-Gittip-Version": [
|
43
|
-
"10.1.
|
43
|
+
"10.1.20"
|
44
44
|
],
|
45
45
|
"Content-Length": [
|
46
|
-
"
|
46
|
+
"423"
|
47
47
|
],
|
48
48
|
"Connection": [
|
49
49
|
"keep-alive"
|
50
50
|
]
|
51
51
|
},
|
52
52
|
"body": {
|
53
|
-
"encoding": "
|
54
|
-
"string": "{\n \"avatar\": \"https://
|
53
|
+
"encoding": "UTF-8",
|
54
|
+
"string": "{\n \"avatar\": \"https://abs.twimg.com/sticky/default_profile_images/default_profile_3.png\",\n \"elsewhere\": {\n \"bitbucket\": null,\n \"bountysource\": null,\n \"github\": null,\n \"twitter\": \"https://api.twitter.com/1.1/users/show.json?id=1865385980&include_entities=1\"\n },\n \"giving\": \"0.00\",\n \"id\": 196181,\n \"number\": \"singular\",\n \"receiving\": \"0.00\",\n \"username\": \"gratitude_test\"\n}"
|
55
55
|
},
|
56
56
|
"http_version": null
|
57
57
|
},
|
58
|
-
"recorded_at": "
|
58
|
+
"recorded_at": "Sun, 15 Sep 2013 00:01:28 GMT"
|
59
59
|
}
|
60
60
|
],
|
61
61
|
"recorded_with": "VCR 2.5.0"
|
@@ -19,126 +19,206 @@ describe Gratitude::Profile do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "instance methods" do
|
22
|
-
before do
|
23
|
-
VCR.insert_cassette "profile"
|
24
|
-
end
|
25
22
|
|
26
|
-
|
27
|
-
VCR.eject_cassette
|
28
|
-
end
|
23
|
+
context "a fully completed profile" do
|
29
24
|
|
30
|
-
|
25
|
+
before do
|
26
|
+
VCR.insert_cassette "complete_profile"
|
27
|
+
end
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
after do
|
30
|
+
VCR.eject_cassette
|
31
|
+
end
|
35
32
|
|
36
|
-
|
37
|
-
expect(profile).to respond_to(:response)
|
38
|
-
end
|
33
|
+
let(:complete_profile) { Gratitude::Profile.new("whit537") }
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
expect(profile.avatar_url).to eq("https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128")
|
35
|
+
it "should set the correct username" do
|
36
|
+
expect(complete_profile.username).to eq("whit537")
|
43
37
|
end
|
44
|
-
end
|
45
38
|
|
46
|
-
|
47
|
-
|
48
|
-
expect(profile.bitbucket_api_url).to eq("https://bitbucket.org/api/1.0/users/whit537")
|
39
|
+
it "should respond to #response" do
|
40
|
+
expect(complete_profile).to respond_to(:response)
|
49
41
|
end
|
50
|
-
end
|
51
42
|
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
describe "#avatar_url" do
|
44
|
+
it "should return the correct avatar url" do
|
45
|
+
expect(complete_profile.avatar_url).to eq("https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128")
|
46
|
+
end
|
55
47
|
end
|
56
|
-
end
|
57
48
|
|
58
|
-
|
59
|
-
|
60
|
-
|
49
|
+
describe "#bitbucket_api_url" do
|
50
|
+
it "should return the correct bitbucket api url" do
|
51
|
+
expect(complete_profile.bitbucket_api_url).to eq("https://bitbucket.org/api/1.0/users/whit537")
|
52
|
+
end
|
61
53
|
end
|
62
|
-
end
|
63
54
|
|
64
|
-
|
65
|
-
|
66
|
-
|
55
|
+
describe "#bitbucket_username" do
|
56
|
+
it "should return the correct bitbucket username" do
|
57
|
+
expect(complete_profile.bitbucket_username).to eq("whit537")
|
58
|
+
end
|
67
59
|
end
|
68
|
-
end
|
69
60
|
|
70
|
-
|
71
|
-
|
72
|
-
|
61
|
+
describe "#bountysource_api_url" do
|
62
|
+
it "should return the correct bountysource api url" do
|
63
|
+
expect(complete_profile.bountysource_api_url).to eq("https://api.bountysource.com/users/whit537")
|
64
|
+
end
|
73
65
|
end
|
74
|
-
end
|
75
66
|
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
describe "#bountysource_username" do
|
68
|
+
it "should return the correct bountysource username" do
|
69
|
+
expect(complete_profile.bountysource_username).to eq("whit537")
|
70
|
+
end
|
79
71
|
end
|
80
|
-
end
|
81
72
|
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
describe "#github_api_url" do
|
74
|
+
it "should return the correct github api url" do
|
75
|
+
expect(complete_profile.github_api_url).to eq("https://api.github.com/users/whit537")
|
76
|
+
end
|
85
77
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
78
|
+
|
79
|
+
describe "#github_username" do
|
80
|
+
it "should return the correct github username" do
|
81
|
+
expect(complete_profile.github_username).to eq("whit537")
|
82
|
+
end
|
91
83
|
end
|
92
|
-
end
|
93
84
|
|
94
|
-
|
85
|
+
describe "#twitter_api_url" do
|
86
|
+
it "should return the correct twitter api url" do
|
87
|
+
expect(complete_profile.twitter_api_url).to eq("https://api.twitter.com/1.1/users/show.json?id=34175404&include_entities=1")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "#twitter_username" do
|
92
|
+
it "should return nil" do
|
93
|
+
expect(complete_profile.twitter_username).to be(nil)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#amount_giving" do
|
98
|
+
it "should be a float" do
|
99
|
+
expect(complete_profile.amount_giving.class).to be(Float)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should return the correct amount giving" do
|
103
|
+
expect(complete_profile.amount_giving).to eq(101.41)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#amount_receiving" do
|
108
|
+
it "should be a float" do
|
109
|
+
expect(complete_profile.amount_receiving.class).to be(Float)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should return the correct amount amount receiving" do
|
113
|
+
expect(complete_profile.amount_receiving).to eq(434.25)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "#goal" do
|
118
|
+
it "should return the correct goal" do
|
119
|
+
expect(complete_profile.goal).to be(nil)
|
120
|
+
end
|
121
|
+
end
|
95
122
|
|
96
|
-
|
97
|
-
|
123
|
+
describe "#number" do
|
124
|
+
it "should return the correct number" do
|
125
|
+
expect(complete_profile.number).to eq("singular")
|
126
|
+
end
|
98
127
|
end
|
99
128
|
|
100
|
-
|
101
|
-
|
129
|
+
describe "#id" do
|
130
|
+
it "should be a fixnum" do
|
131
|
+
expect(complete_profile.id.class).to be(Fixnum)
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should return the correct id number" do
|
135
|
+
expect(complete_profile.id).to eq(1451)
|
136
|
+
end
|
102
137
|
end
|
103
138
|
|
104
139
|
end
|
105
140
|
|
106
|
-
|
141
|
+
context "an account that registered through twitter and linked no other accounts" do
|
142
|
+
|
143
|
+
before do
|
144
|
+
VCR.insert_cassette "incomplete_profile"
|
145
|
+
end
|
146
|
+
|
147
|
+
after do
|
148
|
+
VCR.eject_cassette
|
149
|
+
end
|
150
|
+
|
151
|
+
let(:incomplete_profile) { Gratitude::Profile.new("gratitude_test") }
|
152
|
+
|
107
153
|
|
108
|
-
|
109
|
-
|
154
|
+
describe "#bitbucket_api_url" do
|
155
|
+
it "should return nil" do
|
156
|
+
expect(incomplete_profile.bitbucket_api_url).to be(nil)
|
157
|
+
end
|
110
158
|
end
|
111
159
|
|
112
|
-
|
113
|
-
|
160
|
+
describe "#bitbucket_username" do
|
161
|
+
it "should return nil" do
|
162
|
+
expect(incomplete_profile.bitbucket_username).to be(nil)
|
163
|
+
end
|
114
164
|
end
|
115
165
|
|
116
|
-
|
166
|
+
describe "#bountysource_api_url" do
|
167
|
+
it "should return nil" do
|
168
|
+
expect(incomplete_profile.bountysource_api_url).to be(nil)
|
169
|
+
end
|
170
|
+
end
|
117
171
|
|
118
|
-
|
119
|
-
|
120
|
-
|
172
|
+
describe "#bountysource_username" do
|
173
|
+
it "should return nil" do
|
174
|
+
expect(incomplete_profile.bountysource_username).to be(nil)
|
175
|
+
end
|
121
176
|
end
|
122
|
-
end
|
123
177
|
|
124
|
-
|
125
|
-
|
126
|
-
|
178
|
+
describe "#github_api_url" do
|
179
|
+
it "should return nil" do
|
180
|
+
expect(incomplete_profile.github_api_url).to be(nil)
|
181
|
+
end
|
127
182
|
end
|
183
|
+
|
184
|
+
describe "#github_username" do
|
185
|
+
it "should return nil" do
|
186
|
+
expect(incomplete_profile.github_username).to be(nil)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "#goal" do
|
191
|
+
context "a user who has defined themselves as a patron" do
|
192
|
+
it "should return nil" do
|
193
|
+
expect(incomplete_profile.goal).to eq(nil)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
128
198
|
end
|
129
199
|
|
130
|
-
|
200
|
+
context "a profile that has defined a gittip goal" do
|
131
201
|
|
132
|
-
|
133
|
-
|
202
|
+
before do
|
203
|
+
VCR.insert_cassette "goal_profile"
|
134
204
|
end
|
135
205
|
|
136
|
-
|
137
|
-
|
206
|
+
after do
|
207
|
+
VCR.eject_cassette
|
138
208
|
end
|
209
|
+
|
210
|
+
|
211
|
+
let(:goal_profile) { Gratitude::Profile.new("johnkellyferguson") }
|
212
|
+
|
213
|
+
describe "#goal" do
|
214
|
+
it "should return the correct goal amount" do
|
215
|
+
expect(goal_profile.goal).to eq(5.00)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
139
219
|
end
|
140
220
|
|
141
221
|
|
142
|
-
end
|
222
|
+
end
|
143
223
|
|
144
224
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gratitude
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Kelly Ferguson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A simple Ruby wrapper for the Gittip API.
|
@@ -71,7 +71,9 @@ files:
|
|
71
71
|
- lib/gratitude.rb
|
72
72
|
- lib/gratitude/profile.rb
|
73
73
|
- lib/gratitude/version.rb
|
74
|
-
- spec/cassettes/
|
74
|
+
- spec/cassettes/complete_profile.json
|
75
|
+
- spec/cassettes/goal_profile.json
|
76
|
+
- spec/cassettes/incomplete_profile.json
|
75
77
|
- spec/gratitude/profile_spec.rb
|
76
78
|
- spec/gratitude/version_spec.rb
|
77
79
|
- spec/spec_helper.rb
|
@@ -85,22 +87,24 @@ require_paths:
|
|
85
87
|
- lib
|
86
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
89
|
requirements:
|
88
|
-
- -
|
90
|
+
- - '>='
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '0'
|
91
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
94
|
requirements:
|
93
|
-
- -
|
95
|
+
- - '>='
|
94
96
|
- !ruby/object:Gem::Version
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.0.3
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: A simple Ruby wrapper for the Gittip API.
|
102
104
|
test_files:
|
103
|
-
- spec/cassettes/
|
105
|
+
- spec/cassettes/complete_profile.json
|
106
|
+
- spec/cassettes/goal_profile.json
|
107
|
+
- spec/cassettes/incomplete_profile.json
|
104
108
|
- spec/gratitude/profile_spec.rb
|
105
109
|
- spec/gratitude/version_spec.rb
|
106
110
|
- spec/spec_helper.rb
|