crowdkit 0.1.0

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +16 -0
  5. data/Gemfile.lock +97 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +178 -0
  8. data/Rakefile +54 -0
  9. data/VERSION +1 -0
  10. data/crowdkit.gemspec +122 -0
  11. data/lib/crowdkit.rb +77 -0
  12. data/lib/crowdkit/api.rb +171 -0
  13. data/lib/crowdkit/api/arguments.rb +187 -0
  14. data/lib/crowdkit/api/factory.rb +29 -0
  15. data/lib/crowdkit/api/request_methods.rb +70 -0
  16. data/lib/crowdkit/api/response_wrapper.rb +122 -0
  17. data/lib/crowdkit/client.rb +36 -0
  18. data/lib/crowdkit/client/account.rb +7 -0
  19. data/lib/crowdkit/client/jobs.rb +56 -0
  20. data/lib/crowdkit/client/judgments.rb +9 -0
  21. data/lib/crowdkit/client/poll.rb +48 -0
  22. data/lib/crowdkit/client/statuses.rb +14 -0
  23. data/lib/crowdkit/client/units.rb +54 -0
  24. data/lib/crowdkit/client/workers.rb +13 -0
  25. data/lib/crowdkit/client/worksets.rb +27 -0
  26. data/lib/crowdkit/config.rb +62 -0
  27. data/lib/crowdkit/core_ext/array.rb +7 -0
  28. data/lib/crowdkit/core_ext/hash.rb +30 -0
  29. data/lib/crowdkit/core_ext/sawyer.rb +7 -0
  30. data/lib/crowdkit/error.rb +198 -0
  31. data/lib/crowdkit/middleware/raise_error.rb +14 -0
  32. data/lib/crowdkit/ssl_certs/cacerts.pem +3868 -0
  33. data/lib/crowdkit/version.rb +3 -0
  34. data/spec/crowdkit/client/account_spec.rb +19 -0
  35. data/spec/crowdkit/client/jobs_spec.rb +275 -0
  36. data/spec/crowdkit/client/judgments_spec.rb +30 -0
  37. data/spec/crowdkit/client/statuses_spec.rb +30 -0
  38. data/spec/crowdkit/client/units_spec.rb +266 -0
  39. data/spec/crowdkit/client/workers_spec.rb +33 -0
  40. data/spec/crowdkit/client/worksets_spec.rb +113 -0
  41. data/spec/crowdkit/client_spec.rb +55 -0
  42. data/spec/crowdkit_spec.rb +139 -0
  43. data/spec/fixtures/account.json +7 -0
  44. data/spec/fixtures/jobs/copy.json +79 -0
  45. data/spec/fixtures/jobs/job.json +1 -0
  46. data/spec/fixtures/jobs/order.json +53 -0
  47. data/spec/fixtures/jobs/search.json +1 -0
  48. data/spec/fixtures/judgments/index.json +46 -0
  49. data/spec/fixtures/judgments/show.json +16 -0
  50. data/spec/fixtures/root.json +1 -0
  51. data/spec/fixtures/statuses/index.json +25 -0
  52. data/spec/fixtures/statuses/status.json +12 -0
  53. data/spec/fixtures/units/copy.json +34 -0
  54. data/spec/fixtures/units/index.json +1502 -0
  55. data/spec/fixtures/units/poll/normal.json +902 -0
  56. data/spec/fixtures/units/poll/small.json +602 -0
  57. data/spec/fixtures/units/show.json +34 -0
  58. data/spec/fixtures/upload.csv +25 -0
  59. data/spec/fixtures/worksets/index.json +20 -0
  60. data/spec/fixtures/worksets/show.json +9 -0
  61. data/spec/spec_helper.rb +53 -0
  62. data/spec/support/base.rb +11 -0
  63. metadata +218 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "state":"new",
