-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
119 changed files
with
10,137 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Parliament | ||
module Decorators | ||
module ConstituencyArea | ||
def latitude | ||
respond_to?(:constituencyAreaLatitude) ? constituencyAreaLatitude : '' | ||
end | ||
|
||
def longitude | ||
respond_to?(:constituencyAreaLongitude) ? constituencyAreaLongitude : '' | ||
end | ||
|
||
def polygon | ||
respond_to?(:constituencyAreaExtent) ? constituencyAreaExtent : '' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module Parliament | ||
module Decorators | ||
module ConstituencyGroup | ||
def name | ||
respond_to?(:constituencyGroupName) ? constituencyGroupName : '' | ||
end | ||
|
||
def start_date | ||
respond_to?(:constituencyGroupStartDate) ? constituencyGroupStartDate : '' | ||
end | ||
|
||
def end_date | ||
respond_to?(:constituencyGroupEndDate) ? constituencyGroupEndDate : '' | ||
end | ||
|
||
def seats | ||
respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : [] | ||
end | ||
|
||
def seat_incumbencies | ||
return @seat_incumbencies unless @seat_incumbencies.nil? | ||
|
||
seat_incumbencies = [] | ||
seats.each do |seat| | ||
seat_incumbencies << seat.seat_incumbencies | ||
end | ||
|
||
@seat_incumbencies = seat_incumbencies.flatten.uniq | ||
end | ||
|
||
def members | ||
return @members unless @members .nil? | ||
|
||
members = [] | ||
seat_incumbencies.each do |seat_incumbency| | ||
members << seat_incumbency.member | ||
end | ||
|
||
@members = members.flatten.uniq | ||
end | ||
|
||
def area | ||
respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil | ||
end | ||
|
||
def contact_points | ||
return @contact_points unless @contact_points.nil? | ||
|
||
contact_points = [] | ||
seat_incumbencies.each do |seat_incumbency| | ||
contact_points << seat_incumbency.contact_points | ||
end | ||
|
||
@contact_points = contact_points.flatten.uniq | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Parliament | ||
module Decorators | ||
module ContactPoint | ||
def postal_addresses | ||
respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress : [] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Parliament | ||
module Decorators | ||
module Gender | ||
def name | ||
respond_to?(:genderName) ? genderName : '' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Parliament | ||
module Decorators | ||
module GenderIdentity | ||
def gender | ||
respond_to?(:genderIdentityHasGender) ? genderIdentityHasGender.first : nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Parliament | ||
module Decorators | ||
module House | ||
def name | ||
respond_to?(:houseName) ? houseName : '' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Parliament | ||
module Decorators | ||
module HouseSeat | ||
def house | ||
respond_to?(:houseSeatHasHouse) ? houseSeatHasHouse.first : nil | ||
end | ||
|
||
def constituency | ||
respond_to?(:houseSeatHasConstituencyGroup) ? houseSeatHasConstituencyGroup.first : nil | ||
end | ||
|
||
def seat_incumbencies | ||
respond_to?(:houseSeatHasSeatIncumbency) ? houseSeatHasSeatIncumbency : [] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Parliament | ||
module Decorators | ||
module PartyMembership | ||
def party | ||
respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil | ||
end | ||
|
||
def start_date | ||
respond_to?(:partyMembershipStartDate) ? partyMembershipStartDate : '' | ||
end | ||
|
||
def end_date | ||
respond_to?(:partyMembershipEndDate) ? partyMembershipEndDate : '' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Parliament | ||
module Decorators | ||
module PostalAddress | ||
def full_address | ||
address_array.join(', ') | ||
end | ||
|
||
private | ||
|
||
def address_array | ||
address_array = [] | ||
(1..5).each do |i| | ||
if respond_to?("addressLine#{i}".to_sym) | ||
address_array << instance_variable_get("@addressLine#{i}".to_sym) | ||
end | ||
end | ||
address_array << postCode if respond_to?(:postCode) | ||
address_array | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Parliament | ||
module Decorators | ||
module SeatIncumbency | ||
def start_date | ||
respond_to?(:seatIncumbencyStartDate) ? seatIncumbencyStartDate : '' | ||
end | ||
|
||
def end_date | ||
respond_to?(:seatIncumbencyEndDate) ? seatIncumbencyEndDate : '' | ||
end | ||
|
||
def seat | ||
respond_to?(:seatIncumbencyHasHouseSeat) ? seatIncumbencyHasHouseSeat.first : nil | ||
end | ||
|
||
def member | ||
respond_to?(:seatIncumbencyHasMember) ? seatIncumbencyHasMember.first : nil | ||
end | ||
|
||
def current? | ||
has_end_date = respond_to?(:seatIncumbencyEndDate) | ||
|
||
!has_end_date | ||
end | ||
|
||
def house | ||
seat.nil? ? nil : seat.house | ||
end | ||
|
||
def constituency | ||
seat.nil? ? nil : seat.constituency | ||
end | ||
|
||
def contact_points | ||
respond_to?(:seatIncumbencyHasContactPoint) ? seatIncumbencyHasContactPoint : [] | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.