wowzer 0.0.4 → 0.0.5

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 (35) hide show
  1. data/fixtures/vcr_cassettes/application.yml +99 -0
  2. data/fixtures/vcr_cassettes/application_response.yml +99 -0
  3. data/fixtures/vcr_cassettes/candidate.yml +100 -0
  4. data/fixtures/vcr_cassettes/create_application.yml +249 -0
  5. data/fixtures/vcr_cassettes/create_notification.yml +97 -0
  6. data/fixtures/vcr_cassettes/delete_application.yml +143 -0
  7. data/fixtures/vcr_cassettes/delete_notification.yml +143 -0
  8. data/fixtures/vcr_cassettes/interview.yml +1 -1
  9. data/fixtures/vcr_cassettes/interview_applications.yml +204 -0
  10. data/fixtures/vcr_cassettes/interviews.yml +2 -2
  11. data/fixtures/vcr_cassettes/notification.yml +51 -0
  12. data/fixtures/vcr_cassettes/notifications.yml +99 -0
  13. data/fixtures/vcr_cassettes/resend_application.yml +143 -0
  14. data/fixtures/vcr_cassettes/resend_application_not_allowed.yml +99 -0
  15. data/fixtures/vcr_cassettes/update_notification.yml +47 -0
  16. data/lib/wowzer/application.rb +19 -13
  17. data/lib/wowzer/application_response.rb +32 -0
  18. data/lib/wowzer/candidate.rb +7 -0
  19. data/lib/wowzer/exception.rb +6 -0
  20. data/lib/wowzer/interview.rb +11 -15
  21. data/lib/wowzer/notification.rb +21 -0
  22. data/lib/wowzer/resource.rb +68 -0
  23. data/lib/wowzer/version.rb +1 -1
  24. data/lib/wowzer.rb +6 -1
  25. data/spec/lib/wowzer/application_response_spec.rb +17 -0
  26. data/spec/lib/wowzer/application_spec.rb +54 -0
  27. data/spec/lib/wowzer/candidate_spec.rb +13 -0
  28. data/spec/lib/wowzer/interview_spec.rb +46 -10
  29. data/spec/lib/wowzer/notifications_spec.rb +88 -0
  30. data/spec/spec_helper.rb +2 -2
  31. data/wowzer.gemspec +2 -3
  32. metadata +30 -9
  33. data/Gemfile.lock +0 -139
  34. data/spec/internal/config/database.yml +0 -3
  35. data/spec/internal/db/wowzer_test.sqlite +0 -0
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wowzer::Application do
4
+
5
+ it "should find an application by its id" do
6
+ application = nil
7
+
8
+ VCR.use_cassette('application') do
9
+ application = Wowzer::Application.find('515d64a52478f64181000042')
10
+ end
11
+
12
+ application.id.should == "515d64a52478f64181000042"
13
+ application.date_sent.should == "2013-04-04T11:31:49+00:00"
14
+ application.date_completed.should == "2013-04-04T11:41:35+00:00"
15
+ application.date_updated.should == "2013-04-05T09:37:55Z"
16
+ application.evaluation_status.should == "pending"
17
+ application.status.should == "completed"
18
+ end
19
+
20
+ it "should be able to delete an application" do
21
+ response = nil
22
+
23
+ VCR.use_cassette('delete_application') do
24
+ response = Wowzer::Application.find('515e9b44572fc05e230e815f').delete
25
+ end
26
+
27
+ response.should be_true
28
+ end
29
+
30
+ context "resending an application to a candidate" do
31
+
32
+ it "should resend if the application is not complete" do
33
+ response = nil
34
+
35
+ VCR.use_cassette('resend_application') do
36
+ response = Wowzer::Application.find('515d52d3572fc05e230a8328').resend
37
+ end
38
+
39
+ response.should be_true
40
+ end
41
+
42
+ it "should raise an exception if the application is complete" do
43
+ application = nil
44
+
45
+ VCR.use_cassette('resend_application_not_allowed') do
46
+ application = Wowzer::Application.find('515d64a52478f64181000042')
47
+ end
48
+
49
+ expect{ application.resend }.to raise_error(Wowzer::ActionNotAllowed)
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wowzer::Candidate do
4
+
5
+ it "should fetch a candidate by id" do
6
+ candidate = nil
7
+
8
+ VCR.use_cassette('candidate') do
9
+ candidate = Wowzer::Candidate.find('51666ce8572fc057c101d772')
10
+ end
11
+
12
+ end
13
+ end
@@ -12,11 +12,11 @@ describe Wowzer::Interview do
12
12
  interviews.count.should == 2
13
13
 
14
14
  interview = interviews.first
15
- interview.attributes.id.should == '5154134c572fc07efc002341'
16
- interview.attributes.title.should == 'Tutor Application Interview'
17
- interview.attributes.status.should == 'active'
18
- interview.attributes.description.should == 'Welcome to the online interview to become a tutor with Teach Me 2!'
19
- interview.attributes.open_for_new_applications.should == true
15
+ interview.id.should == '5154134c572fc07efc002341'
16
+ interview.title.should == 'Tutor Application Interview'
17
+ interview.status.should == 'active'
18
+ interview.description.should == 'Welcome to the online interview to become a tutor with Teach Me 2!'
19
+ interview.open_for_new_applications.should == true
20
20
  end
21
21
 
22
22
  it "should fetch an interview by id" do
@@ -26,11 +26,47 @@ describe Wowzer::Interview do
26
26
  interview = Wowzer::Interview.find('5154134c572fc07efc002341')
27
27
  end
28
28
 
29
- interview.attributes['id'].should == '5154134c572fc07efc002341'
30
- interview.attributes['title'].should == 'Tutor Application Interview'
31
- interview.attributes['status'].should == 'active'
32
- interview.attributes['description'].should == 'Welcome to the online interview to become a tutor with Teach Me 2!'
33
- interview.attributes['open_for_new_applications'].should == true
29
+ interview.id.should == '5154134c572fc07efc002341'
30
+ interview.title.should == 'Tutor Application Interview'
31
+ interview.status.should == 'active'
32
+ interview.description.should == 'Welcome to the online interview to become a tutor with Teach Me 2!'
33
+ interview.open_for_new_applications.should == true
34
34
  end
35
35
 
36
+ it "should fetch applications" do
37
+ applications = nil
38
+
39
+ VCR.use_cassette('interview_applications') do
40
+ interview = Wowzer::Interview.find('5154134c572fc07efc002341')
41
+ applications = interview.applications
42
+ end
43
+
44
+ applications.count.should == 20
45
+
46
+ application = applications.first
47
+ application.id.should == "515420a8572fc0193d00cfdf"
48
+ application.date_sent.should == "2013-03-28T10:51:38+00:00"
49
+ application.date_completed.should == "2013-04-02T16:05:32+00:00"
50
+ application.date_updated.should == "2013-04-03T08:35:24Z"
51
+ application.evaluation_status == "pending"
52
+ application.status.should == "completed"
53
+ end
54
+
55
+ it "should create a new application" do
56
+ application = nil
57
+
58
+ params = { "candidate" => { "email" => "timjegels@outlook.com", "first_name" => "Tim", "last_name" => "Jegels" } }
59
+
60
+ VCR.use_cassette('create_application') do
61
+ interview = Wowzer::Interview.find('51519ba8f4484b4bae000153')
62
+ application = interview.create_application(params)
63
+ end
64
+
65
+ application.is_a?(Wowzer::Application).should be_true
66
+ application.id.should == "515c0ebff4484b083c000086"
67
+ application.date_sent.should == "2013-04-03T11:13:03+00:00"
68
+ application.date_updated.should == "2013-04-03T11:13:03Z"
69
+ application.evaluation_status == "pending"
70
+ application.status.should == "sent"
71
+ end
36
72
  end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wowzer::Notification do
