billit_representers 0.9.10 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/billit_representers.gemspec +3 -2
  3. data/lib/billit_representers/models/cl/bill.rb +26 -0
  4. data/lib/billit_representers/models/cl/bill_basic.rb +26 -0
  5. data/lib/billit_representers/models/cl/bill_page.rb +20 -0
  6. data/lib/billit_representers/models/cl/directive.rb +8 -0
  7. data/lib/billit_representers/models/cl/document.rb +8 -0
  8. data/lib/billit_representers/models/cl/paperwork.rb +8 -0
  9. data/lib/billit_representers/models/cl/paperwork_page.rb +8 -0
  10. data/lib/billit_representers/models/cl/priority.rb +8 -0
  11. data/lib/billit_representers/models/cl/remark.rb +8 -0
  12. data/lib/billit_representers/models/cl/report.rb +8 -0
  13. data/lib/billit_representers/models/cl/revision.rb +8 -0
  14. data/lib/billit_representers/representers/bill_page_representer.rb +3 -3
  15. data/lib/billit_representers/representers/bill_representer.rb +6 -119
  16. data/lib/billit_representers/representers/cl/bill_basic_representer.rb +140 -0
  17. data/lib/billit_representers/representers/cl/bill_page_representer.rb +50 -0
  18. data/lib/billit_representers/representers/cl/bill_representer.rb +162 -0
  19. data/lib/billit_representers/representers/cl/directive_representer.rb +34 -0
  20. data/lib/billit_representers/representers/cl/document_representer.rb +37 -0
  21. data/lib/billit_representers/representers/cl/paperwork_page_representer.rb +32 -0
  22. data/lib/billit_representers/representers/cl/paperwork_representer.rb +62 -0
  23. data/lib/billit_representers/representers/cl/priority_representer.rb +37 -0
  24. data/lib/billit_representers/representers/cl/remark_representer.rb +33 -0
  25. data/lib/billit_representers/representers/cl/report_representer.rb +34 -0
  26. data/lib/billit_representers/representers/cl/revision_representer.rb +31 -0
  27. data/lib/billit_representers/representers/cl/table_page_representer.rb +35 -0
  28. data/lib/billit_representers/representers/cl/table_representer.rb +37 -0
  29. metadata +27 -34
  30. data/lib/billit_representers/models/bill_basic.rb +0 -24
  31. data/lib/billit_representers/models/bill_update.rb +0 -6
  32. data/lib/billit_representers/models/count.rb +0 -4
  33. data/lib/billit_representers/models/directive.rb +0 -4
  34. data/lib/billit_representers/models/document.rb +0 -4
  35. data/lib/billit_representers/models/motion.rb +0 -8
  36. data/lib/billit_representers/models/paperwork.rb +0 -4
  37. data/lib/billit_representers/models/paperwork_collection.rb +0 -4
  38. data/lib/billit_representers/models/priority.rb +0 -4
  39. data/lib/billit_representers/models/remark.rb +0 -4
  40. data/lib/billit_representers/models/report.rb +0 -4
  41. data/lib/billit_representers/models/revision.rb +0 -4
  42. data/lib/billit_representers/models/vote.rb +0 -4
  43. data/lib/billit_representers/models/vote_event.rb +0 -4
  44. data/lib/billit_representers/representers/bill_basic_representer.rb +0 -138
  45. data/lib/billit_representers/representers/bill_update_representer.rb +0 -145
  46. data/lib/billit_representers/representers/count_representer.rb +0 -28
  47. data/lib/billit_representers/representers/directive_representer.rb +0 -32
  48. data/lib/billit_representers/representers/document_representer.rb +0 -35
  49. data/lib/billit_representers/representers/motion_representer.rb +0 -44
  50. data/lib/billit_representers/representers/paperwork_collection_representer.rb +0 -29
  51. data/lib/billit_representers/representers/paperwork_representer.rb +0 -60
  52. data/lib/billit_representers/representers/priority_representer.rb +0 -35
  53. data/lib/billit_representers/representers/remark_representer.rb +0 -31
  54. data/lib/billit_representers/representers/report_representer.rb +0 -32
  55. data/lib/billit_representers/representers/revision_representer.rb +0 -29
  56. data/lib/billit_representers/representers/table_collection_page_representer.rb +0 -33
  57. data/lib/billit_representers/representers/table_collection_representer.rb +0 -30
  58. data/lib/billit_representers/representers/table_representer.rb +0 -35
  59. data/lib/billit_representers/representers/vote_event_representer.rb +0 -35
  60. data/lib/billit_representers/representers/vote_representer.rb +0 -28
