billit_representers 0.8.3 → 0.8.4

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: d5d7e8a6d21a09483bb00173dbd21b4e4389a6b7
4
- data.tar.gz: 70c24d4f62e49153cedd95124ab17d63e8b86c64
3
+ metadata.gz: 92349605d6f5378b519ebcd94577cc8388cd6f54
4
+ data.tar.gz: d865a188aaddae8d356f5a10002be8035afb10e1
5
5
  SHA512:
6
- metadata.gz: 792ab01ad1067c8b528ff501d6273242e6a4e1077bc5982e8db708046a96007d035557ab475bf1ebaf9912218741c7c760fde4a4bbf7f6861410593987a520d1
7
- data.tar.gz: 7768eac61da8ae932f393a6723332f8ed97cb7675cdcb80c4d332378d7d87a6e314e2c853ed6093557ea102f62b890f6ab845b404b7bd9e28635a228cfc2e173
6
+ metadata.gz: dc9867bb82c8f03743a674704dfe16dbe3824bf0e73125329615676371e000d05a572558869ff694122f6c9bfaf0a4a9cfa12948aa42e7b166c27442bf7f3d25
7
+ data.tar.gz: e42255d477e515dee3e52efa59752f459d7be557bcafe3fac16ca271cabd28b6e95d6ef23c57bb3f801a5f59c16c1af495f7d25e3bccd8e15e18ca149bf27630
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'billit_representers'
3
- gem.version = '0.8.3'
3
+ gem.version = '0.8.4'
4
4
  gem.date = '2014-02-07'
5
5
  gem.summary = "Representers for the bill-it module of the Poplus project."
6
6
  gem.description = "Representers for the bill-it module of the Poplus project. These provide object-like access to remote data, using Resource-Oriented Architectures in Ruby (ROAR)."
