poms 2.1.2.1 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/poms/fields.rb +10 -2
- data/lib/poms/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f974c08408f4d51d55403210e099410fd2030fea
|
4
|
+
data.tar.gz: a8621cc51d99c4257639d45addec5c55f4170d0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b0f22e2f765d73fcbe1ab67be1003f7b328c21181ebf3006d20a05a5f16049a17e63d75cdd95bc8af09229b2b4f05d16785a916115460c2adcbc790b3528578
|
7
|
+
data.tar.gz: 0a6bd52ccd8123d5da464c1406599b7f182e0cb216b75032640c92e5d2c7ec4830ebc7f19c26240ef517d93ec5482339642c38935f368cc7d31514d086e990da
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Poms Release notes
|
2
2
|
|
3
|
+
## 2.1.3
|
4
|
+
|
5
|
+
* Order images array by likelyhood of a higher quality image (type: PROMO_LANDSCAPE > PICTURE > STILL).
|
6
|
+
|
3
7
|
## 2.1.2.1
|
4
8
|
|
5
9
|
* Fix a minor bug on `Poms::Fields.title`. This could be triggered when a result from a Poms query would be empty. `nil` would be sumitted and the provided key would be called on `nil` which caused an error. Now it will simply return `nil` as a title.
|
data/lib/poms/fields.rb
CHANGED
@@ -6,6 +6,8 @@ module Poms
|
|
6
6
|
module Fields
|
7
7
|
module_function
|
8
8
|
|
9
|
+
IMAGE_TYPE_PRIORITY = %w(PROMO_LANDSCAPE PICTURE).freeze
|
10
|
+
|
9
11
|
# Returns the title, main by default
|
10
12
|
def title(item, type = 'MAIN')
|
11
13
|
value_of_type(item, 'titles', type)
|
@@ -18,7 +20,9 @@ module Poms
|
|
18
20
|
|
19
21
|
# Returns the images from the hash
|
20
22
|
def images(item)
|
21
|
-
item['images']
|
23
|
+
item['images'].try(:sort_by) do |i|
|
24
|
+
image_order_index(i)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
# Extracts the image id from an image hash
|
@@ -28,7 +32,11 @@ module Poms
|
|
28
32
|
image['imageUri'].split(':').last
|
29
33
|
end
|
30
34
|
|
31
|
-
|
35
|
+
def image_order_index(image)
|
36
|
+
IMAGE_TYPE_PRIORITY.index(image['type']) || IMAGE_TYPE_PRIORITY.size
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the id of the first image or nil if there are none.
|
32
40
|
def first_image_id(item)
|
33
41
|
return unless images(item)
|
34
42
|
image_id(images(item).first)
|
data/lib/poms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Kruijsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.5.1
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Interface to POMS CouchDB API
|