@@ -0,0 +1,50 @@
1
+ require 'roar/representer/json'
2
+ require 'billit_representers/models/cl/bill_basic'
3
+ require 'billit_representers/representers/cl/bill_basic_representer'
4
+
5
+ module Billit
6
+ module Cl
7
+ module BillPageRepresenter
8
+
9
+ include Roar::Representer::JSON
10
+ include Roar::Representer::Feature::Hypermedia
11
+
12
+ module Initializer
13
+ def initialize
14
+ extend Billit::Cl::BillPageRepresenter
15
+ extend Roar::Representer::Feature::Client
16
+ super
17
+ end
18
+ end
19
+
20
+ def self.included(klass)
21
+ klass.send :prepend, Initializer
22
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
23
+ end
24
+
25
+ collection :bills, :extend => Billit::Cl::BillBasicRepresenter, :class => Billit::Cl::BillBasic
26
+
27
+ property :total_entries
28
+ property :current_page
29
+ property :total_pages
30
+
31
+ link :self do |params|
32
+ url_for(params.merge(:page => current_page))
33
+ end
34
+
35
+ link :next do |params|
36
+ url_for(params.merge(:page => next_page)) \
37
+ if next_page
38
+ end
39
+
40
+ link :previous do |params|
41
+ url_for(params.merge(:page => previous_page)) \
42
+ if previous_page
43
+ end
44
+
45
+ def bills
46
+ self
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,162 @@
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/cl/paperwork_representer'
9
+ require 'billit_representers/representers/cl/priority_representer'
10
+ require 'billit_representers/representers/cl/report_representer'
11
+ require 'billit_representers/representers/cl/document_representer'
12
+ require 'billit_representers/representers/cl/directive_representer'
13
+ require 'billit_representers/representers/cl/remark_representer'
14
+ require 'billit_representers/representers/cl/revision_representer'
15
+ require 'billit_representers/models/cl/paperwork'
16
+ require 'billit_representers/models/cl/priority'
17
+ require 'billit_representers/models/cl/report'
18
+ require 'billit_representers/models/cl/document'
19
+ require 'billit_representers/models/cl/directive'
20
+ require 'billit_representers/models/cl/remark'
21
+ require 'billit_representers/models/cl/revision'
22
+
23
+ module Billit
24
+ module Cl
25
+ module BillRepresenter
26
+ include Roar::Representer::JSON::HAL
27
+ # include Roar::Rails::HAL
28
+ # include Roar::Representer::JSON
29
+
30
+ module Initializer
31
+ def initialize
32
+ extend Billit::Cl::BillRepresenter
33
+ extend Roar::Representer::Feature::Client
34
+ super
35
+ end
36
+ end
37
+
38
+ def self.included(klass)
39
+ klass.send :prepend, Initializer
40
+ klass.send :include, ActiveModel::Validations
41
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
42
+ klass.validates_presence_of :uid
43
+ klass.validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
44
+ klass.validates :stage, inclusion: { in: @@stage_valid_values }
45
+ klass.validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
46
+ klass.validates :current_priority, inclusion: { in: @@current_priority_valid_values }
47
+ end
48
+
49
+ property :uid
50
+ property :short_uid, writeable: false
51
+ property :title
52
+ property :creation_date
53
+ property :source
54
+ property :initial_chamber
55
+ property :current_priority, writeable: false
56
+ property :stage
57
+ property :sub_stage
58
+ property :status
59
+ property :resulting_document
60
+ property :law_id, writeable: false
61
+ property :merged_bills
62
+ property :subject_areas
63
+ property :authors
64
+ property :publish_date
65
+ property :abstract
66
+ property :tags
67
+
68
+ collection :paperworks, extend: Billit::Cl::PaperworkRepresenter, class: Billit::Cl::Paperwork, parse_strategy: :sync
69
+ collection :priorities, extend: Billit::Cl::PriorityRepresenter, class: Billit::Cl::Priority, parse_strategy: :sync
70
+ collection :reports, extend: Billit::Cl::ReportRepresenter, class: Billit::Cl::Report, parse_strategy: :sync
71
+ collection :documents, extend: Billit::Cl::DocumentRepresenter, class: Billit::Cl::Document, parse_strategy: :sync
72
+ collection :directives, extend: Billit::Cl::DirectiveRepresenter, class: Billit::Cl::Directive, parse_strategy: :sync
73
+ collection :remarks, extend: Billit::Cl::RemarkRepresenter, class: Billit::Cl::Remark, parse_strategy: :sync
74
+ collection :revisions, extend: Billit::Cl::RevisionRepresenter, class: Billit::Cl::Revision, parse_strategy: :sync
75
+
76
+ link :self do
77
+ cl_bill_url(self.uid)
78
+ end
79
+
80
+ link :law_xml do
81
+ self.law_xml_link
82
+ end
83
+
84
+ link :law_web do
85
+ self.law_web_link
86
+ end
87
+
88
+ link :bill_draft do
89
+ self.bill_draft_link
90
+ end
91
+
92
+ @@subject_areas_valid_values =
93
+ [
94
+ 'Defensa',
95
+ 'Impuestos',
96
+ 'Economía',
97
+ 'Empresas',
98
+ 'Hacienda',
99
+ 'Relaciones Exteriores',
100
+ 'Administración',
101
+ 'Asunto Indígena',
102
+ 'Zona Extrema',
103
+ 'Regionalización',
104
+ 'Salud',
105
+ 'Minería',
106
+ 'Medio Ambiente',
107
+ 'Derechos Animales',
108
+ 'Vivienda',
109
+ 'Obras Públicas',
110
+ 'Transporte',
111
+ 'Telecomunicaciones',
112
+ 'Trabajo',
113
+ 'Protección Social',
114
+ 'Cultura',
115
+ 'Educación',
116
+ 'Deportes',
117
+ 'Transparencia',
118
+ 'Probidad',
119
+ 'Elecciones',
120
+ 'Participación',
121
+ 'Familia',
122
+ 'Seguridad',
123
+ 'Derechos Fundamentales',
124
+ 'Nacionalidad',
125
+ 'Reconstrucción Terremoto'
126
+ ]
127
+
128
+ @@stage_valid_values =
129
+ [
130
+ 'Archivado',
131
+ 'Comisión Mixta Ley de Presupuesto',
132
+ 'Comisión Mixta por rechazo de idea de legislar',
133
+ 'Comisión Mixta por rechazo de modificaciones',
134
+ 'Disc. informe C.Mixta por rechazo de modific. en C...',
135
+ 'Discusión veto en Cámara de Origen',
136
+ 'Discusión veto en Cámara Revisora',
137
+ 'Insistencia',
138
+ 'Primer trámite constitucional',
139
+ 'Retirado',
140
+ 'Segundo trámite constitucional',
141
+ 'Tercer trámite constitucional',
142
+ 'Tramitación terminada',
143
+ 'Trámite de aprobacion presidencial',
144
+ 'Trámite finalización en Cámara de Origen'
145
+ ]
146
+
147
+ @@initial_chamber_valid_values =
148
+ [
149
+ 'C.Diputados',
150
+ 'Senado'
151
+ ]
152
+
153
+ @@current_priority_valid_values =
154
+ [
155
+ 'Discusión inmediata',
156
+ 'Simple',
157
+ 'Sin urgencia',
158
+ 'Suma'
159
+ ]
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,34 @@
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/rails/hal'
6
+ require 'roar/representer/json/hal'
7
+
8
+ module Billit
9
+ module Cl
10
+ module DirectiveRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Representer::JSON
13
+
14
+ module Initializer
15
+ def initialize
16
+ extend Billit::Cl::DirectiveRepresenter
17
+ extend Roar::Representer::Feature::Client
18
+ super
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.send :prepend, Initializer
24
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
25
+ end
26
+
27
+ property :date
28
+ property :step
29
+ property :stage
30
+ property :link
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,37 @@
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/rails/hal'
6
+ require 'roar/representer/json/hal'
7
+
8
+ module Billit
9
+ module Cl
10
+ module DocumentRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Representer::JSON
13
+
14
+ module Initializer
15
+ def initialize
16
+ extend Billit::Cl::DocumentRepresenter
17
+ extend Roar::Representer::Feature::Client
18
+ super
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.send :prepend, Initializer
24
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
25
+ end
26
+
27
+ property :number
28
+ property :date
29
+ property :step
30
+ property :stage
31
+ property :type
32
+ property :chamber
33
+ property :link
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ require 'roar/representer/json'
2
+ require 'billit_representers/representers/cl/paperwork_representer'
3
+ require 'billit_representers/models/cl/paperwork'
4
+
5
+ module Billit
6
+ module Cl
7
+ module PaperworkPageRepresenter
8
+ # include Roar::Representer
9
+ include Roar::Representer::JSON
10
+ include Roar::Representer::Feature::Hypermedia
11
+
12
+ module Initializer
13
+ def initialize
14
+ extend Billit::Cl::PaperworkPageRepresenter
15
+ extend Roar::Representer::Feature::Client
16
+ super
17
+ end
18
+ end
19
+
20
+ def self.included(klass)
21
+ klass.send :prepend, Initializer
22
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
23
+ end
24
+
25
+ collection :paperworks, :extend => Billit::Cl::PaperworkRepresenter, :class => Billit::Cl::Paperwork
26
+
27
+ def paperworks
28
+ collect
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,62 @@
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/rails/hal'
6
+ require 'roar/representer/json/hal'
7
+
8
+ module Billit
9
+ module Cl
10
+ module PaperworkRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Representer::JSON
13
+
14
+ module Initializer
15
+ def initialize
16
+ extend Billit::PaperworkRepresenter
17
+ extend Roar::Representer::Feature::Client
18
+ super
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.send :prepend, Initializer
24
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
25
+ end
26
+
27
+ property :chamber
28
+ property :created_at
29
+ property :date
30
+ property :description
31
+ property :session
32
+ property :stage
33
+ property :updated_at
34
+ property :bill_uid
35
+ property :timeline_status
36
+
37
+ link :self do
38
+ cl_paperwork_url(self.id)
39
+ end
40
+
41
+ link :bill do
42
+ bill_url(bill_uid)
43
+ end
44
+
45
+ @@timeline_status_valid_values =
46
+ [
47
+ 'Ingreso',
48
+ 'Avanza',
49
+ 'Indicaciones',
50
+ 'Votación',
51
+ 'Urgencia',
52
+ 'Rechazado',
53
+ 'Inasistencia',
54
+ 'Descartado',
55
+ 'Informe',
56
+ 'Retiro de Urgencia',
57
+ 'Estado por Defecto'
58
+ ]
59
+
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,37 @@
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/rails/hal'
6
+ require 'roar/representer/json/hal'
7
+
8
+ module Billit
9
+ module Cl
10
+ module PriorityRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Representer::JSON
13
+
14
+ module Initializer
15
+ def initialize
16
+ extend Billit::Cl::PriorityRepresenter
17
+ extend Roar::Representer::Feature::Client
18
+ super
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.send :prepend, Initializer
24
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
25
+ end
26
+
27
+ property :type
28
+ property :entry_date
29
+ property :entry_message
30
+ property :entry_chamber
31
+ property :withdrawal_date
32
+ property :withdrawal_message
33
+ property :withdrawal_chamber
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,33 @@
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/rails/hal'
6
+ require 'roar/representer/json/hal'
7
+
8
+ module Billit
9
+ module Cl
10
+ module RemarkRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Representer::JSON
13
+
14
+ module Initializer
15
+ def initialize
16
+ extend Billit::Cl::RemarkRepresenter
17
+ extend Roar::Representer::Feature::Client
18
+ super
19
+ end
20
+ end
21
+
22
+ def self.included(klass)
23
+ klass.send :prepend, Initializer
24
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
25
+ end
26
+
27
+ property :date
28
+ property :event
29
+ property :stage
30
+
31
+ end
32
+ end
33
+ end