hdo-storting-importer 0.3.7 → 0.3.8

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: 6dd6d7e280a3b4652fdba0b86b7575d1dd9ca4e3
4
- data.tar.gz: 03ef9bebf0c9ccad233f3ca5065b9b21422bd97c
3
+ metadata.gz: 5af832dfe75f36ebe57837c1765372a3006db7ce
4
+ data.tar.gz: 188fc6fa520a69fa71e3fc062bcfdc35942e8dc8
5
5
  SHA512:
6
- metadata.gz: b0b656209a26d71e97d2ac31f9973f9c6632e5404e6518272d4a2bcb431b8b62cb4df86cccf9bb10b849a99eac165809b47602ca828bb0c566899767ad62c0e9
7
- data.tar.gz: 5a292ad4053c5fdc0fcdf09e0066d410d1551ceb29a084a46b6f0fff8a02d0aa5490c353aa9ef58a01755361ab17151d38a7827f0754746e51868dd755c3cbbb
6
+ metadata.gz: 9f0014cc7fc871d881a6bd035d346a340cc475dc856e93690f925726f365041943072f9e01fd49e1a2f0a4e774b9f16fe008e47aae0f4006c09f0125e1074163
7
+ data.tar.gz: c05a862e059dfa37ac2e6d7a2b95b144e156429c17427d850877ede306996b56c680adefec25e93cfb952c912d398941c6e1c9e2cf4541ad41a9ad506748f256
data/.travis.yml CHANGED
@@ -7,7 +7,7 @@ notifications:
7
7
  irc:
8
8
  channels:
9
9
  - "irc.freenode.net#holderdeord"
10
- on_success: change
10
+ on_success: always
11
11
  on_failure: change
12
12
  template:
13
13
  - "%{author} | %{commit} | %{message} | %{build_url}"
@@ -16,7 +16,7 @@ module Hdo
16
16
 
17
17
  #
18
18
  # Who and who isn't in government is not available in the data
19
- # from Stortinget and changes just every 4 years, so we hardcode it here.
19
+ # from Stortinget, so we hardcode it here.
20
20
  #
21
21
 
22
22
  def self.all
@@ -41,12 +41,11 @@ module Hdo
41
41
  attr_reader :schema
42
42
 
43
43
  def schema_path(path)
44
- @schema = MultiJson.decode(open(path).read)
45
- HasJsonSchema.schemas << @schema
44
+ @schema_path = path
46
45
  end
47
46
 
48
47
  def schema
49
- @schema or raise "schema must be set with #{self}.schema_path"
48
+ @schema ||= load_schema
50
49
  end
51
50
 
52
51
  def json_example
@@ -95,6 +94,17 @@ module Hdo
95
94
  rescue Jschematic::ValidationError => ex
96
95
  raise ValidationError, "#{ex.message}: #{e.inspect}"
97
96
  end
97
+
98
+ private
99
+
100
+ def load_schema
101
+ @schema_path or raise "schema must be set with #{self}.schema_path"
102
+
103
+ schema = MultiJson.decode(File.read(@schema_path))
104
+ HasJsonSchema.schemas << schema
105
+
106
+ schema
107
+ end
98
108
  end
99
109
 
100
110
  end
@@ -38,7 +38,14 @@ module Hdo
38
38
  end
39
39
 
40
40
  def self.from_xlsx(path)
41
- table = Roo::Excelx.new(path)
41
+ from_spreadsheet Roo::Excelx.new(path)
42
+ end
43
+
44
+ def self.from_xls(path)
45
+ from_spreadsheet Roo::Excel.new(path)
46
+ end
47
+
48
+ def self.from_spreadsheet(table)
42
49
  raise "empty spreadsheet" unless table.first_row
43
50
 
44
51
  errors = []
@@ -1,5 +1,5 @@
1
1
  module Hdo
2
2
  module StortingImporter
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  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.7
4
+ version: 0.3.8
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-06-03 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -347,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
347
  version: '0'
348
348
  requirements: []
349
349
  rubyforge_project:
350
- rubygems_version: 2.0.0
350
+ rubygems_version: 2.0.7
351
351
  signing_key:
352
352
  specification_version: 4
353
353
  summary: Gem to process data from data.stortinget.no