4
+
5
+ it "should fetch notifications" do
6
+ notifications = nil
7
+
8
+ VCR.use_cassette('notifications') do
9
+ notifications = Wowzer::Notification.all
10
+ end
11
+
12
+ notifications.count.should == 1
13
+
14
+ notification = notifications.first
15
+ notification.id.should == "515c1d39572fc05e2306a170"
16
+ notification.username.should == "Bob"
17
+ notification.password.should == "Sinclair"
18
+ notification.callback_url.should == "https://sample.com/endpoint"
19
+ notification.target.should == "application_status"
20
+ notification.active.should be_false
21
+ end
22
+
23
+ it "should create a notification" do
24
+ notification = nil
25
+
26
+ params = {
27
+ "callback_url" => "https://sample.com/endpoint",
28
+ "target" => "application_status",
29
+ "username" => "Bob",
30
+ "password" => "Sinclair",
31
+ "active" => true
32
+ }
33
+
34
+ VCR.use_cassette('create_notification') do
35
+ notification = Wowzer::Notification.create(params)
36
+ end
37
+
38
+ notification.is_a?(Wowzer::Notification).should be_true
39
+
40
+ notification.id.should == "515c1d39572fc05e2306a170"
41
+ notification.username.should == "Bob"
42
+ notification.password.should == "Sinclair"
43
+ notification.callback_url.should == "https://sample.com/endpoint"
44
+ notification.target.should == "application_status"
45
+ notification.active.should be_false
46
+ end
47
+
48
+ it "should fetch an notification by id" do
49
+ notification = nil
50
+
51
+ VCR.use_cassette('notification') do
52
+ notification = Wowzer::Notification.find('515c1d39572fc05e2306a170')
53
+ end
54
+
55
+ notification.id.should == "515c1d39572fc05e2306a170"
56
+ notification.username.should == "Bob"
57
+ notification.password.should == "Sinclair"
58
+ notification.callback_url.should == "https://sample.com/endpoint"
59
+ notification.target.should == "application_status"
60
+ notification.active.should be_false
61
+ end
62
+
63
+ it "should update a notification" do
64
+ notification = nil
65
+ params = {"callback_url" => "https://sample.com/endpoint2"}
66
+
67
+ VCR.use_cassette('update_notification') do
68
+ notification = Wowzer::Notification.find('515c1d39572fc05e2306a170')
69
+ notification.update(params)
70
+ end
71
+
72
+ notification.id.should == "515c1d39572fc05e2306a170"
73
+ notification.callback_url.should == "https://sample.com/endpoint2"
74
+ end
75
+
76
+ it "should delete a notification" do
77
+ notification = nil
78
+ response = nil
79
+
80
+ VCR.use_cassette('delete_notification') do
81
+ notification = Wowzer::Notification.find('515c1d39572fc05e2306a170')
82
+ response = notification.delete
83
+ end
84
+
85
+ response.should be_true
86
+ end
87
+
88
+ end
data/spec/spec_helper.rb CHANGED
@@ -17,8 +17,8 @@ RSpec.configure do |config|
17
17
  config.before(:suite) do
18
18
 
19
19
  Wowzer::client do
20
- app_id 'foo'
21
- api_key 'bar'
20
+ app_id 'foo.bar@foobar.com'
21
+ api_key '12345'
22
22
  api_endpoint 'https://api.wowzerapp.com'
23
23
  end
24
24
 
data/wowzer.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Douglas Anderson", "Tim Jegels"]
9
9
  s.email = ["i.am.douglas.anderson@gmail.com", "tjegels@gmail.com"]
10
10
  s.homepage = ""
11
- s.summary = %q{ A gem that integrates with the Wowzer API. }
12
- s.description = %q{ A gem that integrates with the Wowzer API. }
11
+ s.summary = %q{ A gem that consumes the Wowzer API. }
12
+ s.description = %q{ A gem that consumes the Wowzer API. }
13
13
 
14
14
  s.rubyforge_project = "wowzer"
15
15
 
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "activesupport"
22
22
  s.add_dependency "activerecord", "~> 3.0"
23
23
  s.add_dependency "i18n"
24
- #s.add_dependency "frenetic"
25
24
  s.add_dependency "hyperclient"
26
25
 
27
26
  s.add_development_dependency 'combustion', '~> 0.3.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wowzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-28 00:00:00.000000000 Z
13
+ date: 2013-04-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -92,7 +92,7 @@ dependencies:
92
92
  - - ~>
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.3.1
95
- description: ! ' A gem that integrates with the Wowzer API. '
95
+ description: ! ' A gem that consumes the Wowzer API. '
96
96
  email:
97
97
  - i.am.douglas.anderson@gmail.com
98
98
  - tjegels@gmail.com
@@ -103,24 +103,43 @@ files:
103
103
  - .gitignore
104
104
  - .rvmrc
105
105
  - Gemfile
106
- - Gemfile.lock
107
106
  - README.md
108
107
  - Rakefile
109
108
  - config.ru
109
+ - fixtures/vcr_cassettes/application.yml
110
+ - fixtures/vcr_cassettes/application_response.yml
111
+ - fixtures/vcr_cassettes/candidate.yml
112
+ - fixtures/vcr_cassettes/create_application.yml
113
+ - fixtures/vcr_cassettes/create_notification.yml
114
+ - fixtures/vcr_cassettes/delete_application.yml
115
+ - fixtures/vcr_cassettes/delete_notification.yml
110
116
  - fixtures/vcr_cassettes/interview.yml
117
+ - fixtures/vcr_cassettes/interview_applications.yml
111
118
  - fixtures/vcr_cassettes/interviews.yml
119
+ - fixtures/vcr_cassettes/notification.yml
120
+ - fixtures/vcr_cassettes/notifications.yml
121
+ - fixtures/vcr_cassettes/resend_application.yml
122
+ - fixtures/vcr_cassettes/resend_application_not_allowed.yml
123
+ - fixtures/vcr_cassettes/update_notification.yml
112
124
  - lib/wowzer.rb
113
125
  - lib/wowzer/application.rb
126
+ - lib/wowzer/application_response.rb
127
+ - lib/wowzer/candidate.rb
114
128
  - lib/wowzer/client.rb
129
+ - lib/wowzer/exception.rb
115
130
  - lib/wowzer/interview.rb
131
+ - lib/wowzer/notification.rb
132
+ - lib/wowzer/resource.rb
116
133
  - lib/wowzer/version.rb
117
- - spec/internal/config/database.yml
118
134
  - spec/internal/config/database.yml.sample
119
135
  - spec/internal/config/routes.rb
120
136
  - spec/internal/db/schema.rb
121
- - spec/internal/db/wowzer_test.sqlite
122
137
  - spec/internal/public/favicon.ico
138
+ - spec/lib/wowzer/application_response_spec.rb
139
+ - spec/lib/wowzer/application_spec.rb
140
+ - spec/lib/wowzer/candidate_spec.rb
123
141
  - spec/lib/wowzer/interview_spec.rb
142
+ - spec/lib/wowzer/notifications_spec.rb
124
143
  - spec/spec_helper.rb
125
144
  - wowzer.gemspec
126
145
  homepage: ''
@@ -146,13 +165,15 @@ rubyforge_project: wowzer
146
165
  rubygems_version: 1.8.24
147
166
  signing_key:
148
167
  specification_version: 3
149
- summary: A gem that integrates with the Wowzer API.
168
+ summary: A gem that consumes the Wowzer API.
150
169
  test_files:
151
- - spec/internal/config/database.yml
152
170
  - spec/internal/config/database.yml.sample
153
171
  - spec/internal/config/routes.rb
154
172
  - spec/internal/db/schema.rb
155
- - spec/internal/db/wowzer_test.sqlite
156
173
  - spec/internal/public/favicon.ico
174
+ - spec/lib/wowzer/application_response_spec.rb
175
+ - spec/lib/wowzer/application_spec.rb
176
+ - spec/lib/wowzer/candidate_spec.rb
157
177
  - spec/lib/wowzer/interview_spec.rb