3
+ "id":47979,
4
+ "job":{
5
+ "id":10
6
+ },
7
+ "total_judgments_count":0,
8
+ "data":{
9
+ "broken_private":"",
10
+ "event_category_gold":null,
11
+ "_golden":"false",
12
+ "broken_privateconfidence":"1.0",
13
+ "event_id":"106074271",
14
+ "_canary":null,
15
+ "event_category":"Film, Media & Entertainment > Other",
16
+ "event_url":"http://www.eventbrite.com/e/106074271",
17
+ "_unit_state":"finalized",
18
+ "event_categoryconfidence":"0.3808",
19
+ "_trusted_judgments":"3",
20
+ "event_category_id":"68\n143",
21
+ "_last_judgment_at":"3/26/2014 19:28:52",
22
+ "event_category_idconfidence":"0.8706\n0.7329",
23
+ "_unit_id":"435923639"
24
+ },
25
+ "_links":{
26
+ "self":{
27
+ "href":"https://api.crowdflower.dev/v2/units/47979"
28
+ },
29
+ "judgments":{
30
+ "href":"https://api.crowdflower.dev/v2/units/47979/judgments"
31
+ }
32
+ },
33
+ "judgments":[]
34
+ }
@@ -0,0 +1,25 @@
1
+ _unit_id,_created_at,_updated_at,handle,tweet_id,tweet_text,cf_sentiment_gold,cf_sentiment_gold_reason
2
+ 337205423,10/24/2013 20:01:40,10/24/2013 20:01:40,CrowdFlower,388743400302059520,"@DH_FBK Awesome, what did you think?",,
3
+ 337205425,10/24/2013 20:01:40,10/24/2013 20:01:40,Clickbankplus,390722984832663552,Lastest Crowdflower auctions http://t.co/FjMSTRBp5P,neutral,This tweet mentions CrowdFlower but does not have any positive or negative sentiment has it simply shows you CrowdFlower auctions.
4
+ 337205447,10/24/2013 20:01:40,10/24/2013 20:01:40,tipalti,390238324449095680,Glad to hear your are enjoying the #CrowdConf @crowdflower! http://t.co/LMLEegxfWy,"highly_positive
5
+ slightly_positive",This tweet is positive because they are glad to hear they are enjoying CrowdFlower.
6
+ 337205449,10/24/2013 20:01:40,10/24/2013 20:01:40,michaeleilinger,390226088606978048,"@CFComm HEY CrowdFlower, neobux tasks has beend disappearing, what's happening? This is unusual.","neutral
7
+ slightly_negative",This tweet is about weird behavior in finding tasks. This is not good.
8
+ 337205450,10/24/2013 20:01:40,10/24/2013 20:01:40,Hermes_LC,390222236793061376,@CFComm @CrowdFlower I received a message there I was flagged in something mentioning error 301 and I have no more tasks. what it means?,"neutral
9
+ slightly_negative",The author of this tweet is confused and mentions they got an error. This is not a positive tweet.
10
+ 337205452,10/24/2013 20:01:40,10/24/2013 20:01:40,TurkerNational,390131909465870336,@zackllnyoung Yup. Only other options r hire a consultant or work with @CrowdFlower or @crowdsource but their reps with workers aren't great,"slightly_negative
11
+ highly negative",This tweet mentions that CrowdFlower's reputation with their workers aren't great so it's a negative tweet.
12
+ 337205454,10/24/2013 20:01:40,10/24/2013 20:01:40,pa3ring,390110704713211904,Stay away from CrowdFlower! Huge time waster - you fail CrowdFlower - not me!,highly negative,The author of this tweet was very unhappy with their experience using CrowdFlower.
13
+ 337205457,10/24/2013 20:01:40,10/24/2013 20:01:40,sara_hlt,389830691107917825,RT @DH_FBK: @CrowdFlower The PRO platform is full of useful and interesting new features! Well done :-) Thanks for the demo!,"highly_positive
14
+ slightly_positive",This tweet is speaks very positively about the CrowdFlower Pro Platform.
15
+ 337205460,10/24/2013 20:01:40,10/24/2013 20:01:40,CrowdFlower,388720834753617920,Learn how #crowdsourcing can help your company get ahead: http://t.co/auMAKUQiNJ #CrowdConf #strategy,"highly_positive
16
+ slightly_positive
17
+ neutral",This tweet brings you to a page to learn how to leverage CrowdFlower to help your company.
18
+ 337205463,10/24/2013 20:01:40,10/24/2013 20:01:40,CrowdFlower,388715864033615872,"""Partly cloudy with a chance of hashtags."" Check out this #datascience #competition http://t.co/prWAJ73dTA #publicdata #innovation #bigdata","highly_positive
19
+ slightly_positive
20
+ neutral",The link in this tweet brings you to a page where you can learn about the CrowdFlower Open Data Library. This tweet is encouraging people to participate and thus has underlying positive tones.
21
+ 337205466,10/24/2013 20:01:40,10/24/2013 20:01:40,CrowdFlower,388699927951728640,Thrilled to have @Indiegogo on #CrowdConf panel re: the current state of #crowdfunding! http://t.co/8qMSc0uwXb (use CHIRP25 discount code),"highly_positive
22
+ slightly_positive",The author of this tweet is excited about CrowdConf. This tweet is speaking positively about CrowdFlower because CrowdConf is organized by CrowdFlower.
23
+ 337205467,10/24/2013 20:01:40,10/24/2013 20:01:40,callmemoney_,388652933971054594,"Earn money easily by completing easy small tasks.Get paid by PayPal,Payza and Bkash at http://t.co/vppX6iMugo http://t.co/J6ipkPvGUU","highly_positive
24
+ slightly_positive
25
+ neutral","By clicking the links you will be brought to a page that allows you to earn money by completing CrowdFlower tasks. Allowing people to ""earn money easily"" is a good thing."
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "contributor": {
5
+ "id": 2
6
+ },
7
+ "job": {
8
+ "id": 3
9
+ }
10
+ },
11
+ {
12
+ "id": 2,
13
+ "contributor": {
14
+ "id": 2
15
+ },
16
+ "job": {
17
+ "id": 3
18
+ }
19
+ }
20
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": 1,
3
+ "contributor": {
4
+ "id": 2
5
+ },
6
+ "job": {
7
+ "id": 3
8
+ }
9
+ }
@@ -0,0 +1,53 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_profile 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
18
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
19
+
20
+ require 'rspec'
21
+ require 'webmock/rspec'
22
+ require 'crowdkit'
23
+
24
+ WebMock.disable_net_connect!
25
+
26
+ # Requires supporting files with custom matchers and macros, etc,
27
+ # in ./support/ and its subdirectories.
28
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f }
29
+
30
+ RSpec.configure do |config|
31
+ config.include WebMock::API
32
+
33
+ config.before(:each) do
34
+ WebMock.reset!
35
+ end
36
+ config.after(:each) do
37
+ WebMock.reset!
38
+ end
39
+ end
40
+
41
+ def fixture(file)
42
+ File.new(File.join(File.expand_path("../fixtures", __FILE__), '/', file))
43
+ end
44
+
45
+ def fixture_response(file, status = 200, headers = {})
46
+ { body: fixture(file), status: status, headers: { content_type: "application/json; charset=utf-8" }.merge(headers) }
47
+ end
48
+
49
+ [:get,:post,:put,:patch,:delete,:head].each do |method|
50
+ define_method("stub_#{method}") do |path, endpoint = Crowdkit.config.api_endpoint|
51
+ stub_request(method, path.is_a?(String) ? endpoint + path : path)
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ Module.new do
2
+ def self.included(base)
3
+ base.class_eval do
4
+ let(:client) { Crowdkit.new(access_token: "token") }
5
+ end
6
+ end
7
+
8
+ RSpec.configure do |conf|
9
+ conf.include self
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crowdkit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Van Pelt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sawyer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-progressbar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jeweler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.0.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.0.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A flat API client that sits atop the CrowdFlower API
126
+ email: vanpelt@crowdflower.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files:
130
+ - LICENSE.txt
131
+ - README.md
132
+ files:
133
+ - ".document"
134
+ - ".rspec"
135
+ - Gemfile
136
+ - Gemfile.lock
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - VERSION
141
+ - crowdkit.gemspec
142
+ - lib/crowdkit.rb
143
+ - lib/crowdkit/api.rb
144
+ - lib/crowdkit/api/arguments.rb
145
+ - lib/crowdkit/api/factory.rb
146
+ - lib/crowdkit/api/request_methods.rb
147
+ - lib/crowdkit/api/response_wrapper.rb
148
+ - lib/crowdkit/client.rb
149
+ - lib/crowdkit/client/account.rb
150
+ - lib/crowdkit/client/jobs.rb
151
+ - lib/crowdkit/client/judgments.rb
152
+ - lib/crowdkit/client/poll.rb
153
+ - lib/crowdkit/client/statuses.rb
154
+ - lib/crowdkit/client/units.rb
155
+ - lib/crowdkit/client/workers.rb
156
+ - lib/crowdkit/client/worksets.rb
157
+ - lib/crowdkit/config.rb
158
+ - lib/crowdkit/core_ext/array.rb
159
+ - lib/crowdkit/core_ext/hash.rb
160
+ - lib/crowdkit/core_ext/sawyer.rb
161
+ - lib/crowdkit/error.rb
162
+ - lib/crowdkit/middleware/raise_error.rb
163
+ - lib/crowdkit/ssl_certs/cacerts.pem
164
+ - lib/crowdkit/version.rb
165
+ - spec/crowdkit/client/account_spec.rb
166
+ - spec/crowdkit/client/jobs_spec.rb
167
+ - spec/crowdkit/client/judgments_spec.rb
168
+ - spec/crowdkit/client/statuses_spec.rb
169
+ - spec/crowdkit/client/units_spec.rb
170
+ - spec/crowdkit/client/workers_spec.rb
171
+ - spec/crowdkit/client/worksets_spec.rb
172
+ - spec/crowdkit/client_spec.rb
173
+ - spec/crowdkit_spec.rb
174
+ - spec/fixtures/account.json
175
+ - spec/fixtures/jobs/copy.json
176
+ - spec/fixtures/jobs/job.json
177
+ - spec/fixtures/jobs/order.json
178
+ - spec/fixtures/jobs/search.json
179
+ - spec/fixtures/judgments/index.json
180
+ - spec/fixtures/judgments/show.json
181
+ - spec/fixtures/root.json
182
+ - spec/fixtures/statuses/index.json
183
+ - spec/fixtures/statuses/status.json
184
+ - spec/fixtures/units/copy.json
185
+ - spec/fixtures/units/index.json
186
+ - spec/fixtures/units/poll/normal.json
187
+ - spec/fixtures/units/poll/small.json
188
+ - spec/fixtures/units/show.json
189
+ - spec/fixtures/upload.csv
190
+ - spec/fixtures/worksets/index.json
191
+ - spec/fixtures/worksets/show.json
192
+ - spec/spec_helper.rb
193
+ - spec/support/base.rb
194
+ homepage: http://github.com/crowdflower/crowdkit.rb
195
+ licenses:
196
+ - MIT
197
+ metadata: {}
198
+ post_install_message:
199
+ rdoc_options: []
200
+ require_paths:
201
+ - lib
202
+ required_ruby_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ requirements: []
213
+ rubyforge_project:
214
+ rubygems_version: 2.2.0
215
+ signing_key:
216
+ specification_version: 4
217
+ summary: CrowdFlower ruby API client
218
+ test_files: []