citygrid_api 0.0.11 → 0.0.12

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
data/citygrid_api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "citygrid_api"
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Elpizo Choi"]
12
- s.date = "2012-05-02"
12
+ s.date = "2012-05-07"
13
13
  s.description = "Ruby wrapper for CityGrid APIs"
14
14
  s.email = "fu7iin@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/citygrid/api.rb CHANGED
@@ -115,7 +115,9 @@ class CityGrid
115
115
  # Any other format with :body node
116
116
  else
117
117
  to_merge = safe_options[:body].merge(unsafe_params.select { |k| safe_options[:body].keys.include? k })
118
- return safe_options.merge({ :body => to_merge })
118
+ safe_options.merge!({ :body => to_merge })
119
+ safe_options[:body] = safe_options[:body].to_json
120
+ return safe_options
119
121
  end
120
122
  # If the parameters are contained in the :query node of the options hash
121
123
  elsif options[:query] && !options[:query].nil?
@@ -172,10 +174,12 @@ class CityGrid
172
174
  rescue => ex
173
175
  raise CityGridExceptions::RequestError.new req, ex
174
176
  ensure
175
- if defined?(Rails.logger)
176
- Rails.logger.info req_to_output.to_curl
177
- else
178
- puts req_to_output.to_curl
177
+ if CityGrid.print_curls?
178
+ if defined?(Rails.logger)
179
+ Rails.logger.info req_to_output.to_curl
180
+ else
181
+ puts req_to_output.to_curl
182
+ end
179
183
  end
180
184
  end
181
185
 
data/lib/citygrid.rb CHANGED
@@ -27,6 +27,16 @@ class CityGrid
27
27
  !defined?(@raise_errors) || @raise_errors
28
28
  end
29
29
 
30
+ # whether the gem with print curls or not
31
+ # by default it will not print curls
32
+ def print_curls= v
33
+ @print_curls = v
34
+ end
35
+
36
+ def print_curls?
37
+ defined?(@print_curls) ? @print_curls : false
38
+ end
39
+
30
40
  def use_vcr= v
31
41
  @use_vcr = v
32
42
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: citygrid_api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Elpizo Choi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-02 00:00:00 Z
13
+ date: 2012-05-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty