billit_representers 0.9.10 → 0.10.0
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 +4 -4
- data/billit_representers.gemspec +3 -2
- data/lib/billit_representers/models/cl/bill.rb +26 -0
- data/lib/billit_representers/models/cl/bill_basic.rb +26 -0
- data/lib/billit_representers/models/cl/bill_page.rb +20 -0
- data/lib/billit_representers/models/cl/directive.rb +8 -0
- data/lib/billit_representers/models/cl/document.rb +8 -0
- data/lib/billit_representers/models/cl/paperwork.rb +8 -0
- data/lib/billit_representers/models/cl/paperwork_page.rb +8 -0
- data/lib/billit_representers/models/cl/priority.rb +8 -0
- data/lib/billit_representers/models/cl/remark.rb +8 -0
- data/lib/billit_representers/models/cl/report.rb +8 -0
- data/lib/billit_representers/models/cl/revision.rb +8 -0
- data/lib/billit_representers/representers/bill_page_representer.rb +3 -3
- data/lib/billit_representers/representers/bill_representer.rb +6 -119
- data/lib/billit_representers/representers/cl/bill_basic_representer.rb +140 -0
- data/lib/billit_representers/representers/cl/bill_page_representer.rb +50 -0
- data/lib/billit_representers/representers/cl/bill_representer.rb +162 -0
- data/lib/billit_representers/representers/cl/directive_representer.rb +34 -0
- data/lib/billit_representers/representers/cl/document_representer.rb +37 -0
- data/lib/billit_representers/representers/cl/paperwork_page_representer.rb +32 -0
- data/lib/billit_representers/representers/cl/paperwork_representer.rb +62 -0
- data/lib/billit_representers/representers/cl/priority_representer.rb +37 -0
- data/lib/billit_representers/representers/cl/remark_representer.rb +33 -0
- data/lib/billit_representers/representers/cl/report_representer.rb +34 -0
- data/lib/billit_representers/representers/cl/revision_representer.rb +31 -0
- data/lib/billit_representers/representers/cl/table_page_representer.rb +35 -0
- data/lib/billit_representers/representers/cl/table_representer.rb +37 -0
- metadata +27 -34
- data/lib/billit_representers/models/bill_basic.rb +0 -24
- data/lib/billit_representers/models/bill_update.rb +0 -6
- data/lib/billit_representers/models/count.rb +0 -4
- data/lib/billit_representers/models/directive.rb +0 -4
- data/lib/billit_representers/models/document.rb +0 -4
- data/lib/billit_representers/models/motion.rb +0 -8
- data/lib/billit_representers/models/paperwork.rb +0 -4
- data/lib/billit_representers/models/paperwork_collection.rb +0 -4
- data/lib/billit_representers/models/priority.rb +0 -4
- data/lib/billit_representers/models/remark.rb +0 -4
- data/lib/billit_representers/models/report.rb +0 -4
- data/lib/billit_representers/models/revision.rb +0 -4
- data/lib/billit_representers/models/vote.rb +0 -4
- data/lib/billit_representers/models/vote_event.rb +0 -4
- data/lib/billit_representers/representers/bill_basic_representer.rb +0 -138
- data/lib/billit_representers/representers/bill_update_representer.rb +0 -145
- data/lib/billit_representers/representers/count_representer.rb +0 -28
- data/lib/billit_representers/representers/directive_representer.rb +0 -32
- data/lib/billit_representers/representers/document_representer.rb +0 -35
- data/lib/billit_representers/representers/motion_representer.rb +0 -44
- data/lib/billit_representers/representers/paperwork_collection_representer.rb +0 -29
- data/lib/billit_representers/representers/paperwork_representer.rb +0 -60
- data/lib/billit_representers/representers/priority_representer.rb +0 -35
- data/lib/billit_representers/representers/remark_representer.rb +0 -31
- data/lib/billit_representers/representers/report_representer.rb +0 -32
- data/lib/billit_representers/representers/revision_representer.rb +0 -29
- data/lib/billit_representers/representers/table_collection_page_representer.rb +0 -33
- data/lib/billit_representers/representers/table_collection_representer.rb +0 -30
- data/lib/billit_representers/representers/table_representer.rb +0 -35
- data/lib/billit_representers/representers/vote_event_representer.rb +0 -35
- data/lib/billit_representers/representers/vote_representer.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e7b2d3366a2fa0381d3603829f94a559ca8afcf
|
4
|
+
data.tar.gz: 3b550d6d14231deface3bb15ddba3ca63b5298ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c2d6222425e8eb8218a3fe43195024e9a5605a4647e3012f990988bda5cde4a96e4eff3227ab2e5c00799479d9de75745da75af29e1b9b135a56dae2c502711
|
7
|
+
data.tar.gz: ad82baa96f6cbd19340cb85822a7bb59b2fca1b53b7fe953937f3e143c8fe0d6c65bc185c3dd992b1bcf348941327e1cac7175d0906759f014a2e795f85bdeea
|
data/billit_representers.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'billit_representers'
|
3
|
-
gem.version = '0.
|
4
|
-
gem.date = '2014-
|
3
|
+
gem.version = '0.10.0'
|
4
|
+
gem.date = '2014-03-31'
|
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)."
|
7
7
|
gem.authors = ["Marcel Augsburger"]
|
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
13
13
|
|
14
|
+
# gem.add_runtime_dependency "roar", "0.12.2"
|
14
15
|
gem.add_runtime_dependency "roar", "0.11.19"
|
15
16
|
gem.add_runtime_dependency "roar-rails", "0.1.0"
|
16
17
|
gem.add_runtime_dependency "activemodel"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'billit_representers/representers/cl/bill_representer'
|
2
|
+
module Billit
|
3
|
+
module Cl
|
4
|
+
class Bill
|
5
|
+
include Billit::Cl::BillRepresenter
|
6
|
+
|
7
|
+
attr_reader :representable_attrs
|
8
|
+
|
9
|
+
def self_link
|
10
|
+
links[:self].href if links[:self]
|
11
|
+
end
|
12
|
+
|
13
|
+
def law_xml_link
|
14
|
+
links[:law_xml].href if links[:law_xml]
|
15
|
+
end
|
16
|
+
|
17
|
+
def law_web_link
|
18
|
+
links[:law_web].href if links[:law_web]
|
19
|
+
end
|
20
|
+
|
21
|
+
def bill_draft_link
|
22
|
+
links[:bill_draft].href if links[:bill_draft]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'billit_representers/representers/cl/bill_basic_representer'
|
2
|
+
module Billit
|
3
|
+
module Cl
|
4
|
+
class BillBasic
|
5
|
+
include Billit::Cl::BillBasicRepresenter
|
6
|
+
|
7
|
+
attr_reader :representable_attrs
|
8
|
+
|
9
|
+
def self_link
|
10
|
+
links[:self].href if links[:self]
|
11
|
+
end
|
12
|
+
|
13
|
+
def law_xml_link
|
14
|
+
links[:law_xml].href if links[:law_xml]
|
15
|
+
end
|
16
|
+
|
17
|
+
def law_web_link
|
18
|
+
links[:law_web].href if links[:law_web]
|
19
|
+
end
|
20
|
+
|
21
|
+
def bill_draft_link
|
22
|
+
links[:bill_draft].href if links[:bill_draft]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'billit_representers/representers/cl/bill_page_representer'
|
2
|
+
module Billit
|
3
|
+
module Cl
|
4
|
+
class BillPage
|
5
|
+
include Billit::Cl::BillPageRepresenter
|
6
|
+
|
7
|
+
def self
|
8
|
+
links[:self].href if links[:self]
|
9
|
+
end
|
10
|
+
|
11
|
+
def next
|
12
|
+
links[:next].href if links[:next]
|
13
|
+
end
|
14
|
+
|
15
|
+
def previous
|
16
|
+
links[:previous].href if links[:previous]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'roar/representer/json'
|
2
|
-
require 'billit_representers/models/
|
3
|
-
require 'billit_representers/representers/
|
2
|
+
require 'billit_representers/models/bill'
|
3
|
+
require 'billit_representers/representers/bill_representer'
|
4
4
|
|
5
5
|
module Billit
|
6
6
|
module BillPageRepresenter
|
@@ -21,7 +21,7 @@ module Billit
|
|
21
21
|
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
22
22
|
end
|
23
23
|
|
24
|
-
collection :bills, :extend => Billit::
|
24
|
+
collection :bills, :extend => Billit::BillRepresenter, :class => Billit::Bill
|
25
25
|
|
26
26
|
property :total_entries
|
27
27
|
property :current_page
|
@@ -5,22 +5,6 @@ require 'roar/representer/json'
|
|
5
5
|
require 'roar/representer/json/hal'
|
6
6
|
# require 'roar/rails/hal'
|
7
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/representers/motion_representer'
|
16
|
-
require 'billit_representers/models/paperwork'
|
17
|
-
require 'billit_representers/models/priority'
|
18
|
-
require 'billit_representers/models/report'
|
19
|
-
require 'billit_representers/models/document'
|
20
|
-
require 'billit_representers/models/directive'
|
21
|
-
require 'billit_representers/models/remark'
|
22
|
-
require 'billit_representers/models/revision'
|
23
|
-
require 'billit_representers/models/motion'
|
24
8
|
|
25
9
|
module Billit
|
26
10
|
module BillRepresenter
|
@@ -40,121 +24,24 @@ module Billit
|
|
40
24
|
klass.send :prepend, Initializer
|
41
25
|
klass.send :include, ActiveModel::Validations
|
42
26
|
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
43
|
-
klass.validates_presence_of :uid
|
44
|
-
klass.validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
|
45
|
-
klass.validates :stage, inclusion: { in: @@stage_valid_values }
|
46
|
-
klass.validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
|
47
|
-
klass.validates :current_priority, inclusion: { in: @@current_priority_valid_values }
|
48
27
|
end
|
49
28
|
|
50
29
|
property :uid
|
51
|
-
property :short_uid
|
52
30
|
property :title
|
53
|
-
property :
|
54
|
-
property :source
|
55
|
-
property :initial_chamber
|
56
|
-
property :current_priority
|
57
|
-
property :stage
|
58
|
-
property :sub_stage
|
31
|
+
property :abstract
|
59
32
|
property :status
|
60
|
-
property :resulting_document
|
61
|
-
property :law_id
|
62
|
-
property :bill_draft_link
|
63
|
-
property :merged_bills
|
64
|
-
property :subject_areas
|
65
33
|
property :authors
|
34
|
+
property :resulting_document
|
35
|
+
property :creation_date
|
66
36
|
property :publish_date
|
67
|
-
property :abstract
|
68
37
|
property :tags
|
69
38
|
|
70
|
-
collection :paperworks, extend: Billit::PaperworkRepresenter, class: lambda { |x, *| Object.const_defined?("Paperwork") ? Paperwork : BillitPaperwork }
|
71
|
-
collection :priorities, extend: Billit::PriorityRepresenter, class: lambda { |x, *| Object.const_defined?("Priority") ? Priority : BillitPriority }
|
72
|
-
collection :reports, extend: Billit::ReportRepresenter, class: lambda { |x, *| Object.const_defined?("Report") ? Report : BillitReport }
|
73
|
-
collection :documents, extend: Billit::DocumentRepresenter, class: lambda { |x, *| Object.const_defined?("Document") ? Document : BillitDocument }
|
74
|
-
collection :directives, extend: Billit::DirectiveRepresenter, class: lambda { |x, *| Object.const_defined?("Directive") ? Directive : BillitDirective }
|
75
|
-
collection :remarks, extend: Billit::RemarkRepresenter, class: lambda { |x, *| Object.const_defined?("Remark") ? Remark : BillitRemark }
|
76
|
-
collection :revisions, extend: Billit::RevisionRepresenter, class: lambda { |x, *| Object.const_defined?("Revision") ? Revision : BillitRevision }
|
77
|
-
collection :motions, extend: Billit::MotionRepresenter, class: lambda { |x, *| Object.const_defined?("Motion") ? Motion : BillitMotion }
|
78
|
-
|
79
39
|
link :self do
|
80
|
-
|
40
|
+
cl_bill_url(self.uid)
|
81
41
|
end
|
82
42
|
|
83
|
-
link :
|
84
|
-
self.
|
43
|
+
link :bill_draft do
|
44
|
+
self.bill_draft_link
|
85
45
|
end
|
86
|
-
|
87
|
-
link :law_web do
|
88
|
-
self.law_web_link
|
89
|
-
end
|
90
|
-
|
91
|
-
@@subject_areas_valid_values =
|
92
|
-
[
|
93
|
-
'Defensa',
|
94
|
-
'Impuestos',
|
95
|
-
'Economía',
|
96
|
-
'Empresas',
|
97
|
-
'Hacienda',
|
98
|
-
'Relaciones Exteriores',
|
99
|
-
'Administración',
|
100
|
-
'Asunto Indígena',
|
101
|
-
'Zona Extrema',
|
102
|
-
'Regionalización',
|
103
|
-
'Salud',
|
104
|
-
'Minería',
|
105
|
-
'Medio Ambiente',
|
106
|
-
'Derechos Animales',
|
107
|
-
'Vivienda',
|
108
|
-
'Obras Públicas',
|
109
|
-
'Transporte',
|
110
|
-
'Telecomunicaciones',
|
111
|
-
'Trabajo',
|
112
|
-
'Protección Social',
|
113
|
-
'Cultura',
|
114
|
-
'Educación',
|
115
|
-
'Deportes',
|
116
|
-
'Transparencia',
|
117
|
-
'Probidad',
|
118
|
-
'Elecciones',
|
119
|
-
'Participación',
|
120
|
-
'Familia',
|
121
|
-
'Seguridad',
|
122
|
-
'Derechos Fundamentales',
|
123
|
-
'Nacionalidad',
|
124
|
-
'Reconstrucción Terremoto'
|
125
|
-
]
|
126
|
-
|
127
|
-
@@stage_valid_values =
|
128
|
-
[
|
129
|
-
'Archivado',
|
130
|
-
'Comisión Mixta Ley de Presupuesto',
|
131
|
-
'Comisión Mixta por rechazo de idea de legislar',
|
132
|
-
'Comisión Mixta por rechazo de modificaciones',
|
133
|
-
'Disc. informe C.Mixta por rechazo de modific. en C...',
|
134
|
-
'Discusión veto en Cámara de Origen',
|
135
|
-
'Discusión veto en Cámara Revisora',
|
136
|
-
'Insistencia',
|
137
|
-
'Primer trámite constitucional',
|
138
|
-
'Retirado',
|
139
|
-
'Segundo trámite constitucional',
|
140
|
-
'Tercer trámite constitucional',
|
141
|
-
'Tramitación terminada',
|
142
|
-
'Trámite de aprobacion presidencial',
|
143
|
-
'Trámite finalización en Cámara de Origen'
|
144
|
-
]
|
145
|
-
|
146
|
-
@@initial_chamber_valid_values =
|
147
|
-
[
|
148
|
-
'C.Diputados',
|
149
|
-
'Senado'
|
150
|
-
]
|
151
|
-
|
152
|
-
@@current_priority_valid_values =
|
153
|
-
[
|
154
|
-
'Discusión inmediata',
|
155
|
-
'Simple',
|
156
|
-
'Sin urgencia',
|
157
|
-
'Suma'
|
158
|
-
]
|
159
46
|
end
|
160
47
|
end
|
@@ -0,0 +1,140 @@
|
|
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
|
+
|
9
|
+
module Billit
|
10
|
+
module Cl
|
11
|
+
module BillBasicRepresenter
|
12
|
+
include Roar::Representer::JSON::HAL
|
13
|
+
# include Roar::Rails::HAL
|
14
|
+
# include Roar::Representer::JSON
|
15
|
+
|
16
|
+
module Initializer
|
17
|
+
def initialize
|
18
|
+
extend Billit::Cl::BillBasicRepresenter
|
19
|
+
extend Roar::Representer::Feature::Client
|
20
|
+
super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.included(klass)
|
25
|
+
klass.send :prepend, Initializer
|
26
|
+
klass.send :include, ActiveModel::Validations
|
27
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
28
|
+
klass.validates_presence_of :uid
|
29
|
+
klass.validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
|
30
|
+
klass.validates :stage, inclusion: { in: @@stage_valid_values }
|
31
|
+
klass.validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
|
32
|
+
klass.validates :current_priority, inclusion: { in: @@current_priority_valid_values }
|
33
|
+
end
|
34
|
+
|
35
|
+
property :uid
|
36
|
+
property :short_uid, writeable: false
|
37
|
+
property :title
|
38
|
+
property :creation_date
|
39
|
+
property :source
|
40
|
+
property :initial_chamber
|
41
|
+
property :current_priority, writeable: false
|
42
|
+
property :stage
|
43
|
+
property :sub_stage
|
44
|
+
property :status
|
45
|
+
property :resulting_document
|
46
|
+
property :law_id, writeable: false
|
47
|
+
property :merged_bills
|
48
|
+
property :subject_areas
|
49
|
+
property :authors
|
50
|
+
property :publish_date
|
51
|
+
property :abstract
|
52
|
+
property :tags
|
53
|
+
|
54
|
+
link :self do
|
55
|
+
cl_bill_url(self.uid)
|
56
|
+
end
|
57
|
+
|
58
|
+
link :law_xml do
|
59
|
+
self.law_xml_link
|
60
|
+
end
|
61
|
+
|
62
|
+
link :law_web do
|
63
|
+
self.law_web_link
|
64
|
+
end
|
65
|
+
|
66
|
+
link :bill_draft do
|
67
|
+
self.bill_draft_link
|
68
|
+
end
|
69
|
+
|
70
|
+
@@subject_areas_valid_values =
|
71
|
+
[
|
72
|
+
'Defensa',
|
73
|
+
'Impuestos',
|
74
|
+
'Economía',
|
75
|
+
'Empresas',
|
76
|
+
'Hacienda',
|
77
|
+
'Relaciones Exteriores',
|
78
|
+
'Administración',
|
79
|
+
'Asunto Indígena',
|
80
|
+
'Zona Extrema',
|
81
|
+
'Regionalización',
|
82
|
+
'Salud',
|
83
|
+
'Minería',
|
84
|
+
'Medio Ambiente',
|
85
|
+
'Derechos Animales',
|
86
|
+
'Vivienda',
|
87
|
+
'Obras Públicas',
|
88
|
+
'Transporte',
|
89
|
+
'Telecomunicaciones',
|
90
|
+
'Trabajo',
|
91
|
+
'Protección Social',
|
92
|
+
'Cultura',
|
93
|
+
'Educación',
|
94
|
+
'Deportes',
|
95
|
+
'Transparencia',
|
96
|
+
'Probidad',
|
97
|
+
'Elecciones',
|
98
|
+
'Participación',
|
99
|
+
'Familia',
|
100
|
+
'Seguridad',
|
101
|
+
'Derechos Fundamentales',
|
102
|
+
'Nacionalidad',
|
103
|
+
'Reconstrucción Terremoto'
|
104
|
+
]
|
105
|
+
|
106
|
+
@@stage_valid_values =
|
107
|
+
[
|
108
|
+
'Archivado',
|
109
|
+
'Comisión Mixta Ley de Presupuesto',
|
110
|
+
'Comisión Mixta por rechazo de idea de legislar',
|
111
|
+
'Comisión Mixta por rechazo de modificaciones',
|
112
|
+
'Disc. informe C.Mixta por rechazo de modific. en C...',
|
113
|
+
'Discusión veto en Cámara de Origen',
|
114
|
+
'Discusión veto en Cámara Revisora',
|
115
|
+
'Insistencia',
|
116
|
+
'Primer trámite constitucional',
|
117
|
+
'Retirado',
|
118
|
+
'Segundo trámite constitucional',
|
119
|
+
'Tercer trámite constitucional',
|
120
|
+
'Tramitación terminada',
|
121
|
+
'Trámite de aprobacion presidencial',
|
122
|
+
'Trámite finalización en Cámara de Origen'
|
123
|
+
]
|
124
|
+
|
125
|
+
@@initial_chamber_valid_values =
|
126
|
+
[
|
127
|
+
'C.Diputados',
|
128
|
+
'Senado'
|
129
|
+
]
|
130
|
+
|
131
|
+
@@current_priority_valid_values =
|
132
|
+
[
|
133
|
+
'Discusión inmediata',
|
134
|
+
'Simple',
|
135
|
+
'Sin urgencia',
|
136
|
+
'Suma'
|
137
|
+
]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|