collection-json 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ module CollectionJSON
22
22
  def add_query_params(query, params)
23
23
  query << params.keys.inject('') do |query, key|
24
24
  query.tap do |query_string|
25
- unless data.map(&name).include?(key)
25
+ unless data.map(&name).include?(key.to_s)
26
26
  query << '&' unless key == params.keys.first
27
27
  query << CGI.escape(key.to_s)
28
28
  query << "=#{CGI.escape(params[key].to_s)}"
@@ -11,7 +11,8 @@ module CollectionJSON
11
11
  {'template' => Hash.new}.tap do |hash|
12
12
  hash['template']['data'] = data.inject([]) do |array,data|
13
13
  result = {'name' => data.name, 'value' => data.value}
14
- result['value'] = params[data.name] if params[data.name]
14
+ result['value'] = params[data.name] unless params[data.name].nil?
15
+ result['value'] = params[data.name.to_sym] unless params[data.name.to_sym].nil?
15
16
  result['value'].nil? ? array : array << result
16
17
  end
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module CollectionJSON
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collection-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000 Z
12
+ date: 2012-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70202255799500 !ruby/object:Gem::Requirement
16
+ requirement: &70333449812460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70202255799500
24
+ version_requirements: *70333449812460
25
25
  description: Lightweight gem for building Collection+JSON responses.
26
26
  email:
27
27
  - sebastian@uprise.co.nz