Class: Hdo::StortingImporter::CachingDataSource
- Inherits:
-
DataSource
- Object
- DataSource
- Hdo::StortingImporter::CachingDataSource
- Defined in:
- lib/hdo/storting_importer/caching_data_source.rb
Instance Method Summary collapse
- #categories ⇒ Object
- #committees(session_id) ⇒ Object
- #districts ⇒ Object
-
#initialize(delegate, cache = InMemoryCache.new) ⇒ CachingDataSource
constructor
A new instance of CachingDataSource.
- #parliament_issue_details(parliament_issue_id) ⇒ Object
- #parliament_issues(session_id) ⇒ Object
- #parliament_periods ⇒ Object
- #parliament_sessions ⇒ Object
- #parties(session_id) ⇒ Object
- #propositions_for(vote_id) ⇒ Object
- #representatives(period) ⇒ Object
- #representatives_today ⇒ Object
- #vote_results_for(vote_id) ⇒ Object
- #votes_for(issue_id) ⇒ Object
Constructor Details
#initialize(delegate, cache = InMemoryCache.new) ⇒ CachingDataSource
Returns a new instance of CachingDataSource.
4 5 6 7 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 4 def initialize(delegate, cache = InMemoryCache.new) @delegate = delegate @cache = cache end |
Instance Method Details
#categories ⇒ Object
39 40 41 42 43 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 39 def categories cache :categories do @delegate.categories end end |
#committees(session_id) ⇒ Object
27 28 29 30 31 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 27 def committees(session_id) cache :committees, session_id do @delegate.committees session_id end end |
#districts ⇒ Object
33 34 35 36 37 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 33 def districts cache :districts do @delegate.districts end end |
#parliament_issue_details(parliament_issue_id) ⇒ Object
63 64 65 66 67 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 63 def parliament_issue_details(parliament_issue_id) cache :parliament_issue_details, parliament_issue_id do @delegate.parliament_issue_details parliament_issue_id end end |
#parliament_issues(session_id) ⇒ Object
57 58 59 60 61 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 57 def parliament_issues(session_id) cache :parliament_issues, session_id do @delegate.parliament_issues session_id end end |
#parliament_periods ⇒ Object
45 46 47 48 49 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 45 def parliament_periods cache :parliament_periods do @delegate.parliament_periods end end |
#parliament_sessions ⇒ Object
51 52 53 54 55 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 51 def parliament_sessions cache :parliament_sessions do @delegate.parliament_sessions end end |
#parties(session_id) ⇒ Object
21 22 23 24 25 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 21 def parties(session_id) cache :parties, session_id do @delegate.parties(session_id) end end |
#propositions_for(vote_id) ⇒ Object
75 76 77 78 79 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 75 def propositions_for(vote_id) cache :propositions_for, vote_id do @delegate.propositions_for vote_id end end |
#representatives(period) ⇒ Object
9 10 11 12 13 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 9 def representatives(period) cache :representatives, period do @delegate.representatives(period) end end |
#representatives_today ⇒ Object
15 16 17 18 19 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 15 def representatives_today cache :representatives_today do @delegate.representatives_today end end |
#vote_results_for(vote_id) ⇒ Object
81 82 83 84 85 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 81 def vote_results_for(vote_id) cache :vote_results_for, vote_id do @delegate.vote_results_for vote_id end end |
#votes_for(issue_id) ⇒ Object
69 70 71 72 73 |
# File 'lib/hdo/storting_importer/caching_data_source.rb', line 69 def votes_for(issue_id) cache :votes_for, issue_id do @delegate.votes_for issue_id end end |