geoloqi 0.9.24 → 0.9.26
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/geoloqi/session.rb +7 -1
- data/lib/geoloqi/version.rb +1 -1
- data/spec/geoloqi_spec.rb +12 -0
- metadata +1 -1
data/lib/geoloqi/session.rb
CHANGED
@@ -71,7 +71,13 @@ module Geoloqi
|
|
71
71
|
meth == :get ? req.params = query : req.body = query.to_json
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
|
+
if @config.logger
|
76
|
+
@config.logger.print "### Geoloqi::Session - #{meth.to_s.upcase} #{path}"
|
77
|
+
@config.logger.print Rack::Utils.build_query(query) unless query.nil?
|
78
|
+
@config.logger.puts "\nStatus: #{raw.status}\nHeaders: #{raw.headers.inspect}\nBody: #{raw.body}"
|
79
|
+
end
|
80
|
+
|
75
81
|
Response.new raw.status, raw.headers, raw.body
|
76
82
|
end
|
77
83
|
|
data/lib/geoloqi/version.rb
CHANGED
data/spec/geoloqi_spec.rb
CHANGED
@@ -103,6 +103,18 @@ describe Geoloqi::Config do
|
|
103
103
|
expect { io.string =~ /Geoloqi::Session/ }
|
104
104
|
end
|
105
105
|
|
106
|
+
it 'displays log information if logger is provided and query is nil' do
|
107
|
+
stub_request(:get, api_url('account/username')).
|
108
|
+
with(:headers => {'Authorization'=>'OAuth access_token1234'}).
|
109
|
+
to_return(:body => {'username' => 'bulbasaurrulzok'}.to_json)
|
110
|
+
|
111
|
+
io = StringIO.new
|
112
|
+
Geoloqi.config :client_id => CLIENT_ID, :client_secret => CLIENT_SECRET, :logger => io
|
113
|
+
|
114
|
+
Geoloqi.get ACCESS_TOKEN, 'account/username'
|
115
|
+
expect { io.string =~ /Geoloqi::Session/ }
|
116
|
+
end
|
117
|
+
|
106
118
|
|
107
119
|
it 'correctly checks booleans for client_id and client_secret' do
|
108
120
|
[:client_id, :client_secret].each do |k|
|