sensis 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +95 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +216 -0
- data/Rakefile +23 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/sensis.rb +320 -0
- data/lib/sensis/version.rb +3 -0
- data/sensis.gemspec +32 -0
- data/spec/dummy/Gemfile +7 -0
- data/spec/dummy/Gemfile.lock +90 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/javascripts/application.js +6 -0
- data/spec/dummy/app/assets/stylesheets/application.css +5 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +18 -0
- data/spec/dummy/config/environments/production.rb +52 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/sensis.yml.example +11 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/lib/search_spec.rb +33 -0
- data/spec/spec_helper.rb +24 -0
- data/uninstall.rb +1 -0
- metadata +246 -0
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sensis do
|
4
|
+
|
5
|
+
context "using sensis search" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@api_key = Sensis.api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return results" do
|
12
|
+
res = Sensis.search(:key => @api_key, :query => "poker", :location => "2034")
|
13
|
+
res.results.size.should == 20
|
14
|
+
res.code.should == 200
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should raise error if :key is missing" do
|
18
|
+
lambda { Sensis.search }.should raise_error(RuntimeError)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should raise error if both query and location are missing" do
|
22
|
+
lambda { Sensis.search(:key => "asdf") }.should raise_error(RuntimeError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should raise Net::HTTPServerException when an invalid key is given" do
|
26
|
+
lambda {
|
27
|
+
res = Sensis.search(:key => "43nb7zf444", :query => "poker", :location => "2034")
|
28
|
+
}.should raise_error(Net::HTTPServerException)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
# require 'database_cleaner'
|
3
|
+
|
4
|
+
API_ROOT = Pathname.new(File.expand_path(File.dirname(__FILE__ + "/../../..")))
|
5
|
+
# Support files
|
6
|
+
Dir[API_ROOT + "spec/support/**/*.rb"].each { |f| require f }
|
7
|
+
|
8
|
+
require API_ROOT + "spec/dummy/config/environment"
|
9
|
+
|
10
|
+
# Dir[API_ROOT + "app/models/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
# # Truncate the database when the tests are done
|
13
|
+
# DatabaseCleaner.strategy = :truncation
|
14
|
+
#
|
15
|
+
# RSpec.configure do |c|
|
16
|
+
# c.after(:each) do
|
17
|
+
# DatabaseCleaner.clean
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# def p(*args)
|
22
|
+
# puts caller.join("\n")
|
23
|
+
# super
|
24
|
+
# end
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sensis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ben Wiseley
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-11-17 00:00:00 +11:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec-rails
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec-core
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: nokogiri
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: json
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: ruby-debug
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rcov
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: tzinfo
|
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
|
+
description: More on Sensis search api http://developers.sensis.com.au/
|
120
|
+
email:
|
121
|
+
- wiseley@gmail.com
|
122
|
+
executables: []
|
123
|
+
|
124
|
+
extensions: []
|
125
|
+
|
126
|
+
extra_rdoc_files: []
|
127
|
+
|
128
|
+
files:
|
129
|
+
- .gitignore
|
130
|
+
- .rvmrc
|
131
|
+
- Gemfile
|
132
|
+
- Gemfile.lock
|
133
|
+
- MIT-LICENSE
|
134
|
+
- README.markdown
|
135
|
+
- Rakefile
|
136
|
+
- init.rb
|
137
|
+
- install.rb
|
138
|
+
- lib/sensis.rb
|
139
|
+
- lib/sensis/version.rb
|
140
|
+
- sensis.gemspec
|
141
|
+
- spec/dummy/.bundle/config
|
142
|
+
- spec/dummy/Gemfile
|
143
|
+
- spec/dummy/Gemfile.lock
|
144
|
+
- spec/dummy/Rakefile
|
145
|
+
- spec/dummy/app/assets/javascripts/application.js
|
146
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
147
|
+
- spec/dummy/app/controllers/application_controller.rb
|
148
|
+
- spec/dummy/app/helpers/application_helper.rb
|
149
|
+
- spec/dummy/app/mailers/.gitkeep
|
150
|
+
- spec/dummy/app/models/.gitkeep
|
151
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
152
|
+
- spec/dummy/config.ru
|
153
|
+
- spec/dummy/config/application.rb
|
154
|
+
- spec/dummy/config/boot.rb
|
155
|
+
- spec/dummy/config/database.yml
|
156
|
+
- spec/dummy/config/environment.rb
|
157
|
+
- spec/dummy/config/environments/development.rb
|
158
|
+
- spec/dummy/config/environments/production.rb
|
159
|
+
- spec/dummy/config/environments/test.rb
|
160
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
161
|
+
- spec/dummy/config/initializers/inflections.rb
|
162
|
+
- spec/dummy/config/initializers/mime_types.rb
|
163
|
+
- spec/dummy/config/initializers/secret_token.rb
|
164
|
+
- spec/dummy/config/initializers/session_store.rb
|
165
|
+
- spec/dummy/config/locales/en.yml
|
166
|
+
- spec/dummy/config/routes.rb
|
167
|
+
- spec/dummy/config/sensis.yml.example
|
168
|
+
- spec/dummy/log/.gitkeep
|
169
|
+
- spec/dummy/public/404.html
|
170
|
+
- spec/dummy/public/422.html
|
171
|
+
- spec/dummy/public/500.html
|
172
|
+
- spec/dummy/public/favicon.ico
|
173
|
+
- spec/dummy/script/rails
|
174
|
+
- spec/lib/search_spec.rb
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- uninstall.rb
|
177
|
+
has_rdoc: true
|
178
|
+
homepage: https://github.com/wiseleyb/Sensis
|
179
|
+
licenses: []
|
180
|
+
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
|
184
|
+
require_paths:
|
185
|
+
- lib
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
hash: 3
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
version: "0"
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 3
|
201
|
+
segments:
|
202
|
+
- 0
|
203
|
+
version: "0"
|
204
|
+
requirements: []
|
205
|
+
|
206
|
+
rubyforge_project: sensis
|
207
|
+
rubygems_version: 1.3.7
|
208
|
+
signing_key:
|
209
|
+
specification_version: 3
|
210
|
+
summary: Ruby gem for Sensis search api
|
211
|
+
test_files:
|
212
|
+
- spec/dummy/.bundle/config
|
213
|
+
- spec/dummy/Gemfile
|
214
|
+
- spec/dummy/Gemfile.lock
|
215
|
+
- spec/dummy/Rakefile
|
216
|
+
- spec/dummy/app/assets/javascripts/application.js
|
217
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
218
|
+
- spec/dummy/app/controllers/application_controller.rb
|
219
|
+
- spec/dummy/app/helpers/application_helper.rb
|
220
|
+
- spec/dummy/app/mailers/.gitkeep
|
221
|
+
- spec/dummy/app/models/.gitkeep
|
222
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
223
|
+
- spec/dummy/config.ru
|
224
|
+
- spec/dummy/config/application.rb
|
225
|
+
- spec/dummy/config/boot.rb
|
226
|
+
- spec/dummy/config/database.yml
|
227
|
+
- spec/dummy/config/environment.rb
|
228
|
+
- spec/dummy/config/environments/development.rb
|
229
|
+
- spec/dummy/config/environments/production.rb
|
230
|
+
- spec/dummy/config/environments/test.rb
|
231
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
232
|
+
- spec/dummy/config/initializers/inflections.rb
|
233
|
+
- spec/dummy/config/initializers/mime_types.rb
|
234
|
+
- spec/dummy/config/initializers/secret_token.rb
|
235
|
+
- spec/dummy/config/initializers/session_store.rb
|
236
|
+
- spec/dummy/config/locales/en.yml
|
237
|
+
- spec/dummy/config/routes.rb
|
238
|
+
- spec/dummy/config/sensis.yml.example
|
239
|
+
- spec/dummy/log/.gitkeep
|
240
|
+
- spec/dummy/public/404.html
|
241
|
+
- spec/dummy/public/422.html
|
242
|
+
- spec/dummy/public/500.html
|
243
|
+
- spec/dummy/public/favicon.ico
|
244
|
+
- spec/dummy/script/rails
|
245
|
+
- spec/lib/search_spec.rb
|
246
|
+
- spec/spec_helper.rb
|