178
+ - spec/lib/wowzer/notifications_spec.rb
158
179
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,139 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- wowzer (0.0.3)
5
- activerecord (~> 3.0)
6
- activesupport
7
- hyperclient
8
- i18n
9
-
10
- GEM
11
- remote: http://rubygems.org/
12
- specs:
13
- actionmailer (3.2.9)
14
- actionpack (= 3.2.9)
15
- mail (~> 2.4.4)
16
- actionpack (3.2.9)
17
- activemodel (= 3.2.9)
18
- activesupport (= 3.2.9)
19
- builder (~> 3.0.0)
20
- erubis (~> 2.7.0)
21
- journey (~> 1.0.4)
22
- rack (~> 1.4.0)
23
- rack-cache (~> 1.2)
24
- rack-test (~> 0.6.1)
25
- sprockets (~> 2.2.1)
26
- activemodel (3.2.9)
27
- activesupport (= 3.2.9)
28
- builder (~> 3.0.0)
29
- activerecord (3.2.9)
30
- activemodel (= 3.2.9)
31
- activesupport (= 3.2.9)
32
- arel (~> 3.0.2)
33
- tzinfo (~> 0.3.29)
34
- activeresource (3.2.9)
35
- activemodel (= 3.2.9)
36
- activesupport (= 3.2.9)
37
- activesupport (3.2.9)
38
- i18n (~> 0.6)
39
- multi_json (~> 1.0)
40
- addressable (2.3.3)
41
- arel (3.0.2)
42
- builder (3.0.4)
43
- combustion (0.3.2)
44
- rails (>= 3.0.0)
45
- thor (>= 0.14.6)
46
- crack (0.3.2)
47
- diff-lcs (1.1.3)
48
- erubis (2.7.0)
49
- faraday (0.8.7)
50
- multipart-post (~> 1.1)
51
- faraday_middleware (0.9.0)
52
- faraday (>= 0.7.4, < 0.9)
53
- hike (1.2.1)
54
- hyperclient (0.3.0)
55
- faraday (~> 0.8)
56
- faraday_middleware (~> 0.9)
57
- net-http-digest_auth (~> 1.2)
58
- uri_template (~> 0.5)
59
- i18n (0.6.1)
60
- journey (1.0.4)
61
- json (1.7.5)
62
- mail (2.4.4)
63
- i18n (>= 0.4.0)
64
- mime-types (~> 1.16)
65
- treetop (~> 1.4.8)
66
- mime-types (1.19)
67
- multi_json (1.3.7)
68
- multipart-post (1.2.0)
69
- net-http-digest_auth (1.2.1)
70
- polyglot (0.3.3)
71
- rack (1.4.1)
72
- rack-cache (1.2)
73
- rack (>= 0.4)
74
- rack-ssl (1.3.2)
75
- rack
76
- rack-test (0.6.2)
77
- rack (>= 1.0)
78
- rails (3.2.9)
79
- actionmailer (= 3.2.9)
80
- actionpack (= 3.2.9)
81
- activerecord (= 3.2.9)
82
- activeresource (= 3.2.9)
83
- activesupport (= 3.2.9)
84
- bundler (~> 1.0)
85
- railties (= 3.2.9)
86
- railties (3.2.9)
87
- actionpack (= 3.2.9)
88
- activesupport (= 3.2.9)
89
- rack-ssl (~> 1.3.2)
90
- rake (>= 0.8.7)
91
- rdoc (~> 3.4)
92
- thor (>= 0.14.6, < 2.0)
93
- rake (10.0.2)
94
- rdoc (3.12)
95
- json (~> 1.4)
96
- rspec (2.12.0)
97
- rspec-core (~> 2.12.0)
98
- rspec-expectations (~> 2.12.0)
99
- rspec-mocks (~> 2.12.0)
100
- rspec-core (2.12.0)
101
- rspec-expectations (2.12.0)
102
- diff-lcs (~> 1.1.3)
103
- rspec-mocks (2.12.0)
104
- rspec-rails (2.12.0)
105
- actionpack (>= 3.0)
106
- activesupport (>= 3.0)
107
- railties (>= 3.0)
108
- rspec-core (~> 2.12.0)
109
- rspec-expectations (~> 2.12.0)
110
- rspec-mocks (~> 2.12.0)
111
- sprockets (2.2.2)
112
- hike (~> 1.2)
113
- multi_json (~> 1.0)
114
- rack (~> 1.0)
115
- tilt (~> 1.1, != 1.3.0)
116
- sqlite3 (1.3.6)
117
- thor (0.16.0)
118
- tilt (1.3.3)
119
- treetop (1.4.12)
120
- polyglot
121
- polyglot (>= 0.3.1)
122
- tzinfo (0.3.35)
123
- uri_template (0.5.2)
124
- vcr (2.4.0)
125
- webmock (1.11.0)
126
- addressable (>= 2.2.7)
127
- crack (>= 0.3.2)
128
-
129
- PLATFORMS
130
- ruby
131
-
132
- DEPENDENCIES
133
- combustion (~> 0.3.1)
134
- rspec
135
- rspec-rails
136
- sqlite3
137
- vcr
138
- webmock
139
- wowzer!
@@ -1,3 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: db/wowzer_test.sqlite
Binary file