shopstyle 0.4.1 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/shopstyle.rb +18 -1
  2. data/shopstyle.gemspec +2 -2
  3. metadata +4 -5
@@ -4,8 +4,25 @@ end
4
4
 
5
5
  module ShopStyleHelper
6
6
  require 'cgi'
7
+
8
+ # If you want to, e.g., request N products
9
+ # you must specificy the relevant parameter N times
10
+ # In that case you'd pass in :prodid => [1,2,3],
11
+ # which this will then map to
12
+ # "prodid=1&prodid=2&prodid=3"
13
+
7
14
  def query_from_params params
8
- params.map { |key, value| "%s=%s" % [escape(key),escape(value)] }.join('&')
15
+ params.map do |key,value|
16
+ if value.is_a?(Array)
17
+ query_from_params ([key]*value.size).zip(value)
18
+ else
19
+ format_param_pair key, value
20
+ end
21
+ end.join('&')
22
+ end
23
+
24
+ def format_param_pair key, value
25
+ "%s=%s" % [escape(key),escape(value)]
9
26
  end
10
27
 
11
28
  def escape value
@@ -1,7 +1,7 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'shopstyle'
3
- s.version = '0.4.1'
4
- s.date = '2010-06-23'
3
+ s.version = '0.5'
4
+ s.date = '2010-07-15'
5
5
  s.summary = "A simple clent for the ShopStyle API"
6
6
  s.description = "A Ruby implementation of the ShopStyle API"
7
7
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopstyle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
8
+ - 5
9
+ version: "0.5"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jesse Farmer
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-06-23 00:00:00 -07:00
17
+ date: 2010-07-15 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency