hdo-storting-importer 0.5.6 → 0.5.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: 0c3d13a06c7ea55cc04ad7141a7336571aa06cac
4
- data.tar.gz: dd694adc08a45ee11478a29e5b9d771290f9bed3
3
+ metadata.gz: 3c84c68937cad8fc60f41a854c96563f4636432e
4
+ data.tar.gz: 6c018689a03459290880cedc6327e998003b5a92
5
5
  SHA512:
6
- metadata.gz: 7f3d898f4bb92157937e8ff04b0874e437894cff1fdb0684b259cd03ae005ac272430a30e60be9b08c6467a09a1f163c1aee32d08f2024e4a9bf6a93ef821132
7
- data.tar.gz: a6271016a4f37a68e1a95be5e27a2d36c14f18e351d38650329515990790f32cd6a4d781509c1cb6f276c2fa8fbdf1f1b4d71f33fb590878b92962586b3f47b4
6
+ metadata.gz: beabc7770b26f7010682b7578f0ef8df848d424ac3391d06fea0066c835880ec5ce416db7ec03f6d0c0b9712fb3c31d06422a006af1b4e08262c57fffd7200f9
7
+ data.tar.gz: f49cfe73e20c27db2114633806d6a71b6a921bfcd12fb9e7f098b8928e9a49a0165dc495aff6ef6c2f23d0adc5b4b39dfa7f9d632ec2548f52f96c30aaa8b841
@@ -10,7 +10,7 @@ module Hdo
10
10
  attr_reader :external_id, :first_name, :last_name, :email, :date_of_birth, :date_of_death,
11
11
  :district, :parties, :committees, :period, :gender
12
12
 
13
- attr_accessor :vote_result, :permanent_substitute_for
13
+ attr_accessor :vote_result, :permanent_substitute_for, :substitute
14
14
 
15
15
  schema_path StortingImporter.lib.join("hdo/storting_importer/schema/representative.json").to_s
16
16
 
@@ -85,9 +85,14 @@ module Hdo
85
85
  committees
86
86
  )
87
87
 
88
- sub = node.css('fast_vara_for').first
88
+ sub_for = node.css('fast_vara_for').first
89
+ if sub_for && sub_for['nil'] != 'true'
90
+ rep.permanent_substitute_for = sub_for.css("id").first.text
91
+ end
92
+
93
+ sub = node.css('vara').first
89
94
  if sub && sub['nil'] != 'true'
90
- rep.permanent_substitute_for = sub.css("id").first.text
95
+ rep.substitute = sub.css('id').first.text
91
96
  end
92
97
 
93
98
  rep
@@ -107,6 +112,7 @@ module Hdo
107
112
 
108
113
  v.vote_result = hash['vote_result']
109
114
  v.permanent_substitute_for = hash['permanent_substitute_for']
115
+ v.substitute = hash['substitute']
110
116
 
111
117
  v
112
118
  end
@@ -123,8 +129,9 @@ module Hdo
123
129
  @parties = parties
124
130
  @committees = committees
125
131
 
126
- @vote_result = nil
132
+ @vote_result = nil
127
133
  @permanent_substitute_for = nil
134
+ @substitute = nil
128
135
  end
129
136
 
130
137
  def short_inspect
@@ -152,6 +159,7 @@ module Hdo
152
159
 
153
160
  h['vote_result'] = @vote_result if @vote_result
154
161
  h['permanent_substitute_for'] = @permanent_substitute_for if @permanent_substitute_for
162
+ h['substitute'] = @substitute if @substitute
155
163
 
156
164
  h
157
165
  end
@@ -61,7 +61,11 @@
61
61
  },
62
62
  "permanent_substitute_for": {
63
63
  "type": "string",
64
- "description": "A representative the current representative is a permanent substitute for."
64
+ "description": "The external id of the representative the current representative is a permanent substitute for."
65
+ },
66
+ "substitute": {
67
+ "type": "string",
68
+ "description": "The external id of the representative that is the substitute for the current representative"
65
69
  }
66
70
  }
67
71
  }
@@ -1,5 +1,5 @@
1
1
  module Hdo
2
2
  module StortingImporter
3
- VERSION = "0.5.6"
3
+ VERSION = "0.5.7"
4
4
  end
5
5
  end
@@ -120,6 +120,16 @@ module Hdo
120
120
  Representative.from_hash(data).permanent_substitute_for.should == "JB"
121
121
  end
122
122
 
123
+ it 'serializes the "substitute" field' do
124
+ obj = Representative.example
125
+ obj.substitute = "JB"
126
+
127
+ data = obj.to_hash
128
+ data['substitute'].should == "JB"
129
+
130
+ Representative.from_hash(data).substitute.should == "JB"
131
+ end
132
+
123
133
  end
124
134
  end
125
135
  end
@@ -65,7 +65,7 @@ module Hdo
65
65
  vote.external_id.should == "2175"
66
66
  vote.external_issue_id.should == "51448"
67
67
  vote.should be_personal
68
- vote.enacted.should be_false
68
+ vote.enacted.should be false
69
69
  vote.subject.should == 'Forslag 24 - 26 på vegne av Per Olaf Lundteigen'
70
70
  vote.method_name.should == 'ikke_spesifisert'
71
71
  vote.result_type.should == 'ikke_spesifisert'
data/spec/spec_helper.rb CHANGED
@@ -42,6 +42,8 @@ module Hdo
42
42
  "expected #{@target.inspect} not to be #{@expected}"
43
43
  end
44
44
 
45
+ alias_method :failure_message_when_negated, :negative_failure_message
46
+
45
47
  private
46
48
 
47
49
  def diff
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.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder