twelve 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +220 -0
- data/Rakefile +8 -0
- data/lib/twelve.rb +32 -0
- data/lib/twelve/api/clients.rb +55 -0
- data/lib/twelve/api/gauges.rb +67 -0
- data/lib/twelve/api/gauges/content.rb +36 -0
- data/lib/twelve/api/gauges/engines.rb +32 -0
- data/lib/twelve/api/gauges/locations.rb +32 -0
- data/lib/twelve/api/gauges/referrers.rb +36 -0
- data/lib/twelve/api/gauges/resolutions.rb +32 -0
- data/lib/twelve/api/gauges/shares.rb +45 -0
- data/lib/twelve/api/gauges/technology.rb +32 -0
- data/lib/twelve/api/gauges/terms.rb +36 -0
- data/lib/twelve/api/gauges/traffic.rb +32 -0
- data/lib/twelve/api/me.rb +28 -0
- data/lib/twelve/connection.rb +26 -0
- data/lib/twelve/resource_proxy.rb +46 -0
- data/lib/twelve/version.rb +4 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/twelve/api/clients_spec.rb +43 -0
- data/spec/twelve/api/gauges/content_spec.rb +54 -0
- data/spec/twelve/api/gauges/engines_spec.rb +32 -0
- data/spec/twelve/api/gauges/locations_spec.rb +32 -0
- data/spec/twelve/api/gauges/referrers_spec.rb +54 -0
- data/spec/twelve/api/gauges/resolutions_spec.rb +36 -0
- data/spec/twelve/api/gauges/shares_spec.rb +74 -0
- data/spec/twelve/api/gauges/technology_spec.rb +36 -0
- data/spec/twelve/api/gauges/terms_spec.rb +52 -0
- data/spec/twelve/api/gauges/traffic_spec.rb +34 -0
- data/spec/twelve/api/gauges_spec.rb +119 -0
- data/spec/twelve/api/me_spec.rb +34 -0
- data/spec/twelve/connection_spec.rb +11 -0
- data/spec/twelve/resource_proxy_spec.rb +34 -0
- data/spec/twelve_spec.rb +16 -0
- data/twelve.gemspec +29 -0
- metadata +230 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Me do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
def should_be_me(me)
|
7
|
+
me['urls']['self'].should == 'https://secure.gaug.es/me'
|
8
|
+
me['urls']['gauges'].should == 'https://secure.gaug.es/gauges'
|
9
|
+
me['urls']['clients'].should == 'https://secure.gaug.es/clients'
|
10
|
+
me['id'].size.should == 24
|
11
|
+
me['email'].should_not be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#me" do
|
15
|
+
context "without an arguement" do
|
16
|
+
it "returns my information" do
|
17
|
+
VCR.use_cassette('me') do
|
18
|
+
me = subject.me
|
19
|
+
should_be_me(me)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "with a hash" do
|
25
|
+
it "updates my information" do
|
26
|
+
VCR.use_cassette('me_with_hash') do
|
27
|
+
me = subject.me(:first_name => 'Jon')
|
28
|
+
should_be_me(me)
|
29
|
+
me['first_name'].should == "Jon"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::Connection do
|
4
|
+
subject { Twelve::Connection.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#initialize" do
|
7
|
+
it "should set an instance variable for access token" do
|
8
|
+
subject.access_token.should == ACCESS_TOKEN
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class FakeResponse
|
4
|
+
def body
|
5
|
+
"Bar!"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Twelve::ResourceProxy do
|
10
|
+
before(:each) do
|
11
|
+
@connection = mock('connection')
|
12
|
+
@connection.stub!(:get).and_return(FakeResponse.new)
|
13
|
+
end
|
14
|
+
|
15
|
+
subject do
|
16
|
+
Twelve::ResourceProxy.new(@connection, '/foo')
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#initialize" do
|
20
|
+
it "should set connection" do
|
21
|
+
subject.instance_variable_get(:@connection).should == @connection
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should set path_prefix" do
|
25
|
+
subject.instance_variable_get(:@path_prefix).should == "/foo"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#method_missing" do
|
30
|
+
it "should pass message and args to target" do
|
31
|
+
lambda { subject.upcase }.should raise_error("Implement in Proxy class for resource")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/twelve_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Twelve do
|
5
|
+
it "should have a VERSION constant" do
|
6
|
+
Twelve.const_defined?('VERSION').should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#initialize" do
|
10
|
+
it "should set up a connection" do
|
11
|
+
api = Twelve.new(ACCESS_TOKEN)
|
12
|
+
api.connection.should be_instance_of(Twelve::Connection)
|
13
|
+
api.connection.access_token.should == ACCESS_TOKEN
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/twelve.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "twelve/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "twelve"
|
7
|
+
s.version = Twelve::VERSION
|
8
|
+
s.authors = ["Jonathan Hoyt"]
|
9
|
+
s.email = ["jonmagic@gmail.com"]
|
10
|
+
s.homepage = "http://github.com/jonmagic/twelve"
|
11
|
+
s.summary = %q{Access Gauges in ruby.}
|
12
|
+
s.description = %q{A complete, simple, and intuitive ruby API for all things Gauges.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "twelve"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'faraday'
|
22
|
+
s.add_runtime_dependency 'faraday_middleware'
|
23
|
+
s.add_runtime_dependency 'multi_json'
|
24
|
+
s.add_runtime_dependency 'yajl-ruby'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rspec', '~>2.0'
|
27
|
+
s.add_development_dependency 'webmock'
|
28
|
+
s.add_development_dependency 'vcr'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: twelve
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jonathan Hoyt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-09 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: faraday
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: faraday_middleware
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: multi_json
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yajl-ruby
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rake
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: rspec
|
92
|
+
prerelease: false
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 2
|
101
|
+
- 0
|
102
|
+
version: "2.0"
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: webmock
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
type: :development
|
118
|
+
version_requirements: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: vcr
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id008
|
133
|
+
description: A complete, simple, and intuitive ruby API for all things Gauges.
|
134
|
+
email:
|
135
|
+
- jonmagic@gmail.com
|
136
|
+
executables: []
|
137
|
+
|
138
|
+
extensions: []
|
139
|
+
|
140
|
+
extra_rdoc_files: []
|
141
|
+
|
142
|
+
files:
|
143
|
+
- .gitignore
|
144
|
+
- Gemfile
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- Rakefile
|
148
|
+
- lib/twelve.rb
|
149
|
+
- lib/twelve/api/clients.rb
|
150
|
+
- lib/twelve/api/gauges.rb
|
151
|
+
- lib/twelve/api/gauges/content.rb
|
152
|
+
- lib/twelve/api/gauges/engines.rb
|
153
|
+
- lib/twelve/api/gauges/locations.rb
|
154
|
+
- lib/twelve/api/gauges/referrers.rb
|
155
|
+
- lib/twelve/api/gauges/resolutions.rb
|
156
|
+
- lib/twelve/api/gauges/shares.rb
|
157
|
+
- lib/twelve/api/gauges/technology.rb
|
158
|
+
- lib/twelve/api/gauges/terms.rb
|
159
|
+
- lib/twelve/api/gauges/traffic.rb
|
160
|
+
- lib/twelve/api/me.rb
|
161
|
+
- lib/twelve/connection.rb
|
162
|
+
- lib/twelve/resource_proxy.rb
|
163
|
+
- lib/twelve/version.rb
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/twelve/api/clients_spec.rb
|
166
|
+
- spec/twelve/api/gauges/content_spec.rb
|
167
|
+
- spec/twelve/api/gauges/engines_spec.rb
|
168
|
+
- spec/twelve/api/gauges/locations_spec.rb
|
169
|
+
- spec/twelve/api/gauges/referrers_spec.rb
|
170
|
+
- spec/twelve/api/gauges/resolutions_spec.rb
|
171
|
+
- spec/twelve/api/gauges/shares_spec.rb
|
172
|
+
- spec/twelve/api/gauges/technology_spec.rb
|
173
|
+
- spec/twelve/api/gauges/terms_spec.rb
|
174
|
+
- spec/twelve/api/gauges/traffic_spec.rb
|
175
|
+
- spec/twelve/api/gauges_spec.rb
|
176
|
+
- spec/twelve/api/me_spec.rb
|
177
|
+
- spec/twelve/connection_spec.rb
|
178
|
+
- spec/twelve/resource_proxy_spec.rb
|
179
|
+
- spec/twelve_spec.rb
|
180
|
+
- twelve.gemspec
|
181
|
+
homepage: http://github.com/jonmagic/twelve
|
182
|
+
licenses: []
|
183
|
+
|
184
|
+
post_install_message:
|
185
|
+
rdoc_options: []
|
186
|
+
|
187
|
+
require_paths:
|
188
|
+
- lib
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
hash: 3
|
195
|
+
segments:
|
196
|
+
- 0
|
197
|
+
version: "0"
|
198
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
+
none: false
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
hash: 3
|
204
|
+
segments:
|
205
|
+
- 0
|
206
|
+
version: "0"
|
207
|
+
requirements: []
|
208
|
+
|
209
|
+
rubyforge_project: twelve
|
210
|
+
rubygems_version: 1.8.6
|
211
|
+
signing_key:
|
212
|
+
specification_version: 3
|
213
|
+
summary: Access Gauges in ruby.
|
214
|
+
test_files:
|
215
|
+
- spec/spec_helper.rb
|
216
|
+
- spec/twelve/api/clients_spec.rb
|
217
|
+
- spec/twelve/api/gauges/content_spec.rb
|
218
|
+
- spec/twelve/api/gauges/engines_spec.rb
|
219
|
+
- spec/twelve/api/gauges/locations_spec.rb
|
220
|
+
- spec/twelve/api/gauges/referrers_spec.rb
|
221
|
+
- spec/twelve/api/gauges/resolutions_spec.rb
|
222
|
+
- spec/twelve/api/gauges/shares_spec.rb
|
223
|
+
- spec/twelve/api/gauges/technology_spec.rb
|
224
|
+
- spec/twelve/api/gauges/terms_spec.rb
|
225
|
+
- spec/twelve/api/gauges/traffic_spec.rb
|
226
|
+
- spec/twelve/api/gauges_spec.rb
|
227
|
+
- spec/twelve/api/me_spec.rb
|
228
|
+
- spec/twelve/connection_spec.rb
|
229
|
+
- spec/twelve/resource_proxy_spec.rb
|
230
|
+
- spec/twelve_spec.rb
|