google-content-api 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4b0edb7f4385f09ec139db71b5d5dfddf1370ae
4
- data.tar.gz: a66db9f7b7625d7cb9b0e483418fb3e3583e82ea
3
+ metadata.gz: 0bad2e14d77467236f59375f48be51d5f6e64eaf
4
+ data.tar.gz: 04f008fcfb3c2a637511aa225115967d93e261b3
5
5
  SHA512:
6
- metadata.gz: 0c2a5ca59b7d5258d6f739e65bf6a241579e036539ff5447e805a5d516f2ccf3c7f3a6a74625d5109865ff09658240c21fc970d9307b97ed03aecf6f56727510
7
- data.tar.gz: 83ad329bf312982173f7cd84f8d6f0ac5464de948273837e0cd36a3c628cfd73620c236a40931aa71f79d7f155c3a5f73771063c6ca171e25d9263b4bea711c3
6
+ metadata.gz: 1d2e20d597e00e9d162f2dcbdce96d95fbe451992a62bf090330f86b50e8aaf7a993305ef370f975e20c6e13b6ef0a362f2800fd341b8769f758a73046ee90a2
7
+ data.tar.gz: 0ce2a82011c3659a79795f17e59cf3a59ab6858f2a6a4b36ee6aaa85c0af58dff6f205afc17672ffd4d1b0db4ea26747ed8ed7311528c56be378202233d5f476
@@ -176,6 +176,14 @@ module GoogleContentApi
176
176
  if attributes[:unit_pricing_measure] && attributes[:unit]
177
177
  xml['scp'].unit_pricing_measure_ attributes[:unit_pricing_measure], :unit => attributes[:unit]
178
178
  end
179
+ if attributes[:sale_price]
180
+ xml['scp'].sale_price_ attributes[:sale_price], :unit => attributes[:currency]
181
+ end
182
+ if attributes[:sale_price_effective_date]
183
+ range = attributes[:sale_price_effective_date]
184
+ format = "%Y-%m-%dT%H:%M:%SZ"
185
+ xml['scp'].sale_price_effective_date range.begin.utc.strftime(format) + "/" + range.end.utc.strftime(format)
186
+ end
179
187
  (0..4).each do |i|
180
188
  if attributes["custom_label_#{i}".to_sym]
181
189
  xml['scp'].send "custom_label_#{i}_".to_sym, attributes["custom_label_#{i}".to_sym]
@@ -1,3 +1,3 @@
1
1
  module GoogleContentApi
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -101,6 +101,16 @@ describe GoogleContentApi::Product do
101
101
  result_xml.should match "<scp:custom_label_0>bla</scp:custom_label_0>"
102
102
  result_xml.should match "<scp:custom_label_1>foo</scp:custom_label_1>"
103
103
  end
104
+
105
+ it "adds sale price" do
106
+ result_xml = subject.send(:create_product_items_batch_xml, [product_attributes.merge(:sale_price => 1.23)])
107
+ result_xml.should match /<scp:sale_price unit="[A-Z]+">1.23<\/scp:sale_price>/
108
+ end
109
+
110
+ it "adds sale price effective date" do
111
+ result_xml = subject.send(:create_product_items_batch_xml, [product_attributes.merge(:sale_price_effective_date => (Time.utc(2014, 1, 1)..Time.utc(2014, 1, 2)))])
112
+ result_xml.should match "<scp:sale_price_effective_date>2014-01-01T00:00:00Z/2014-01-02T00:00:00Z</scp:sale_price_effective_date>"
113
+ end
104
114
  end
105
115
  end
106
116
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-content-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - DaWanda GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler