gratitude 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +62 -24
- data/lib/gratitude/statistics.rb +4 -0
- data/lib/gratitude/version.rb +1 -1
- data/spec/cassettes/statistics.json +1 -59
- data/spec/gratitude/statistics_spec.rb +190 -190
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 702501d8e5569021fd461621963fe358ebd1f884
|
4
|
+
data.tar.gz: bce5748bcf60e3008309a34a43b11519291cdda9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 352f4798d33fccc21c119602c1b9f473592e0965e71a26cf47c36de38e62bc8033b2ae603eabfc664e4e970782f59a6c4e45870b0b0fa2f05c7e3a5117becbd3
|
7
|
+
data.tar.gz: 6d05accd6e7cfe014842a1b8e80c04b999dd6a477fbf7a20e150bafc10b59410fb92f2ae58fcf74bccc5b6e9c6d027e421ab48b85aae27f9c7d787212599afd2
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
### 0.1.0 (Upcoming Stable Release)
|
2
2
|
* Implement all aspects of the Gittip API.
|
3
3
|
|
4
|
+
### 0.0.6 (9/19/2013)
|
5
|
+
* Complete Gittip's Statistics API integration.
|
6
|
+
* Add more aliases and improve method clarity to signify method intent.
|
7
|
+
|
4
8
|
### 0.0.5 (9/17/2013)
|
5
9
|
* Complete Gittip's Paydays API integration.
|
6
10
|
* Add aliases for all methods to correspond to Gittip's original API documentation.
|
data/README.md
CHANGED
@@ -13,11 +13,11 @@ A simple Ruby wrapper for the [Gittip API](https://github.com/gittip/www.gittip.
|
|
13
13
|
|
14
14
|
|
15
15
|
# Installation
|
16
|
-
|
16
|
+
|
17
17
|
gem install gratitude
|
18
18
|
|
19
19
|
# Usage
|
20
|
-
|
20
|
+
|
21
21
|
The gratitude gem has four different components that interact with different aspects of the Gittip API. They are as follows:
|
22
22
|
|
23
23
|
* [Paydays](#paydays-source-code)
|
@@ -39,17 +39,17 @@ The above will return an array of Payday objects. Each Payday object responds to
|
|
39
39
|
* `ach_volume`
|
40
40
|
* `charge_fees_volume`
|
41
41
|
* `charge_volume`
|
42
|
-
* `number_of_achs`
|
43
|
-
* `number_active`
|
44
|
-
* `number_of_failing_credit_cards`
|
45
|
-
* `number_of_missing_credit_cards`
|
46
|
-
* `number_of_charges`
|
47
|
-
* `number_of_participants`
|
48
|
-
* `number_of_tippers`
|
49
|
-
* `number_of_transfers`
|
42
|
+
* `number_of_ach_credits` (aliases: `nachs` & `number_of_achs` )
|
43
|
+
* `number_of_active_users` (aliases: `nactive` & `number_active`)
|
44
|
+
* `number_of_failing_credit_cards` (alias: `ncc_failing`)
|
45
|
+
* `number_of_missing_credit_cards` (alias: `ncc_missing`)
|
46
|
+
* `number_of_charges` (alias: `ncharges`)
|
47
|
+
* `number_of_participants` (alias: `nparticipants`)
|
48
|
+
* `number_of_tippers` (alias: `ntippers`)
|
49
|
+
* `number_of_transfers` (alias: `ntransfers`)
|
50
50
|
* `transfer_volume`
|
51
|
-
* `ts_end`
|
52
|
-
* `ts_start`
|
51
|
+
* `transfer_end_time` (alias: `ts_end`)
|
52
|
+
* `transfer_start_time` (alias: `ts_start`)
|
53
53
|
|
54
54
|
You can then iterate through this array of payday objects to persist them to a database or get whatever information you need.
|
55
55
|
|
@@ -63,8 +63,46 @@ Finally, if you just want to get the most recent payday, you can do so by using:
|
|
63
63
|
|
64
64
|
Gratitude::Payday.most_recent
|
65
65
|
|
66
|
-
##Statistics
|
67
|
-
|
66
|
+
##Statistics ([source code](https://github.com/JohnKellyFerguson/gratitude/blob/master/lib/gratitude/statistics.rb))
|
67
|
+
The Statistics aspect of the Gittip API provides the current statistics, as of that moment in time, for Gittip. Note that these stats can potentially change when making subsequent requests.
|
68
|
+
|
69
|
+
If you would like to get the current Gittip stats, you can do so by using:
|
70
|
+
|
71
|
+
Gratitude::Statistics.current
|
72
|
+
|
73
|
+
Alternatively, you can also use:
|
74
|
+
|
75
|
+
Gratitude::Statistics.new
|
76
|
+
|
77
|
+
Each of the above will return an object containing all of the current Gittip stats. You can access each of the Gittip stats using the following methods:
|
78
|
+
|
79
|
+
* `average_tip_amount` (alias: `average_tip`)
|
80
|
+
* `average_number_of_tippees` (alias: `average_tippees`)
|
81
|
+
* `amount_in_escrow` (alias: `escrow`)
|
82
|
+
* `last_thursday`
|
83
|
+
* This refers to the last Thursday when payments/transfers occured. Possible values include: "last Thursday", "today", "yesterday", and "this past Thursday".
|
84
|
+
* `number_of_ach_credits` (aliases: `nach` & `number_of_achs`)
|
85
|
+
* `number_of_active_users` (alias: `nactive`)
|
86
|
+
* `number_of_credit_cards` (alias: `ncc`)
|
87
|
+
* `number_of_givers` (alias: `ngivers`)
|
88
|
+
* `number_who_give_and_receive` (alias: `noverlap`)
|
89
|
+
* `number_of_receivers` (alias: `nreceivers`)
|
90
|
+
* `other_people`
|
91
|
+
* This returns a string describing how many people the average person on Gittip tips.
|
92
|
+
* `percentage_of_users_with_credit_cards` (alias: `pcc`)
|
93
|
+
* `punctuation` (alias: `punc`)
|
94
|
+
* This is used internally by the Gittip API for figuring out `last_thursday` and `this_thursday`. It's unlikely that this will need to be utilized by anyone using the gratitude gem.
|
95
|
+
* `statements`
|
96
|
+
* This returns an array of 16 hashes. Each hash provides the personal statement of a Gittip user and has the following keys: `statement`, `username`. Note that this will return a different array of hashes each time you query the Gittip API.
|
97
|
+
* `this_thursday`
|
98
|
+
* This refers to the upcoming Thursday when payments/transfers are set to occur. Possible values include: "this Thursday", "today", "right now!", and "next Thursday"
|
99
|
+
* `tip_distribution_json`
|
100
|
+
* This returns a hash. Each key in the hash is a float which represents a tip amount (for example, $0.01, $0.25 or $1). The value of each key is an array. The first element in the array is an integer representing the total number of users who have pledged that amount. The second element in the array is a float which shows how much this tip amount makes up all of the possible tips. For example, the hash returned will look like the following: `{ 0.01: [11, 0.002153484729835552], … }`
|
101
|
+
|
102
|
+
In this example, the amount being tipped is $0.01. The amount of users tipping this amount is 11, and the total tip amount for this tip size makes up 0.2153484729835552% of all tips distributed. The hash will contain many more elements, each with the same structure.
|
103
|
+
* `number_of_tips` (alias: `tip_n`)
|
104
|
+
* `value_of_total_backed_tips` (alias: `total_backed_tips`)
|
105
|
+
* `transfer_volume`
|
68
106
|
|
69
107
|
##Profile ([source code](https://github.com/JohnKellyFerguson/gratitude/blob/master/lib/gratitude/profile.rb))
|
70
108
|
|
@@ -72,39 +110,39 @@ The Profile aspect of the Gittip API allows you to get the public profile inform
|
|
72
110
|
|
73
111
|
Gratitude::Profile.new("johnkellyferguson")
|
74
112
|
|
75
|
-
The
|
113
|
+
The above will retrieve the public profile of the above user. You can then access all of the different information with the following methods:
|
76
114
|
|
77
|
-
* `avatar_url`
|
78
|
-
* `bitbucket_api_url`
|
115
|
+
* `avatar_url` (alias: `avatar`)
|
116
|
+
* `bitbucket_api_url` (alias: `bitbucket`)
|
79
117
|
* returns the user's bitbucket api url if they have connected a bitbucket account.
|
80
118
|
* otherwise, returns `nil`.
|
81
119
|
* `bitbucket_username`
|
82
120
|
* returns the user's bitbucket username if they have connected a bitbucket account.
|
83
121
|
* otherwise, returns `nil`.
|
84
|
-
* `bountysource_api_url`
|
122
|
+
* `bountysource_api_url` (alias: `bountysource`)
|
85
123
|
* returns the user's bountysource api url if they have connected a bountysource account.
|
86
124
|
* otherwise, returns `nil`.
|
87
125
|
* `bountysource_username`
|
88
126
|
* returns the user's bountysource username if they have connected a bountysource account.
|
89
127
|
* otherwise, returns `nil`.
|
90
|
-
* `github_api_url`
|
128
|
+
* `github_api_url` (alias: `github`)
|
91
129
|
* returns the user's github api url if they have connected a github account.
|
92
130
|
* otherwise, returns `nil`.
|
93
131
|
* `github_username`
|
94
132
|
* returns the user's github username if they have connected a github account.
|
95
133
|
* otherwise, returns `nil`.
|
96
|
-
* `twitter_api_url`
|
134
|
+
* `twitter_api_url` (alias: `twitter`)
|
97
135
|
* returns the user's twitter api url if they have connected a twitter account.
|
98
136
|
* otherwise, returns `nil`.
|
99
|
-
* `amount_giving`
|
137
|
+
* `amount_giving` (alias: `giving`)
|
100
138
|
* returns the amount (as a float) the user has pledged to give this week.
|
101
139
|
* if the user has decided to donately privately then this will return 0.00.
|
102
|
-
* `amount_receiving`
|
140
|
+
* `amount_receiving` (alias: `receiving`)
|
103
141
|
* returns an estimate as a float of what the given user is expected to receive this week.
|
104
142
|
* `goal`
|
105
143
|
* returns the amount (as a float) that the user would like to receive weekly if the user set such a goal.
|
106
144
|
* returns `nil` if the user has defined themselves as a patron or has not set a specific monetary goal.
|
107
|
-
* `number`
|
145
|
+
* `account_type` (alias: `number`)
|
108
146
|
* returns either `'singular'` or `'plural'` representing the type of account the user has.
|
109
147
|
* `id`
|
110
148
|
* the id of the user.
|
@@ -112,7 +150,7 @@ The following will retrieve the public profile of the above user. You can then a
|
|
112
150
|
**TODO:** Implement the `my_tip` method into the Profile section once client authentication is finished.
|
113
151
|
|
114
152
|
##Tips
|
115
|
-
* **TODO:** Implement Gittip's
|
153
|
+
* **TODO:** Implement Gittip's Tips API into gratitude.
|
116
154
|
|
117
155
|
|
118
156
|
#### Copyright and License
|
data/lib/gratitude/statistics.rb
CHANGED
data/lib/gratitude/version.rb
CHANGED
@@ -1,59 +1 @@
|
|
1
|
-
{
|
2
|
-
"http_interactions": [
|
3
|
-
{
|
4
|
-
"request": {
|
5
|
-
"method": "get",
|
6
|
-
"uri": "https://www.gittip.com/about/stats.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
|
-
"Content-Type": [
|
22
|
-
"application/json"
|
23
|
-
],
|
24
|
-
"Date": [
|
25
|
-
"Tue, 17 Sep 2013 18:56:23 GMT"
|
26
|
-
],
|
27
|
-
"Server": [
|
28
|
-
"Aspen! Cheroot!"
|
29
|
-
],
|
30
|
-
"Set-Cookie": [
|
31
|
-
"csrf_token=Ucss1VG2RbUpKKnY4yYNUz8erAH6azfR; expires=Tue, 16 Sep 2014 18:56:23 GMT; Path=/"
|
32
|
-
],
|
33
|
-
"Vary": [
|
34
|
-
"Cookie"
|
35
|
-
],
|
36
|
-
"X-Frame-Options": [
|
37
|
-
"SAMEORIGIN"
|
38
|
-
],
|
39
|
-
"X-Gittip-Version": [
|
40
|
-
"10.1.21"
|
41
|
-
],
|
42
|
-
"Transfer-Encoding": [
|
43
|
-
"chunked"
|
44
|
-
],
|
45
|
-
"Connection": [
|
46
|
-
"keep-alive"
|
47
|
-
]
|
48
|
-
},
|
49
|
-
"body": {
|
50
|
-
"encoding": "UTF-8",
|
51
|
-
"string": "{\n \"average_tip\": 1.2348237280979523,\n \"average_tippees\": 3,\n \"escrow\": 50441.17,\n \"last_thursday\": \"last Thursday\",\n \"nach\": \"299\",\n \"nactive\": 1719,\n \"ncc\": 1496,\n \"ngivers\": 1113,\n \"noverlap\": 301,\n \"nreceivers\": 907,\n \"other_people\": \"three other people\",\n \"pcc\": \" 7.6\",\n \"punc\": \".\",\n \"statements\": [\n {\n \"statement\": \"hacking around and having fun building things.\",\n \"username\": \"cfontes\"\n },\n {\n \"statement\": \"making the world better by thinking.\",\n \"username\": \"inanisryoo\"\n },\n {\n \"statement\": \"working on open-source software for the web. I created the messaging library Faye, the password manager Vault and a bunch more besides.\",\n \"username\": \"jcoglan\"\n },\n {\n \"statement\": \"maintaining various Ruby open-source projects (rails_admin, twitter, omniauth, thor, multi_json, multi_xml, faraday, delayed_job, etc.)\",\n \"username\": \"sferik\"\n },\n {\n \"statement\": \"making it easier to retrieve Google Analytics data and build amazing dashboards!\",\n \"username\": \"OOcharts\"\n },\n {\n \"statement\": \"Building free WordPress plugins and themes for others to use\",\n \"username\": \"sumobi_\"\n },\n {\n \"statement\": \"writing the code :)\",\n \"username\": \"torkve\"\n },\n {\n \"statement\": \"contributing to various projects I'm interested in. I'm not a real programmer or anything, though--just going through the motions and pretending to know what I'm doing.\\n\\nYour tips are probably better spent elsewhere, but here are some projects I will commit to at different funding levels:\\n\\n- $2/week: Fix outstanding issues in my projects on Github.\\n- $5/week: Open-source a useful iOS library. \\n- $15/week: Open-source an iOS side-scrolling game and make at least 3 non-trivial pull requests on cocos2d-iphone.\\n- $25+/week: Embark on an open-source pilgrimage.\\n\",\n \"username\": \"modocache\"\n },\n {\n \"statement\": \"contributes to GitHub repos: https://github.com/lexrus\\nand create some useful open source projects.\",\n \"username\": \"Lex\"\n },\n {\n \"statement\": \"developing XBMC add-ons.\",\n \"username\": \"sphere\"\n },\n {\n \"statement\": \"writing software\",\n \"username\": \"mamby\"\n },\n {\n \"statement\": \"making sure nobody gets my username on here :P\",\n \"username\": \"clarkeash\"\n },\n {\n \"statement\": \"I write small tools and libraries. Most of them pass by unnoticed in the night but I also contribute to projects semi regularly. Check my github profile to see what I've been working on.\",\n \"username\": \"wraithan\"\n },\n {\n \"statement\": \"We made some simple CMS\\nhttps://github.com/iDenn/AVE.cms\",\n \"username\": \"iDenn\"\n },\n {\n \"statement\": \"writing, maintaining and extending the console file manager \\\"ranger\\\" which is available on a variety of operating systems. See http://ranger.nongnu.org/\",\n \"username\": \"hut\"\n },\n {\n \"statement\": \"teaching others for free! I also contribute to open-source platforms regularly.\",\n \"username\": \"TerryHarveyMe\"\n }\n ],\n \"this_thursday\": \"this Thursday\",\n \"tip_distribution_json\": {\n \"0.01\": [\n 5,\n 0.0010615711252653928\n ],\n \"0.02\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.03\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.05\": [\n 14,\n 0.0029723991507431\n ],\n \"0.08\": [\n 36,\n 0.007643312101910828\n ],\n \"0.10\": [\n 16,\n 0.003397027600849257\n ],\n \"0.11\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.12\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.15\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.16\": [\n 27,\n 0.005732484076433121\n ],\n \"0.20\": [\n 6,\n 0.0012738853503184713\n ],\n \"0.21\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.25\": [\n 1970,\n 0.4182590233545648\n ],\n \"0.26\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.28\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.29\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.30\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.32\": [\n 16,\n 0.003397027600849257\n ],\n \"0.40\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.42\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.45\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.48\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.50\": [\n 131,\n 0.02781316348195329\n ],\n \"0.52\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.57\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.64\": [\n 8,\n 0.0016985138004246285\n ],\n \"0.65\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.75\": [\n 20,\n 0.004246284501061571\n ],\n \"0.76\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.79\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.95\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.00\": [\n 1457,\n 0.30934182590233544\n ],\n \"1.10\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.11\": [\n 2,\n 0.0004246284501061571\n ],\n \"1.12\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.20\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.25\": [\n 15,\n 0.0031847133757961785\n ],\n \"1.28\": [\n 11,\n 0.002335456475583864\n ],\n \"1.35\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.49\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.50\": [\n 23,\n 0.004883227176220807\n ],\n \"1.70\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.85\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.92\": [\n 1,\n 0.00021231422505307856\n ],\n \"10.00\": [\n 53,\n 0.011252653927813163\n ],\n \"10.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"100.00\": [\n 9,\n 0.001910828025477707\n ],\n \"12.00\": [\n 51,\n 0.010828025477707006\n ],\n \"15.00\": [\n 3,\n 0.0006369426751592356\n ],\n \"19.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"19.25\": [\n 1,\n 0.00021231422505307856\n ],\n \"2.00\": [\n 176,\n 0.037367303609341825\n ],\n \"2.22\": [\n 1,\n 0.00021231422505307856\n ],\n \"2.25\": [\n 3,\n 0.0006369426751592356\n ],\n \"2.50\": [\n 13,\n 0.002760084925690021\n ],\n \"20.00\": [\n 10,\n 0.0021231422505307855\n ],\n \"24.00\": [\n 75,\n 0.01592356687898089\n ],\n \"24.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"25.00\": [\n 12,\n 0.0025477707006369425\n ],\n \"27.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"3.00\": [\n 307,\n 0.06518046709129512\n ],\n \"3.33\": [\n 2,\n 0.0004246284501061571\n ],\n \"30.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"35.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.00\": [\n 18,\n 0.003821656050955414\n ],\n \"4.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.80\": [\n 1,\n 0.00021231422505307856\n ],\n \"40.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"5.00\": [\n 66,\n 0.014012738853503185\n ],\n \"5.50\": [\n 3,\n 0.0006369426751592356\n ],\n \"5.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"50.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"51.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"6.00\": [\n 85,\n 0.018046709129511677\n ],\n \"6.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"65.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"7.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"7.25\": [\n 1,\n 0.00021231422505307856\n ],\n \"7.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"75.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"8.00\": [\n 6,\n 0.0012738853503184713\n ],\n \"8.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"8.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"9.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"9.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"9.99\": [\n 1,\n 0.00021231422505307856\n ]\n },\n \"tip_n\": 4710,\n \"total_backed_tips\": 5849.36,\n \"transfer_volume\": 5464.38\n}\n"
|
52
|
-
},
|
53
|
-
"http_version": null
|
54
|
-
},
|
55
|
-
"recorded_at": "Tue, 17 Sep 2013 18:56:22 GMT"
|
56
|
-
}
|
57
|
-
],
|
58
|
-
"recorded_with": "VCR 2.5.0"
|
59
|
-
}
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.gittip.com/about/stats.json","body":{"encoding":"US-ASCII","string":""},"headers":{}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Content-Type":["application/json"],"Date":["Tue, 17 Sep 2013 18:56:23 GMT"],"Server":["Aspen! Cheroot!"],"Set-Cookie":["csrf_token=Ucss1VG2RbUpKKnY4yYNUz8erAH6azfR; expires=Tue, 16 Sep 2014 18:56:23 GMT; Path=/"],"Vary":["Cookie"],"X-Frame-Options":["SAMEORIGIN"],"X-Gittip-Version":["10.1.21"],"Transfer-Encoding":["chunked"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"{\n \"average_tip\": 1.2348237280979523,\n \"average_tippees\": 3,\n \"escrow\": 50441.17,\n \"last_thursday\": \"last Thursday\",\n \"nach\": \"299\",\n \"nactive\": 1719,\n \"ncc\": 1496,\n \"ngivers\": 1113,\n \"noverlap\": 301,\n \"nreceivers\": 907,\n \"other_people\": \"three other people\",\n \"pcc\": \" 7.6\",\n \"punc\": \".\",\n \"statements\": [\n {\n \"statement\": \"hacking around and having fun building things.\",\n \"username\": \"cfontes\"\n },\n {\n \"statement\": \"making the world better by thinking.\",\n \"username\": \"inanisryoo\"\n },\n {\n \"statement\": \"working on open-source software for the web. I created the messaging library Faye, the password manager Vault and a bunch more besides.\",\n \"username\": \"jcoglan\"\n },\n {\n \"statement\": \"maintaining various Ruby open-source projects (rails_admin, twitter, omniauth, thor, multi_json, multi_xml, faraday, delayed_job, etc.)\",\n \"username\": \"sferik\"\n },\n {\n \"statement\": \"making it easier to retrieve Google Analytics data and build amazing dashboards!\",\n \"username\": \"OOcharts\"\n },\n {\n \"statement\": \"Building free WordPress plugins and themes for others to use\",\n \"username\": \"sumobi_\"\n },\n {\n \"statement\": \"writing the code :)\",\n \"username\": \"torkve\"\n },\n {\n \"statement\": \"contributing to various projects I'm interested in. I'm not a real programmer or anything, though--just going through the motions and pretending to know what I'm doing.\\n\\nYour tips are probably better spent elsewhere, but here are some projects I will commit to at different funding levels:\\n\\n- $2/week: Fix outstanding issues in my projects on Github.\\n- $5/week: Open-source a useful iOS library. \\n- $15/week: Open-source an iOS side-scrolling game and make at least 3 non-trivial pull requests on cocos2d-iphone.\\n- $25+/week: Embark on an open-source pilgrimage.\\n\",\n \"username\": \"modocache\"\n },\n {\n \"statement\": \"contributes to GitHub repos: https://github.com/lexrus\\nand create some useful open source projects.\",\n \"username\": \"Lex\"\n },\n {\n \"statement\": \"developing XBMC add-ons.\",\n \"username\": \"sphere\"\n },\n {\n \"statement\": \"writing software\",\n \"username\": \"mamby\"\n },\n {\n \"statement\": \"making sure nobody gets my username on here :P\",\n \"username\": \"clarkeash\"\n },\n {\n \"statement\": \"I write small tools and libraries. Most of them pass by unnoticed in the night but I also contribute to projects semi regularly. Check my github profile to see what I've been working on.\",\n \"username\": \"wraithan\"\n },\n {\n \"statement\": \"We made some simple CMS\\nhttps://github.com/iDenn/AVE.cms\",\n \"username\": \"iDenn\"\n },\n {\n \"statement\": \"writing, maintaining and extending the console file manager \\\"ranger\\\" which is available on a variety of operating systems. See http://ranger.nongnu.org/\",\n \"username\": \"hut\"\n },\n {\n \"statement\": \"teaching others for free! I also contribute to open-source platforms regularly.\",\n \"username\": \"TerryHarveyMe\"\n }\n ],\n \"this_thursday\": \"this Thursday\",\n \"tip_distribution_json\": {\n \"0.01\": [\n 5,\n 0.0010615711252653928\n ],\n \"0.02\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.03\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.05\": [\n 14,\n 0.0029723991507431\n ],\n \"0.08\": [\n 36,\n 0.007643312101910828\n ],\n \"0.10\": [\n 16,\n 0.003397027600849257\n ],\n \"0.11\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.12\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.15\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.16\": [\n 27,\n 0.005732484076433121\n ],\n \"0.20\": [\n 6,\n 0.0012738853503184713\n ],\n \"0.21\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.25\": [\n 1970,\n 0.4182590233545648\n ],\n \"0.26\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.28\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.29\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.30\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.32\": [\n 16,\n 0.003397027600849257\n ],\n \"0.40\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.42\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.45\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.48\": [\n 2,\n 0.0004246284501061571\n ],\n \"0.50\": [\n 131,\n 0.02781316348195329\n ],\n \"0.52\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.57\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.64\": [\n 8,\n 0.0016985138004246285\n ],\n \"0.65\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.75\": [\n 20,\n 0.004246284501061571\n ],\n \"0.76\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.79\": [\n 1,\n 0.00021231422505307856\n ],\n \"0.95\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.00\": [\n 1457,\n 0.30934182590233544\n ],\n \"1.10\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.11\": [\n 2,\n 0.0004246284501061571\n ],\n \"1.12\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.20\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.25\": [\n 15,\n 0.0031847133757961785\n ],\n \"1.28\": [\n 11,\n 0.002335456475583864\n ],\n \"1.35\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.49\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.50\": [\n 23,\n 0.004883227176220807\n ],\n \"1.70\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.85\": [\n 1,\n 0.00021231422505307856\n ],\n \"1.92\": [\n 1,\n 0.00021231422505307856\n ],\n \"10.00\": [\n 53,\n 0.011252653927813163\n ],\n \"10.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"100.00\": [\n 9,\n 0.001910828025477707\n ],\n \"12.00\": [\n 51,\n 0.010828025477707006\n ],\n \"15.00\": [\n 3,\n 0.0006369426751592356\n ],\n \"19.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"19.25\": [\n 1,\n 0.00021231422505307856\n ],\n \"2.00\": [\n 176,\n 0.037367303609341825\n ],\n \"2.22\": [\n 1,\n 0.00021231422505307856\n ],\n \"2.25\": [\n 3,\n 0.0006369426751592356\n ],\n \"2.50\": [\n 13,\n 0.002760084925690021\n ],\n \"20.00\": [\n 10,\n 0.0021231422505307855\n ],\n \"24.00\": [\n 75,\n 0.01592356687898089\n ],\n \"24.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"25.00\": [\n 12,\n 0.0025477707006369425\n ],\n \"27.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"3.00\": [\n 307,\n 0.06518046709129512\n ],\n \"3.33\": [\n 2,\n 0.0004246284501061571\n ],\n \"30.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"35.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.00\": [\n 18,\n 0.003821656050955414\n ],\n \"4.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"4.80\": [\n 1,\n 0.00021231422505307856\n ],\n \"40.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"5.00\": [\n 66,\n 0.014012738853503185\n ],\n \"5.50\": [\n 3,\n 0.0006369426751592356\n ],\n \"5.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"50.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"51.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"6.00\": [\n 85,\n 0.018046709129511677\n ],\n \"6.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"65.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"7.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"7.25\": [\n 1,\n 0.00021231422505307856\n ],\n \"7.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"75.00\": [\n 1,\n 0.00021231422505307856\n ],\n \"8.00\": [\n 6,\n 0.0012738853503184713\n ],\n \"8.50\": [\n 1,\n 0.00021231422505307856\n ],\n \"8.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"9.00\": [\n 2,\n 0.0004246284501061571\n ],\n \"9.75\": [\n 1,\n 0.00021231422505307856\n ],\n \"9.99\": [\n 1,\n 0.00021231422505307856\n ]\n },\n \"tip_n\": 4710,\n \"total_backed_tips\": 5849.36,\n \"transfer_volume\": 5464.38\n}\n"},"http_version":null},"recorded_at":"Tue, 17 Sep 2013 18:56:22 GMT"},{"request":{"method":"get","uri":"https://www.gittip.com/about/stats.json","body":{"encoding":"US-ASCII","string":""},"headers":{}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Content-Type":["application/json"],"Date":["Sun, 13 Oct 2013 04:47:24 GMT"],"Server":["Aspen! Cheroot!"],"Set-Cookie":["csrf_token=GHJHQXG7SGEkeUFPnfwCWGlt60eCXxyv; expires=Sun, 12 Oct 2014 04:47:24 GMT; Path=/"],"Vary":["Cookie"],"X-Frame-Options":["SAMEORIGIN"],"X-Gittip-Version":["10.1.33"],"Content-Length":["12019"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"{\n \"average_tip\": 1.2343877749659334,\n \"average_tippees\": 3,\n \"escrow\": 56318.53,\n \"last_thursday\": \"last Thursday\",\n \"nach\": \"317\",\n \"nactive\": 1851,\n \"ncc\": 1584,\n \"ngivers\": 1193,\n \"noverlap\": 328,\n \"nreceivers\": 986,\n \"other_people\": \"three other people\",\n \"pcc\": \" 7.7\",\n \"punc\": \".\",\n \"statements\": [\n {\n \"statement\": \"writing web apps (some free and open source) and giving talks at local user groups. I'm currently founding a local user group for JavaScript devs (HartfordJS).\",\n \"username\": \"willklein\"\n },\n {\n \"statement\": \"Providing better services for medical industry!\",\n \"username\": \"sivajankan\"\n },\n {\n \"statement\": \"supporting the proliferation and unfettered access of knowledge as an essential mechanism in the pursuit of just society. \",\n \"username\": \"wrought\"\n },\n {\n \"statement\": \"creating and sharing Moodle theme's that help make it look more engaging and professional. If you like my themes and want to support me in making more, I'm always open to assistance.\\n\\nI also accept Beer and chocolate!\\n\\nJulian (@Moodleman) Ridden\",\n \"username\": \"moodleman\"\n },\n {\n \"statement\": \"Promoting FLOSS with my Linux use and attempting to entertain the world with great games!\",\n \"username\": \"dabbertorres\"\n },\n {\n \"statement\": \"publishing News about Art and Culture, promoting Artists of all kinds. \\n\\nOur funding goal is to collect donations for needy Artists. \\n\\nFor Authors we publish free of charge on \\nhttp://www.pressenet.info/ \\n\\nContact us: \\nhttp://www.pressenet.info/kontakt.html\\n\\n\\n\\n\",\n \"username\": \"pressenet\"\n },\n {\n \"statement\": \"fostering caring for animals without homes till they find their forever home and also by offering free web development work to charities.\\n\\n I am currently also volunteering as a marketing manager & publicist for the Sydney Intercultural film festival promoting cultural diversity in film and media. check out www.siff.org.au\",\n \"username\": \"cordiervoodoo\"\n },\n {\n \"statement\": \"making tools to make development easier.\",\n \"username\": \"fjolnir\"\n },\n {\n \"statement\": \"contributing to open source projects like Composer, phpBB, Symfony, Doctrine and many more.\",\n \"username\": \"naderman\"\n },\n {\n \"statement\": \"giving developers an easy way to compare JavaScript MV* frameworks, through projects like TodoMVC and upcoming larger efforts like TasteJS and TasteStack.\\n\\nAny tips earned will be used to fund stickers, t-shirts and swag as a thank you to developers making significant open-source contributions back to our projects.\",\n \"username\": \"tastejs\"\n },\n {\n \"statement\": \"writing software, mostly in javascript, and giving it away. I am far more likely to donate here than to receive, but hey, if you find my work helpful, go for it.\",\n \"username\": \"ceejbot\"\n },\n {\n \"statement\": \"writing and correcting the code in opensource projects..\",\n \"username\": \"sadfuzzy\"\n },\n {\n \"statement\": \"Software Developer who is driven by innovation and help others new technology\",\n \"username\": \"AbhiLegend\"\n },\n {\n \"statement\": \"creating tools for JavaScript developers that improve user experience and life.\\n\\nCurrently I am working on adaptive components for AngularJS https://github.com/angular-adaptive\\n\\nI am creator of Gyrocopter - gyroscope simulator for Chrome browser https://github.com/janantala/Gyrocopter\\n\\nI am also developing applications for non profit organization United https://github.com/OZ-United\",\n \"username\": \"janantala\"\n },\n {\n \"statement\": \"creating Applications and tools for developers, give lessons for beginners ,participation in conferences and web meetings to exchange information.\\n\\nI also run a local group to help the beginner in the implementation of their ideas and their applications in fact.\",\n \"username\": \"Medhat\"\n },\n {\n \"statement\": \"putting the \\\"fun\\\" in \\\"i put the 'fun' in 'i put the `fun` in `i put the *fun* in *recursive functions are bullshit*`'\\\"\",\n \"username\": \"gjtorikian\"\n }\n ],\n \"this_thursday\": \"this Thursday\",\n \"tip_distribution_json\": {\n \"0.01\": [\n 11,\n 0.002153484729835552\n ],\n \"0.02\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.03\": [\n 2,\n 0.00039154267815191856\n ],\n \"0.05\": [\n 14,\n 0.00274079874706343\n ],\n \"0.08\": [\n 44,\n 0.008613938919342208\n ],\n \"0.10\": [\n 24,\n 0.004698512137823023\n ],\n \"0.11\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.12\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.15\": [\n 5,\n 0.0009788566953797965\n ],\n \"0.16\": [\n 27,\n 0.0052858261550509005\n ],\n \"0.20\": [\n 5,\n 0.0009788566953797965\n ],\n \"0.21\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.25\": [\n 2049,\n 0.40113547376664055\n ],\n \"0.26\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.28\": [\n 2,\n 0.00039154267815191856\n ],\n \"0.29\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.30\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.32\": [\n 16,\n 0.0031323414252153485\n ],\n \"0.40\": [\n 4,\n 0.0007830853563038371\n ],\n \"0.41\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.42\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.45\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.48\": [\n 2,\n 0.00039154267815191856\n ],\n \"0.50\": [\n 193,\n 0.037783868441660144\n ],\n \"0.52\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.57\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.58\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.64\": [\n 22,\n 0.004306969459671104\n ],\n \"0.65\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.75\": [\n 26,\n 0.005090054815974941\n ],\n \"0.76\": [\n 1,\n 0.00019577133907595928\n ],\n \"0.95\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.00\": [\n 1507,\n 0.2950274079874706\n ],\n \"1.10\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.11\": [\n 2,\n 0.00039154267815191856\n ],\n \"1.12\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.25\": [\n 19,\n 0.0037196554424432263\n ],\n \"1.28\": [\n 12,\n 0.0023492560689115116\n ],\n \"1.50\": [\n 26,\n 0.005090054815974941\n ],\n \"1.70\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.79\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.85\": [\n 1,\n 0.00019577133907595928\n ],\n \"1.92\": [\n 1,\n 0.00019577133907595928\n ],\n \"10.00\": [\n 72,\n 0.014095536413469069\n ],\n \"10.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"100.00\": [\n 10,\n 0.001957713390759593\n ],\n \"12.00\": [\n 51,\n 0.009984338292873924\n ],\n \"13.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"15.00\": [\n 6,\n 0.0011746280344557558\n ],\n \"19.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"19.25\": [\n 1,\n 0.00019577133907595928\n ],\n \"2.00\": [\n 262,\n 0.05129209083790133\n ],\n \"2.22\": [\n 1,\n 0.00019577133907595928\n ],\n \"2.25\": [\n 5,\n 0.0009788566953797965\n ],\n \"2.50\": [\n 13,\n 0.0025450274079874707\n ],\n \"2.58\": [\n 1,\n 0.00019577133907595928\n ],\n \"2.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"20.00\": [\n 9,\n 0.0017619420516836336\n ],\n \"24.00\": [\n 75,\n 0.014682850430696946\n ],\n \"24.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"25.00\": [\n 12,\n 0.0023492560689115116\n ],\n \"27.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"3.00\": [\n 310,\n 0.060689115113547375\n ],\n \"3.25\": [\n 1,\n 0.00019577133907595928\n ],\n \"3.33\": [\n 2,\n 0.00039154267815191856\n ],\n \"30.00\": [\n 2,\n 0.00039154267815191856\n ],\n \"35.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"4.00\": [\n 24,\n 0.004698512137823023\n ],\n \"4.50\": [\n 1,\n 0.00019577133907595928\n ],\n \"4.80\": [\n 1,\n 0.00019577133907595928\n ],\n \"40.00\": [\n 2,\n 0.00039154267815191856\n ],\n \"45.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"5.00\": [\n 87,\n 0.017032106499608457\n ],\n \"5.50\": [\n 3,\n 0.0005873140172278779\n ],\n \"5.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"50.00\": [\n 2,\n 0.00039154267815191856\n ],\n \"51.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"6.00\": [\n 86,\n 0.016836335160532498\n ],\n \"6.50\": [\n 1,\n 0.00019577133907595928\n ],\n \"60.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"65.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"7.00\": [\n 2,\n 0.00039154267815191856\n ],\n \"7.25\": [\n 1,\n 0.00019577133907595928\n ],\n \"7.50\": [\n 1,\n 0.00019577133907595928\n ],\n \"7.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"8.00\": [\n 9,\n 0.0017619420516836336\n ],\n \"8.50\": [\n 2,\n 0.00039154267815191856\n ],\n \"8.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"80.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"9.00\": [\n 1,\n 0.00019577133907595928\n ],\n \"9.75\": [\n 1,\n 0.00019577133907595928\n ],\n \"9.99\": [\n 1,\n 0.00019577133907595928\n ]\n },\n \"tip_n\": 5108,\n \"total_backed_tips\": 6341.05,\n \"transfer_volume\": 6630.89\n}\n"},"http_version":null},"recorded_at":"Sun, 13 Oct 2013 04:47:25 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -16,272 +16,272 @@ describe Gratitude::Statistics do
|
|
16
16
|
describe "instance methods" do
|
17
17
|
|
18
18
|
before do
|
19
|
-
|
20
|
-
|
19
|
+
VCR.insert_cassette "statistics"
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
after do
|
23
|
+
VCR.eject_cassette
|
24
|
+
end
|
25
25
|
|
26
|
-
|
26
|
+
let(:stats) { Gratitude::Statistics.current }
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
it "should respond to #repsonse" do
|
29
|
+
expect(stats).to respond_to(:response)
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
describe "#average_tip_amount" do
|
33
|
+
it "should return the correct average tip amount" do
|
34
|
+
expect(stats.average_tip_amount).to eq(1.2348237280979524)
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
it "should return a float" do
|
38
|
+
expect(stats.average_tip_amount.class).to be(Float)
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
end
|
41
|
+
it "should return the same value as its alias: #average_tip" do
|
42
|
+
expect(stats.average_tip_amount).to eq(stats.average_tip)
|
44
43
|
end
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
describe "#average_number_of_tippees" do
|
47
|
+
it "should return the correct average number of tippees" do
|
48
|
+
expect(stats.average_number_of_tippees).to eq(3)
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
it "should return a fixnum" do
|
52
|
+
expect(stats.average_number_of_tippees.class).to be(Fixnum)
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
end
|
55
|
+
it "should return the same value as its alias: #average_tippees" do
|
56
|
+
expect(stats.average_number_of_tippees).to eq(stats.average_tippees)
|
58
57
|
end
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
describe "#amount_in_escrow" do
|
61
|
+
it "should return the correct amount in escrow" do
|
62
|
+
expect(stats.amount_in_escrow).to eq(50441.17)
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
it "should return a float" do
|
66
|
+
expect(stats.amount_in_escrow.class).to be(Float)
|
67
|
+
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
end
|
69
|
+
it "should return the same value as its alias: #escrow" do
|
70
|
+
expect(stats.amount_in_escrow).to eq(stats.escrow)
|
72
71
|
end
|
72
|
+
end
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
describe "#last_thursday" do
|
75
|
+
it "should return the correct value for last thursday" do
|
76
|
+
expect(stats.last_thursday).to eq("last Thursday")
|
77
|
+
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
end
|
79
|
+
it "should be a string" do
|
80
|
+
expect(stats.last_thursday.class).to be(String)
|
82
81
|
end
|
82
|
+
end
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
describe "#number_of_achs" do
|
85
|
+
it "should return the correct number of ach credits" do
|
86
|
+
expect(stats.number_of_ach_credits).to eq(299)
|
87
|
+
end
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
it "should be a fixnum" do
|
90
|
+
expect(stats.number_of_ach_credits.class).to be(Fixnum)
|
91
|
+
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
it "should return the same value as its alias: #nach" do
|
94
|
+
expect(stats.number_of_ach_credits).to eq(stats.nach)
|
95
|
+
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
end
|
97
|
+
it "should return the same value as its alias: #number_of_achs" do
|
98
|
+
expect(stats.number_of_ach_credits).to eq(stats.number_of_achs)
|
100
99
|
end
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
describe "#number_of_active_users" do
|
103
|
+
it "should return the correct number of active users" do
|
104
|
+
expect(stats.number_of_active_users).to eq(1719)
|
105
|
+
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
it "should be a fixnum" do
|
108
|
+
expect(stats.number_of_active_users.class).to be(Fixnum)
|
109
|
+
end
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
end
|
111
|
+
it "should return the same value as its alias: #nactive" do
|
112
|
+
expect(stats.number_of_active_users).to eq(stats.nactive)
|
114
113
|
end
|
114
|
+
end
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
describe "#number_of_credit_cards" do
|
117
|
+
it "should return the correct number of credit cards on file" do
|
118
|
+
expect(stats.number_of_credit_cards).to eq(1496)
|
119
|
+
end
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
it "should be a fixnum" do
|
122
|
+
expect(stats.number_of_credit_cards.class).to be(Fixnum)
|
123
|
+
end
|
124
124
|
|
125
|
-
|
126
|
-
|
127
|
-
end
|
125
|
+
it "should return the same value as its alias: #ncc" do
|
126
|
+
expect(stats.number_of_credit_cards).to eq(stats.ncc)
|
128
127
|
end
|
128
|
+
end
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
describe "#number_of_givers" do
|
131
|
+
it "should return the correct number of givers" do
|
132
|
+
expect(stats.number_of_givers).to eq(1113)
|
133
|
+
end
|
134
134
|
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
it "should be a fixnum" do
|
136
|
+
expect(stats.number_of_givers.class).to be(Fixnum)
|
137
|
+
end
|
138
138
|
|
139
|
-
|
140
|
-
|
141
|
-
end
|
139
|
+
it "should return the same value as its alias: #ngivers" do
|
140
|
+
expect(stats.number_of_givers).to eq(stats.ngivers)
|
142
141
|
end
|
142
|
+
end
|
143
143
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
144
|
+
describe "#number_who_give_and_receive" do
|
145
|
+
it "should return the correct number of users who both give and receive" do
|
146
|
+
expect(stats.number_who_give_and_receive).to eq(301)
|
147
|
+
end
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
it "should be a fixnum" do
|
150
|
+
expect(stats.number_who_give_and_receive.class).to be(Fixnum)
|
151
|
+
end
|
152
152
|
|
153
|
-
|
154
|
-
|
155
|
-
end
|
153
|
+
it "should return the same value as its alias: #noverlap" do
|
154
|
+
expect(stats.number_who_give_and_receive).to eq(stats.noverlap)
|
156
155
|
end
|
156
|
+
end
|
157
157
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
158
|
+
describe "#number_of_receivers" do
|
159
|
+
it "should return the correct number of receivers" do
|
160
|
+
expect(stats.number_of_receivers).to eq(907)
|
161
|
+
end
|
162
162
|
|
163
|
-
|
164
|
-
|
165
|
-
|
163
|
+
it "should be a fixnum" do
|
164
|
+
expect(stats.number_of_receivers.class).to be(Fixnum)
|
165
|
+
end
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
end
|
167
|
+
it "should return the same value as its alias: #nreceivers" do
|
168
|
+
expect(stats.number_of_receivers).to eq(stats.nreceivers)
|
170
169
|
end
|
170
|
+
end
|
171
171
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
describe "#other_people" do
|
173
|
+
it "should return the correct value for #other_people" do
|
174
|
+
expect(stats.other_people).to eq("three other people")
|
175
|
+
end
|
176
176
|
|
177
|
-
|
178
|
-
|
179
|
-
end
|
177
|
+
it "should be a string" do
|
178
|
+
expect(stats.other_people.class).to be(String)
|
180
179
|
end
|
180
|
+
end
|
181
181
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
182
|
+
describe "#percentage_of_users_with_credit_cards" do
|
183
|
+
it "should return the correct value for #percentage_of_users_with_credit_cards" do
|
184
|
+
expect(stats.percentage_of_users_with_credit_cards).to eq("7.6")
|
185
|
+
end
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
|
187
|
+
it "should be a string" do
|
188
|
+
expect(stats.percentage_of_users_with_credit_cards.class).to be(String)
|
189
|
+
end
|
190
190
|
|
191
|
-
|
192
|
-
|
193
|
-
end
|
191
|
+
it "should return the same value as its alias: #pcc" do
|
192
|
+
expect(stats.percentage_of_users_with_credit_cards).to eq(stats.pcc)
|
194
193
|
end
|
194
|
+
end
|
195
195
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
196
|
+
describe "#punctuation" do
|
197
|
+
it "should return the correct value for #punctuation" do
|
198
|
+
expect(stats.punctuation).to eq(".")
|
199
|
+
end
|
200
200
|
|
201
|
-
|
202
|
-
|
203
|
-
|
201
|
+
it "should be a string" do
|
202
|
+
expect(stats.punctuation.class).to be(String)
|
203
|
+
end
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
end
|
205
|
+
it "should return the same value as its alias: #pcc" do
|
206
|
+
expect(stats.punctuation).to eq(stats.punc)
|
208
207
|
end
|
208
|
+
end
|
209
209
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
210
|
+
describe "#statements" do
|
211
|
+
it "should return an array" do
|
212
|
+
expect(stats.statements.class).to be(Array)
|
213
|
+
end
|
214
214
|
|
215
|
-
|
216
|
-
|
217
|
-
|
215
|
+
it "should contain 16 elements in the array" do
|
216
|
+
expect(stats.statements.size).to eq(16)
|
217
|
+
end
|
218
218
|
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
it "should have a hash for each element in the array" do
|
220
|
+
expect(stats.statements.first.class).to be(Hash)
|
221
|
+
end
|
222
222
|
|
223
|
-
|
224
|
-
|
225
|
-
|
223
|
+
it "should have statement as a key in each hash element" do
|
224
|
+
expect(stats.statements.first.has_key?("statement")).to be(true)
|
225
|
+
end
|
226
226
|
|
227
|
-
|
228
|
-
|
229
|
-
end
|
227
|
+
it "should have username as a key in each hash element" do
|
228
|
+
expect(stats.statements.first.has_key?("username")).to be(true)
|
230
229
|
end
|
230
|
+
end
|
231
231
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
232
|
+
describe "#this_thursday" do
|
233
|
+
it "should return the correct value for this thursday" do
|
234
|
+
expect(stats.this_thursday).to eq("this Thursday")
|
235
|
+
end
|
236
236
|
|
237
|
-
|
238
|
-
|
239
|
-
end
|
237
|
+
it "should be a string" do
|
238
|
+
expect(stats.this_thursday.class).to be(String)
|
240
239
|
end
|
240
|
+
end
|
241
241
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
end
|
242
|
+
describe "#tip_distribution_json" do
|
243
|
+
it "should return a hash" do
|
244
|
+
expect(stats.tip_distribution_json.class).to be(Hash)
|
246
245
|
end
|
246
|
+
end
|
247
247
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
248
|
+
describe "#number_of_tips" do
|
249
|
+
it "should return the correct number of tips" do
|
250
|
+
expect(stats.number_of_tips).to eq(4710)
|
251
|
+
end
|
252
252
|
|
253
|
-
|
254
|
-
|
255
|
-
|
253
|
+
it "should be a fixnum" do
|
254
|
+
expect(stats.number_of_tips.class).to be(Fixnum)
|
255
|
+
end
|
256
256
|
|
257
|
-
|
258
|
-
|
259
|
-
end
|
257
|
+
it "should return the same value as its alias: #tip_n" do
|
258
|
+
expect(stats.number_of_tips).to eq(stats.tip_n)
|
260
259
|
end
|
260
|
+
end
|
261
261
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
262
|
+
describe "#value_of_total_backed_tips" do
|
263
|
+
it "should return the correct value of total backed tips" do
|
264
|
+
expect(stats.value_of_total_backed_tips).to eq(5849.36)
|
265
|
+
end
|
266
266
|
|
267
|
-
|
268
|
-
|
269
|
-
|
267
|
+
it "should be a float" do
|
268
|
+
expect(stats.value_of_total_backed_tips.class).to be(Float)
|
269
|
+
end
|
270
270
|
|
271
|
-
|
272
|
-
|
273
|
-
end
|
271
|
+
it "should return the same value as its alias: #total_backed_tips" do
|
272
|
+
expect(stats.value_of_total_backed_tips).to eq(stats.total_backed_tips)
|
274
273
|
end
|
274
|
+
end
|
275
275
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
276
|
+
describe "#transfer_volume" do
|
277
|
+
it "should return the correct transfer volume" do
|
278
|
+
expect(stats.transfer_volume).to eq(5464.38)
|
279
|
+
end
|
280
280
|
|
281
|
-
|
282
|
-
|
283
|
-
end
|
281
|
+
it "should be a float" do
|
282
|
+
expect(stats.transfer_volume.class).to be(Float)
|
284
283
|
end
|
284
|
+
end
|
285
285
|
end
|
286
286
|
|
287
287
|
end
|
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.7
|
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-
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|