efo_nelfo 1.1.0 → 1.2.0

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: b537774388538c770ec1282b7d1c5902ea651989
4
- data.tar.gz: 179c2a02944098fcecd0d28d5e3e36fdebd40cb0
3
+ metadata.gz: 1f389f65b4a9eb9dd8dc8c08c7a35d503681d80c
4
+ data.tar.gz: 49a45cedbc30524de77097fdcd8e404417358333
5
5
  SHA512:
6
- metadata.gz: 69ea8d385d4dca754374bb43c92eb91a2d29ab06b3547369f65b56a08334ce3c15d04881a859af4fbc70c229ce4bfa3b19c75061f55ace5fa4ba1dee1c99080f
7
- data.tar.gz: a83c65e5668b027e7d5eefa60bfd9603c8c6981833919aeeb7d271ce565ea980b7ebbea3d3fcbac8939e2ee825e41d234a48c84c4e2bea6296880152aee1d926
6
+ metadata.gz: f976078206c2b97b86a93919996ba2ba1986120b0ed844833dda3b326947bbef7fd73315f5fd94c2c775160dac8e7f3fc46e7e41bd01980d4e3fa5b5b6351b28
7
+ data.tar.gz: e0fecdcd62acf5815e5c6271977948857059fda3bfdcacdc58df828842d2cc2ddc04070bba59f3339ec64bbb6d5dca1e090cf261202325edf15a4b4537ce72af
@@ -29,6 +29,10 @@ module EfoNelfo
29
29
  product_type == 4 ? product_number : nil
30
30
  end
31
31
 
32
+ def images
33
+ info.map(&:image).compact
34
+ end
35
+
32
36
  end
33
37
  end
34
38
  end
@@ -4,6 +4,15 @@ module EfoNelfo
4
4
  property :post_type, alias: :PostType, limit: 2, default: post_type
5
5
  property :field, alias: :FeltId, limit: 10, required: true
6
6
  property :value, alias: :Verdi, limit: 70, required: true
7
+
8
+ def image?
9
+ field == 'BILDE'
10
+ end
11
+
12
+ def image
13
+ value if image?
14
+ end
15
+
7
16
  end
8
17
  end
9
18
  end
@@ -1,3 +1,3 @@
1
1
  module EfoNelfo
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/spec/vl_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe EfoNelfo::V40::VL do
4
+
5
+ let(:vl) { EfoNelfo::V40::VL.new }
6
+
7
+ describe "#images" do
8
+ it "returns nil when there are no images available" do
9
+ vl.images.must_be_empty
10
+ end
11
+
12
+ it "returns array of urls when images are present" do
13
+ vl.info << { field: 'BILDE', value: 'http://foo/bar.png' }
14
+ vl.info << { field: 'BILDE', value: 'http://foo/bar.gif' }
15
+ vl.info << { field: 'VEKT', value: '2kg' }
16
+ vl.images.must_equal ['http://foo/bar.png', 'http://foo/bar.gif']
17
+ end
18
+
19
+ end
20
+
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: efo_nelfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gudleik Rasch
@@ -158,6 +158,7 @@ files:
158
158
  - spec/samples/varefil_eksempel.csv
159
159
  - spec/samples/varer_small.csv
160
160
  - spec/spec_helper.rb
161
+ - spec/vl_spec.rb
161
162
  homepage: http://efo.no
162
163
  licenses:
163
164
  - MIT
@@ -201,3 +202,4 @@ test_files:
201
202
  - spec/samples/varefil_eksempel.csv
202
203
  - spec/samples/varer_small.csv
203
204
  - spec/spec_helper.rb
205
+ - spec/vl_spec.rb