@@ -0,0 +1,18 @@
1
+ require 'billit_representers/representers/bill_model_collection_page_representer'
2
+ module Billit
3
+ class BillCollectionPage
4
+ include Billit::BillModelCollectionPageRepresenter
5
+
6
+ def self
7
+ links[:self].href if links[:self].href
8
+ end
9
+
10
+ def next
11
+ links[:next].href if links[:next]
12
+ end
13
+
14
+ def previous
15
+ links[:previous].href if links[:previous]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,48 @@
1
+ require 'roar/representer/json'
2
+ require 'billit_representers/models/bill'
3
+ require 'billit_representers/representers/bill_representer'
4
+
5
+ module Billit
6
+ module BillModelCollectionPageRepresenter
7
+
8
+ include Roar::Representer::JSON
9
+ include Roar::Representer::Feature::Hypermedia
10
+
11
+ module Initializer
12
+ def initialize
13
+ extend Billit::BillModelCollectionPageRepresenter
14
+ extend Roar::Representer::Feature::Client
15
+ super
16
+ end
17
+ end
18
+
19
+ def self.included(klass)
20
+ klass.send :prepend, Initializer
21
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
22
+ end
23
+
24
+ collection :bills, :extend => Billit::BillModelRepresenter, :class => Billit::Bill
25
+
26
+ property :total_entries
27
+ property :current_page
28
+ property :total_pages
29
+
30
+ link :self do |params|
31
+ url_for(params.merge(:page => current_page))
32
+ end
33
+
34
+ link :next do |params|
35
+ url_for(params.merge(:page => next_page)) \
36
+ if next_page
37
+ end
38
+
39
+ link :previous do |params|
40
+ url_for(params.merge(:page => previous_page)) \
41
+ if previous_page
42
+ end
43
+
44
+ def bills
45
+ self
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,148 @@
1
+ require 'roar/representer'
2
+ require 'roar/representer/feature/http_verbs'
3
+ require 'roar/representer/feature/client'
4
+ require 'roar/representer/json'
5
+ require 'roar/representer/json/hal'
6
+ # require 'roar/rails/hal'
7
+ require 'active_model'
8
+ require 'billit_representers/representers/paperwork_representer'
9
+ require 'billit_representers/representers/priority_representer'
10
+ require 'billit_representers/representers/report_representer'
11
+ require 'billit_representers/representers/document_representer'
12
+ require 'billit_representers/representers/directive_representer'
13
+ require 'billit_representers/representers/remark_representer'
14
+ require 'billit_representers/representers/revision_representer'
15
+ require 'billit_representers/models/paperwork'
16
+ require 'billit_representers/models/priority'
17
+ require 'billit_representers/models/report'
18
+ require 'billit_representers/models/document'
19
+ require 'billit_representers/models/directive'
20
+ require 'billit_representers/models/remark'
21
+ require 'billit_representers/models/revision'
22
+
23
+ module Billit
24
+ module BillModelRepresenter
25
+ include Roar::Representer::JSON::HAL
26
+ # include Roar::Rails::HAL
27
+ # include Roar::Representer::JSON
28
+
29
+ module Initializer
30
+ def initialize
31
+ extend Billit::BillModelRepresenter
32
+ extend Roar::Representer::Feature::Client
33
+ super
34
+ end
35
+ end
36
+
37
+ def self.included(klass)
38
+ klass.send :prepend, Initializer
39
+ klass.send :include, ActiveModel::Validations
40
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
41
+ klass.validates_presence_of :uid
42
+ klass.validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
43
+ klass.validates :stage, inclusion: { in: @@stage_valid_values }
44
+ klass.validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
45
+ klass.validates :current_priority, inclusion: { in: @@current_priority_valid_values }
46
+ end
47
+
48
+ property :uid
49
+ property :title
50
+ property :creation_date
51
+ property :source
52
+ property :initial_chamber
53
+ property :current_priority
54
+ property :stage
55
+ property :sub_stage
56
+ property :status
57
+ property :resulting_document
58
+ property :law_link
59
+ property :merged_bills
60
+ property :subject_areas
61
+ property :authors
62
+ property :publish_date
63
+ property :abstract
64
+ property :tags
65
+ property :bill_draft_link
66
+
67
+ collection :paperworks, extend: Billit::PaperworkRepresenter, class: Billit::Paperwork
68
+ collection :priorities, extend: Billit::PriorityRepresenter, class: Billit::Priority
69
+ collection :reports, extend: Billit::ReportRepresenter, class: Billit::Report
70
+ collection :documents, extend: Billit::DocumentRepresenter, class: Billit::Document
71
+ collection :directives, extend: Billit::DirectiveRepresenter, class: Billit::Directive
72
+ collection :remarks, extend: Billit::RemarkRepresenter, class: Billit::Remark
73
+ collection :revisions, extend: Billit::RevisionRepresenter, class: Billit::Revision
74
+
75
+ link :self do
76
+ bill_url(self.uid)
77
+ end
78
+
79
+ @@subject_areas_valid_values =
80
+ [
81
+ 'Defensa',
82
+ 'Impuestos',
83
+ 'Economía',
84
+ 'Empresas',
85
+ 'Hacienda',
86
+ 'Relaciones Exteriores',
87
+ 'Administración',
88
+ 'Asunto Indígena',
89
+ 'Zona Extrema',
90
+ 'Regionalización',
91
+ 'Salud',
92
+ 'Minería',
93
+ 'Medio Ambiente',
94
+ 'Derechos Animales',
95
+ 'Vivienda',
96
+ 'Obras Públicas',
97
+ 'Transporte',
98
+ 'Telecomunicaciones',
99
+ 'Trabajo',
100
+ 'Protección Social',
101
+ 'Cultura',
102
+ 'Educación',
103
+ 'Deportes',
104
+ 'Transparencia',
105
+ 'Probidad',
106
+ 'Elecciones',
107
+ 'Participación',
108
+ 'Familia',
109
+ 'Seguridad',
110
+ 'Derechos Fundamentales',
111
+ 'Nacionalidad',
112
+ 'Reconstrucción Terremoto'
113
+ ]
114
+
115
+ @@stage_valid_values =
116
+ [
117
+ 'Archivado',
118
+ 'Comisión Mixta Ley de Presupuesto',
119
+ 'Comisión Mixta por rechazo de idea de legislar',
120
+ 'Comisión Mixta por rechazo de modificaciones',
121
+ 'Disc. informe C.Mixta por rechazo de modific. en C...',
122
+ 'Discusión veto en Cámara de Origen',
123
+ 'Discusión veto en Cámara Revisora',
124
+ 'Insistencia',
125
+ 'Primer trámite constitucional',
126
+ 'Retirado',
127
+ 'Segundo trámite constitucional',
128
+ 'Tercer trámite constitucional',
129
+ 'Tramitación terminada',
130
+ 'Trámite de aprobacion presidencial',
131
+ 'Trámite finalización en Cámara de Origen'
132
+ ]
133
+
134
+ @@initial_chamber_valid_values =
135
+ [
136
+ 'C.Diputados',
137
+ 'Senado'
138
+ ]
139
+
140
+ @@current_priority_valid_values =
141
+ [
142
+ 'Discusión inmediata',
143
+ 'Simple',
144
+ 'Sin urgencia',
145
+ 'Suma'
146
+ ]
147
+ end
148
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billit_representers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcel Augsburger
@@ -66,6 +66,7 @@ files:
66
66
  - billit_representers.gemspec
67
67
  - lib/billit_representers.rb
68
68
  - lib/billit_representers/models/bill.rb
69
+ - lib/billit_representers/models/bill_page.rb
69
70
  - lib/billit_representers/models/directive.rb
70
71
  - lib/billit_representers/models/document.rb
71
72
  - lib/billit_representers/models/paperwork.rb
@@ -76,6 +77,8 @@ files:
76
77
  - lib/billit_representers/models/revision.rb
77
78
  - lib/billit_representers/representers/bill_collection_page_representer.rb
78
79
  - lib/billit_representers/representers/bill_collection_representer.rb
80
+ - lib/billit_representers/representers/bill_model_collection_page_representer.rb
81
+ - lib/billit_representers/representers/bill_model_representer.rb
79
82
  - lib/billit_representers/representers/bill_representer.rb
80
83
  - lib/billit_representers/representers/directive_representer.rb
81
84
  - lib/billit_representers/representers/document_representer.rb