deadlinez 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/deadlinez/api.rb +3 -13
- data/lib/deadlinez.rb +1 -1
- data/spec/deadlinez/api_spec.rb +2 -23
- metadata +32 -18
- data/deadlinez.gemspec +0 -67
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/deadlinez/api.rb
CHANGED
@@ -9,27 +9,17 @@ module Deadlinez
|
|
9
9
|
def self.proxy(path, params)
|
10
10
|
proxy_params = Deadlinez::Proxy.strip_params(params)
|
11
11
|
response = post(path,
|
12
|
-
:query => { :key => Deadlinez.api_key },
|
13
12
|
:body => proxy_params,
|
14
13
|
:format => nil)
|
15
14
|
response.body
|
16
15
|
end
|
17
16
|
|
18
17
|
def self.stats(data)
|
19
|
-
response =
|
20
|
-
:
|
21
|
-
:data => data
|
22
|
-
:key => Deadlinez.api_key
|
18
|
+
response = post('/stats',
|
19
|
+
:body => {
|
20
|
+
:data => data
|
23
21
|
})
|
24
22
|
response['scores']['metric']
|
25
23
|
end
|
26
|
-
|
27
|
-
def self.verify(key = Deadlinez.api_key)
|
28
|
-
response = get('/verify',
|
29
|
-
:query => {
|
30
|
-
:key => key
|
31
|
-
})
|
32
|
-
response.body.strip == 'valid'
|
33
|
-
end
|
34
24
|
end
|
35
25
|
end
|
data/lib/deadlinez.rb
CHANGED
data/spec/deadlinez/api_spec.rb
CHANGED
@@ -1,36 +1,15 @@
|
|
1
1
|
require File.dirname(__FILE__) + "/../spec_helper"
|
2
2
|
|
3
3
|
describe Deadlinez::Api do
|
4
|
-
Deadlinez.api_key = 'testkey'
|
5
|
-
|
6
4
|
describe "#stats" do
|
7
5
|
it "should return correct stats" do
|
8
|
-
FakeWeb.register_uri(:
|
9
|
-
"http://service.afterthedeadline.com/stats
|
6
|
+
FakeWeb.register_uri(:post,
|
7
|
+
"http://service.afterthedeadline.com/stats",
|
10
8
|
:response => fixture_for('stats.response'))
|
11
9
|
|
12
10
|
data = %Q{Jacobs spent most of his childhood moving around the East Coast with his family, eventually settling in Tampa, Florida. As a drummer he won the 1978 "Most Talented" trophy at Greco Junior High School, but after relocating to Queens, New York (as a result of his parents' divorce), he traded his drums in for a set of turntables apon discovering and marveling over hip hop while the artform was still in an underground developmental stage. He was mentored in the craft by his cousin Rene Negron (a.k.a. DJ-Stretch), and their close friend Shawn Trone (a.k.a. MC Shah-T of the parody-rap group No Face) who suggested Greg use the name "Shah-G". Jacobs liked the idea, but mistakenly thought his friend said "Shock-G", and began using that name instead.}
|
13
11
|
result = Deadlinez::Api.stats(data)
|
14
|
-
puts result.inspect
|
15
12
|
result.should have(4).things
|
16
13
|
end
|
17
14
|
end
|
18
|
-
|
19
|
-
describe "#verify" do
|
20
|
-
it "should return false if the key is bad" do
|
21
|
-
FakeWeb.register_uri(:get,
|
22
|
-
'http://service.afterthedeadline.com/verify?key=badkey',
|
23
|
-
:body => "invalid\n")
|
24
|
-
result = Deadlinez::Api.verify('badkey')
|
25
|
-
result.should be_false
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should return true if the key is good" do
|
29
|
-
FakeWeb.register_uri(:get,
|
30
|
-
'http://service.afterthedeadline.com/verify?key=goodkey',
|
31
|
-
:body => "valid\n")
|
32
|
-
result = Deadlinez::Api.verify('goodkey')
|
33
|
-
result.should be_true
|
34
|
-
end
|
35
|
-
end
|
36
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deadlinez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- David Balatero
|
@@ -9,39 +14,47 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-04-23 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
23
31
|
version: 1.2.9
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: fakeweb
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
33
43
|
version: "0"
|
34
|
-
|
44
|
+
type: :development
|
45
|
+
version_requirements: *id002
|
35
46
|
- !ruby/object:Gem::Dependency
|
36
47
|
name: httparty
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
50
|
requirements:
|
41
51
|
- - ">="
|
42
52
|
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
43
55
|
version: "0"
|
44
|
-
|
56
|
+
type: :runtime
|
57
|
+
version_requirements: *id003
|
45
58
|
description: Makes it easy to handle After the Deadline AJAX proxying and their API.
|
46
59
|
email: dbalatero@gmail.com
|
47
60
|
executables: []
|
@@ -58,7 +71,6 @@ files:
|
|
58
71
|
- README.rdoc
|
59
72
|
- Rakefile
|
60
73
|
- VERSION
|
61
|
-
- deadlinez.gemspec
|
62
74
|
- init.rb
|
63
75
|
- lib/deadlinez.rb
|
64
76
|
- lib/deadlinez/api.rb
|
@@ -81,18 +93,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
93
|
requirements:
|
82
94
|
- - ">="
|
83
95
|
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
84
98
|
version: "0"
|
85
|
-
version:
|
86
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
100
|
requirements:
|
88
101
|
- - ">="
|
89
102
|
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
90
105
|
version: "0"
|
91
|
-
version:
|
92
106
|
requirements: []
|
93
107
|
|
94
108
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.6
|
96
110
|
signing_key:
|
97
111
|
specification_version: 3
|
98
112
|
summary: Makes it easy to handle After the Deadline AJAX proxying and their API.
|
data/deadlinez.gemspec
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{deadlinez}
|
8
|
-
s.version = "0.0.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["David Balatero"]
|
12
|
-
s.date = %q{2010-01-10}
|
13
|
-
s.description = %q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
|
14
|
-
s.email = %q{dbalatero@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"deadlinez.gemspec",
|
27
|
-
"init.rb",
|
28
|
-
"lib/deadlinez.rb",
|
29
|
-
"lib/deadlinez/api.rb",
|
30
|
-
"lib/deadlinez/proxy.rb",
|
31
|
-
"spec/deadlinez/api_spec.rb",
|
32
|
-
"spec/deadlinez/proxy_spec.rb",
|
33
|
-
"spec/fixtures/stats.response",
|
34
|
-
"spec/spec.opts",
|
35
|
-
"spec/spec_helper.rb"
|
36
|
-
]
|
37
|
-
s.homepage = %q{http://github.com/dbalatero/deadlinez}
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.5}
|
41
|
-
s.summary = %q{Makes it easy to handle After the Deadline AJAX proxying and their API.}
|
42
|
-
s.test_files = [
|
43
|
-
"spec/deadlinez/api_spec.rb",
|
44
|
-
"spec/deadlinez/proxy_spec.rb",
|
45
|
-
"spec/spec_helper.rb"
|
46
|
-
]
|
47
|
-
|
48
|
-
if s.respond_to? :specification_version then
|
49
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
-
s.specification_version = 3
|
51
|
-
|
52
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
54
|
-
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
55
|
-
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
59
|
-
s.add_dependency(%q<httparty>, [">= 0"])
|
60
|
-
end
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
64
|
-
s.add_dependency(%q<httparty>, [">= 0"])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|