hdo-storting-importer 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 797bc0f05e3fc75b91a35322e1638bcc8103977a
4
- data.tar.gz: 4d52c0aec8069b11c1e0e63cd720b35185a31bf5
3
+ metadata.gz: 1182e5642b0955869ae3c0425018775fe2bef132
4
+ data.tar.gz: 54f6706a0ab1c0c2e1c0cb78713d9492bff944a7
5
5
  SHA512:
6
- metadata.gz: 16424ec8da10a4bb44a4ed5ba3d49beefbb3c3df632f5ae218a7260b9a05b986cc03b3b866cc03341541784db60aa8a61b3f178c4209705b59858e4abaf96664
7
- data.tar.gz: 935678f65e6f974fca1eeae86b945eb10aa89a5cfc0291aff3ff883560577b6769c2961da2f2bc87f7504b9c21272757329284e73490a12ad9266c362bc41674
6
+ metadata.gz: 63b7c08200579bbb5ed9be4991977a42928c172ba291a4f54be183f31b11f46ade4253f1ef222f3c8dffb3ead12bd87ba2bb8246d07b1a13cd5b2b71d4e91549
7
+ data.tar.gz: 66d0eb069be3951d9713d1b8cb810c8bc2d666dc5100b3a2fe4938d870be2169f64c47c3de1e0acd1ba391e147d6905d50e4c60214f13bbf7c305bcb58f5330c
@@ -8,7 +8,7 @@ module Hdo
8
8
  include HasJsonSchema
9
9
  include IvarEquality
10
10
 
11
- attr_reader :external_id, :parties, :body, :general, :categories, :source, :page, :date
11
+ attr_reader :external_id, :parties, :body, :general, :categories, :source, :page, :period
12
12
  alias_method :general?, :general
13
13
  alias_method :short_inspect, :inspect
14
14
 
@@ -23,7 +23,7 @@ module Hdo
23
23
  ["GRUNNSKOLE"],
24
24
  "PP",
25
25
  8,
26
- '2009-06-01'
26
+ '2009-2013'
27
27
  )
28
28
 
29
29
  if overrides
@@ -50,7 +50,7 @@ module Hdo
50
50
  Hdo::StortingImporter.logger.info "promise row: #{data.inspect}"
51
51
 
52
52
  external_id = data.fetch(0).to_i.to_s
53
- date = data.fetch(1)
53
+ period = data.fetch(1)
54
54
  parties = data.fetch(2)
55
55
  body = data.fetch(3)
56
56
  general = data.fetch(4).to_s.strip.downcase
@@ -91,7 +91,7 @@ module Hdo
91
91
  clean_invalid_unicode.call(categories),
92
92
  source.strip,
93
93
  Integer(page),
94
- date.strip
94
+ period.strip
95
95
 
96
96
  begin
97
97
  promise.validate!
@@ -118,12 +118,12 @@ module Hdo
118
118
  hash['categories'],
119
119
  hash['source'],
120
120
  hash['page'],
121
- hash['date']
121
+ hash['period']
122
122
 
123
123
  pr
124
124
  end
125
125
 
126
- def initialize(external_id, parties, body, general, categories, source, page, date)
126
+ def initialize(external_id, parties, body, general, categories, source, page, period)
127
127
  @external_id = external_id
128
128
  @parties = clean_array(parties)
129
129
  @body = strip_if_string(body)
@@ -131,7 +131,7 @@ module Hdo
131
131
  @categories = clean_array(categories).map { |e| UnicodeUtils.upcase(e) }
132
132
  @source = strip_if_string(source)
133
133
  @page = page
134
- @date = date
134
+ @period = period
135
135
  end
136
136
 
137
137
  def to_hash
@@ -144,7 +144,7 @@ module Hdo
144
144
  'source' => @source,
145
145
  'page' => @page,
146
146
  'body' => @body,
147
- 'date' => @date
147
+ 'period' => @period
148
148
  }
149
149
  end
150
150
 
@@ -47,10 +47,10 @@
47
47
  "description": "The body text of the promise.",
48
48
  "required": true
49
49
  },
50
- "date": {
50
+ "period": {
51
51
  "type": "string",
52
- "description": "The date the promise was made.",
53
- "format": "date",
52
+ "description": "The period for which this promise is valid.",
53
+ "pattern": "\\d{4}-\\d{4}",
54
54
  "required": true
55
55
  }
56
56
  }
@@ -1,5 +1,5 @@
1
1
  module Hdo
2
2
  module StortingImporter
3
- VERSION = "0.3.5"
3
+ VERSION = "0.3.6"
4
4
  end
5
5
  end
@@ -19,23 +19,23 @@ module Hdo
19
19
  "source": "PP",
20
20
  "page": 8,
21
21
  "body": "Stille strengere krav til orden og oppførsel for å hindre at uro ødelegger undervisningen.",
22
- "date": "2009-06-01"
22
+ "period": "2009-2013"
23
23
  }
24
24
  JSON
25
25
  end
26
26
 
27
27
  it 'strips trailing space from the body' do
28
- promise = Promise.new("1", "Party", "Body ", true, ["æøå"], "PP", 8, '2012-06-01')
28
+ promise = Promise.new("1", "Party", "Body ", true, ["æøå"], "PP", 8, '2009-2013')
29
29
  promise.body.should == "Body"
30
30
  end
31
31
 
32
32
  it 'correctly upcases non-ASCII category names' do
33
- promise = Promise.new("1", "Party", "Body", true, ["æøå"], "PP", 8, '2012-06-01')
33
+ promise = Promise.new("1", "Party", "Body", true, ["æøå"], "PP", 8, '2009-2013')
34
34
  promise.categories.should == ["ÆØÅ"]
35
35
  end
36
36
 
37
37
  it 'ignores empty categories' do
38
- promise = Promise.new("1", "Party", "Body", true, ["FOO", ""], "PP", 8, '2012-06-01')
38
+ promise = Promise.new("1", "Party", "Body", true, ["FOO", ""], "PP", 8, '2009-2013')
39
39
  promise.categories.should == ["FOO"]
40
40
  end
41
41
 
@@ -44,6 +44,9 @@ module Hdo
44
44
  obj.body.should == 'foo'
45
45
  end
46
46
 
47
+ it 'is invalid if period is not the correct format' do
48
+ Promise.example('period' => '2009-06-01').should_not be_valid
49
+ end
47
50
 
48
51
  end
49
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hdo-storting-importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-06 00:00:00.000000000 Z
11
+ date: 2013-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder