parliamentarian 0.8.8 → 0.9.1

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
  SHA256:
3
- metadata.gz: a8b5a3028c73a5863acb868b3f12ef9b945f484b3c69f590d4f25154a911a3fa
4
- data.tar.gz: 15f40db79771b83704c75c328503dd5686af7a6aaba4be5ea34af008788a43c2
3
+ metadata.gz: 3ff846997b701058c50dc24d29f18106586be4a3405417fd4a2ffb262041b531
4
+ data.tar.gz: a9a038f780eb9444252d78ab066919d7c74f51f2cbc3f2dd358fc54717ecbc00
5
5
  SHA512:
6
- metadata.gz: 8f1d8013a232ea47b941e881c0a8df3f2eeb0dbcc87342978aec8b3b33841c1ec0214f25403af7dc797cac1ad3391cdabd4df2a2cd07ee12fb95e61467be3c2e
7
- data.tar.gz: a2ab3ac29a7cf2469da5b483bcd383cdc3f396d50cb25a2fcbdc5374986dc9897231a2ac853241694708f1e73d16c26bbccaaf87af5f9c6cb4963ec3f1b09e0a
6
+ metadata.gz: de73f8b0eceec430f89e1628af8b85c67c6ff238f17d74d065c730e73eed67e2848d8d47a4215329e726cb4e666b26491bc8feb0850d9466fdeafdf64be02e83
7
+ data.tar.gz: bc79f6da0a5dec2b2c8af6533cf2967853629a79ee04e077eb7f870f8be0d1b5b25db1718a372d20fe75326916fdf15ce29388a3fc526586f620af4d7c28e7fd
data/CHANGELOG ADDED
@@ -0,0 +1,43 @@
1
+ # CHANGELOG
2
+
3
+ ## 20260913
4
+
5
+ 0.9.1: - the blank line inside each class and module, and above each closing end.
6
+
7
+ 1. lib: - 10 blank lines, across Australia/Federal.rb, Australia/Victoria.rb and VERSION.rb, each immediately inside a class or module line or above a closing end.
8
+ 2. ~ Parliamentarian::VERSION: /0.9.0/0.9.1/
9
+
10
+ 0.9.0: + README.md, CHANGELOG, Rakefile.
11
+
12
+ 1. + README.md: what the library does, the two parliaments it covers, the method per chamber, and that a row's attributes are the CSV's own headings underscored. 31 of the 32 gems here carry one and this was the exception.
13
+ 2. + CHANGELOG: this file. The commit subjects name a version from 0.8.6 back; before that the history is the import of 20210408 and says nothing about releases.
14
+ 3. + Rakefile: a rake/testtask naming test/Parliamentarian/**/*.rb. The tests carry no _test suffix, so the usual glob finds nothing, and they are named directly rather than through test/Parliamentarian.rb: that runner shares its name with the library, so requiring it under rake's loader makes `require 'Parliamentarian'` from within a test resolve back to the runner which is still loading, and the constant is never defined.
15
+ 4. ~ parliamentarian.gemspec: + 'CHANGELOG', 'README.md' and 'Rakefile' to spec.files, without which the three sit in the repository and the gem does not carry them; and the list reordered, the gemspec first and then the globs and the rest alphabetically, which is how the estate writes it.
16
+ 5. ~ Parliamentarian::VERSION: /0.8.8/0.9.0/
17
+
18
+ 0.8.8: ~ test/Parliamentarian/Australia/Victoria.rb: the council stub returned the assembly's rows.
19
+
20
+
21
+ ## 20260911
22
+
23
+ 0.8.7: ~ lib/Parliamentarian.rb: + require of Parliamentarian/VERSION; ~ VERSION.rb: /class/module/, the library declaring a module; + test/Parliamentarian/VERSION.rb
24
+
25
+
26
+ ## 20260822
27
+
28
+ 0.8.6: + LICENSE, and the gemspec: /Ruby/MIT/, - spec.date.
29
+
30
+ 1. ~ parliamentarian.gemspec: /Ruby/MIT/, it having named a licence the repository never carried; - spec.date, which rubygems sets from the build.
31
+ 2. + .gitignore, for .DS_Store and *.gem, and - lib/.DS_Store and the four under test/. Both 20210409, the day after 0.8.5, and recorded here as the first versioned commit after them.
32
+ 3. ~ Parliamentarian::VERSION: /0.8.5/0.8.6/
33
+
34
+
35
+ ## 20210408
36
+
37
+ 0.8.5: + VERSION, the gemspec, and the required lib files; ~ Gemfile: + webmock.
38
+
39
+ 1. + VERSION file.
40
+ 2. + parliamentarian.gemspec.
41
+ 3. ~ Gemfile to include webmock.
42
+ 4. + required lib files, to be broken out later.
43
+ 5. Taken from lib/parliamentarian.rb's in-source change log, items 10 to 13 under its 4/5 marker.
data/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # Parliamentarian
2
+
3
+ ## Description
4
+
5
+ Download and parse the current list of members of parliament, and their contact
6
+ details, from the parliaments which publish one as a CSV.
7
+
8
+ Two are covered so far: the federal parliament of Australia, and the parliament of
9
+ the State of Victoria. Each chamber is a method, and each row comes back as an
10
+ object whose attributes are the column headings underscored, so a CSV which gains
11
+ a column gains an attribute without anything here being changed.
12
+
13
+ ## Installation
14
+
15
+ ### 0. Have a recent version of Ruby installed
16
+
17
+ ### 1. Via RubyGems
18
+
19
+ ```shell
20
+ $ gem install parliamentarian
21
+ ```
22
+
23
+ Or in a Gemfile:
24
+
25
+ ```ruby
26
+ gem 'parliamentarian'
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Australia, federally
32
+
33
+ ```ruby
34
+ require 'parliamentarian'
35
+
36
+ Parliamentarian::Australia::Federal.senators
37
+ # => [#<Parliamentarian::Australia::Federal>, ...], the Senate
38
+
39
+ Parliamentarian::Australia::Federal.members
40
+ # => [#<Parliamentarian::Australia::Federal>, ...], the House of Representatives
41
+
42
+ Parliamentarian::Australia::Federal.all
43
+ # => both chambers together
44
+ ```
45
+
46
+ ### Victoria
47
+
48
+ ```ruby
49
+ Parliamentarian::Australia::Victoria.legislative_councillors
50
+ # => [#<Parliamentarian::Australia::Victoria>, ...], the upper house
51
+
52
+ Parliamentarian::Australia::Victoria.legislative_assemblymembers
53
+ # => [#<Parliamentarian::Australia::Victoria>, ...], the lower house
54
+
55
+ Parliamentarian::Australia::Victoria.all
56
+ # => both houses together
57
+ ```
58
+
59
+ ### A member
60
+
61
+ The attributes are the CSV's own column headings, underscored:
62
+
63
+ ```ruby
64
+ member = Parliamentarian::Australia::Victoria.legislative_councillors.first
65
+
66
+ member.last_name # => "Smith"
67
+ member.preferred_name # => "Jane"
68
+ member.electorate # => "Southern Metropolitan"
69
+ member.party # => "Australian Labor Party"
70
+ member.eo_postcode # => "3000", taken from the electorate office address
71
+ ```
72
+
73
+ `first_name`, `firstname`, `lastname` and `surname` are aliases, the two
74
+ parliaments not agreeing on which of them to publish.
75
+
76
+ ### Reading from a file rather than the web
77
+
78
+ Each method takes a path, which is what the tests use and what a cached copy
79
+ wants:
80
+
81
+ ```ruby
82
+ Parliamentarian::Australia::Victoria.legislative_councillors('councilmembers.csv')
83
+ Parliamentarian::Australia::Victoria.all('councilmembers.csv', 'assemblymembers.csv')
84
+ ```
85
+
86
+ A path is read from disk and anything with an `http` or `https` scheme is
87
+ fetched, so the same method serves both.
88
+
89
+ ## Contributing
90
+
91
+ 1. Fork it: `https://github.com/thoran/Parliamentarian/fork`
92
+ 2. Create your feature branch: `git checkout -b my-new-feature`
93
+ 3. Commit your changes: `git commit -am 'Add some feature'`
94
+ 4. Push to the branch: `git push origin my-new-feature`
95
+ 5. Create a new pull request
96
+
97
+ ## License
98
+
99
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # Rakefile
2
+
3
+ require 'rake/testtask'
4
+
5
+ # The tests carry no _test suffix, so the usual glob finds nothing, and they are
6
+ # named directly rather than through test/Parliamentarian.rb: that runner shares
7
+ # its name with the library, so requiring it under rake's loader makes
8
+ # `require 'Parliamentarian'` from within a test resolve back to the runner which
9
+ # is still loading. Each test puts lib on the load path for itself.
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.test_files = FileList['test/Parliamentarian/**/*.rb']
12
+ end
13
+
14
+ task default: :test
@@ -8,12 +8,10 @@ require 'String/underscore'
8
8
  module Parliamentarian
9
9
  module Australia
10
10
  class Federal
11
-
12
11
  SENATE_URL = 'https://www.aph.gov.au/~/media/03%20Senators%20and%20Members/Address%20Labels%20and%20CSV%20files/Senators/allsenel.csv?la=en'
13
12
  HOUSE_OF_REPRESENTATIVES_URL = 'https://www.aph.gov.au/~/media/03%20Senators%20and%20Members/Address%20Labels%20and%20CSV%20files/SurnameRepsCSV.csv?la=en'
14
13
 
15
14
  class << self
16
-
17
15
  def fetch(csv_file_location)
18
16
  raw_csv = if ['http', 'https'].include?(URI.parse(csv_file_location).scheme)
19
17
  URI.open(csv_file_location)
@@ -42,7 +40,6 @@ module Parliamentarian
42
40
  )
43
41
  end
44
42
  alias_method :house_of_representatives, :members
45
-
46
43
  end # class << self
47
44
 
48
45
  def initialize(row)
@@ -89,7 +86,6 @@ module Parliamentarian
89
86
  end
90
87
  )
91
88
  end
92
-
93
89
  end
94
90
  end
95
91
  end
@@ -8,12 +8,10 @@ require 'String/underscore'
8
8
  module Parliamentarian
9
9
  module Australia
10
10
  class Victoria
11
-
12
11
  LEGISLATIVE_COUNCIL_URL = 'https://www.parliament.vic.gov.au/images/members/councilmembers.csv'
13
12
  LEGISLATIVE_ASSEMBLY_URL = 'https://www.parliament.vic.gov.au/images/members/assemblymembers.csv'
14
13
 
15
14
  class << self
16
-
17
15
  def fetch(csv_file_location)
18
16
  raw_csv = if ['http', 'https'].include?(URI.parse(csv_file_location).scheme)
19
17
  URI.open(csv_file_location)
@@ -40,7 +38,6 @@ module Parliamentarian
40
38
  fetch(csv_file_location).collect{|row| self.new(row)}
41
39
  )
42
40
  end
43
-
44
41
  end # class << self
45
42
 
46
43
  def initialize(row)
@@ -68,7 +65,6 @@ module Parliamentarian
68
65
  self.class.send(:attr_accessor, 'postcode')
69
66
  self.postcode = eo_address.split.last
70
67
  end
71
-
72
68
  end
73
69
  end
74
70
  end
@@ -1,5 +1,3 @@
1
1
  module Parliamentarian
2
-
3
- VERSION = '0.8.8'
4
-
2
+ VERSION = '0.9.1'
5
3
  end
@@ -14,11 +14,14 @@ Gem::Specification.new do |spec|
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = [
17
+ 'parliamentarian.gemspec',
17
18
  Dir['lib/**/*.rb'],
18
19
  Dir['test/**/*.rb'],
20
+ 'CHANGELOG',
19
21
  'Gemfile',
20
22
  'LICENSE',
21
- 'parliamentarian.gemspec',
23
+ 'README.md',
24
+ 'Rakefile',
22
25
  ].flatten
23
26
  spec.required_ruby_version = '>= 2.5'
24
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliamentarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -59,8 +59,11 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - CHANGELOG
62
63
  - Gemfile
63
64
  - LICENSE
65
+ - README.md
66
+ - Rakefile
64
67
  - lib/Array/blankQ.rb
65
68
  - lib/Array/extract_optionsX.rb
66
69
  - lib/Array/peek_options.rb