billit_representers 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/billit_representers.gemspec +3 -2
- data/lib/billit_representers/models/bill.rb +140 -0
- data/lib/billit_representers/models/directive.rb +6 -0
- data/lib/billit_representers/models/document.rb +6 -0
- data/lib/billit_representers/models/paperwork.rb +6 -0
- data/lib/billit_representers/models/priority.rb +6 -0
- data/lib/billit_representers/models/remark.rb +6 -0
- data/lib/billit_representers/models/report.rb +6 -0
- data/lib/billit_representers/representers/bill_representer.rb +16 -7
- data/lib/billit_representers/representers/directive_representer.rb +31 -0
- data/lib/billit_representers/representers/document_representer.rb +35 -0
- data/lib/billit_representers/representers/paperwork_collection_representer.rb +16 -0
- data/lib/billit_representers/representers/paperwork_representer.rb +3 -0
- data/lib/billit_representers/representers/priority_representer.rb +35 -0
- data/lib/billit_representers/representers/remark_representer.rb +31 -0
- data/lib/billit_representers/representers/report_representer.rb +32 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fc7d8f69f01b357685800b225478604c7945ae0
|
4
|
+
data.tar.gz: 8f53902c34deebeb0a3ec1aacc12443a29431371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23e962508bb51c8e0100116a4c6a678b7c34137fb718a09d447acbdd035bf73e9324b9e59821845000a3e1e9f308edb3c1039580074cde3c405a73a5efab548f
|
7
|
+
data.tar.gz: 4e3d270040e40417b74ac19fe35ab70d76ab6f29fe5e4d6764c6f6a8bce10b7cb6dd398198a81b4d5e5fc878369e7cbc0a4949e783a8d1c0451a842fedf7e464
|
data/README.md
CHANGED
@@ -25,6 +25,16 @@ class Bill
|
|
25
25
|
include Billit::BillRepresenter
|
26
26
|
end
|
27
27
|
```
|
28
|
+
Some bill attributes require their own models to be created. In this particular bill model these are:
|
29
|
+
- Directive
|
30
|
+
- Document
|
31
|
+
- Paperwork
|
32
|
+
- Priority
|
33
|
+
- Remark
|
34
|
+
- Report
|
35
|
+
##Using models included in the representer
|
36
|
+
This is the preferred option if bill information is fetched and no persistence is needed.
|
37
|
+
TO DO
|
28
38
|
##Validations
|
29
39
|
Bills require some attributes to exist or to have restricted values.
|
30
40
|
```
|
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 = '
|
3
|
+
gem.version = '0.8.0'
|
4
|
+
gem.date = '2014-01-14'
|
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,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
|
+
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/models/paperwork'
|
15
|
+
require 'billit_representers/models/priority'
|
16
|
+
require 'billit_representers/models/report'
|
17
|
+
require 'billit_representers/models/document'
|
18
|
+
require 'billit_representers/models/directive'
|
19
|
+
require 'billit_representers/models/remark'
|
20
|
+
|
21
|
+
module Billit
|
22
|
+
class Bill
|
23
|
+
include Roar::Representer::JSON::HAL
|
24
|
+
include Roar::Representer::Feature::HttpVerbs
|
25
|
+
include ActiveModel::Validations
|
26
|
+
# include Roar::Rails::HAL
|
27
|
+
# include Roar::Representer::JSON
|
28
|
+
|
29
|
+
# validates_presence_of :uid
|
30
|
+
# validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
|
31
|
+
# validates :stage, inclusion: { in: @@stage_valid_values }
|
32
|
+
# validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
|
33
|
+
# validates :current_priority, inclusion: { in: @@current_priority_valid_values }
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
# extend Billit::BillRepresenter
|
37
|
+
extend Roar::Representer::Feature::Client
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
property :uid
|
42
|
+
property :title
|
43
|
+
property :creation_date
|
44
|
+
property :source
|
45
|
+
property :initial_chamber
|
46
|
+
property :current_priority
|
47
|
+
property :stage
|
48
|
+
property :sub_stage
|
49
|
+
property :status
|
50
|
+
property :resulting_document
|
51
|
+
property :law_link
|
52
|
+
property :merged_bills
|
53
|
+
property :subject_areas
|
54
|
+
property :authors
|
55
|
+
property :publish_date
|
56
|
+
property :abstract
|
57
|
+
property :tags
|
58
|
+
property :revisions
|
59
|
+
|
60
|
+
collection :paperworks, extend: PaperworkRepresenter, class: Billit::Paperwork
|
61
|
+
collection :priorities, extend: PriorityRepresenter, class: Billit::Priority
|
62
|
+
collection :reports, extend: ReportRepresenter, class: Billit::Report
|
63
|
+
collection :documents, extend: DocumentRepresenter, class: Billit::Document
|
64
|
+
collection :directives, extend: DirectiveRepresenter, class: Billit::Directive
|
65
|
+
collection :remarks, extend: RemarkRepresenter, class: Billit::Remark
|
66
|
+
|
67
|
+
link :self do
|
68
|
+
bill_url(self.uid)
|
69
|
+
end
|
70
|
+
|
71
|
+
@@subject_areas_valid_values =
|
72
|
+
[
|
73
|
+
'Defensa',
|
74
|
+
'Impuestos',
|
75
|
+
'Economía',
|
76
|
+
'Empresas',
|
77
|
+
'Hacienda',
|
78
|
+
'Relaciones Exteriores',
|
79
|
+
'Administración',
|
80
|
+
'Asunto Indígena',
|
81
|
+
'Zona Extrema',
|
82
|
+
'Regionalización',
|
83
|
+
'Salud',
|
84
|
+
'Minería',
|
85
|
+
'Medio Ambiente',
|
86
|
+
'Derechos Animales',
|
87
|
+
'Vivienda',
|
88
|
+
'Obras Públicas',
|
89
|
+
'Transporte',
|
90
|
+
'Telecomunicaciones',
|
91
|
+
'Trabajo',
|
92
|
+
'Protección Social',
|
93
|
+
'Cultura',
|
94
|
+
'Educación',
|
95
|
+
'Deportes',
|
96
|
+
'Transparencia',
|
97
|
+
'Probidad',
|
98
|
+
'Elecciones',
|
99
|
+
'Participación',
|
100
|
+
'Familia',
|
101
|
+
'Seguridad',
|
102
|
+
'Derechos Fundamentales',
|
103
|
+
'Nacionalidad',
|
104
|
+
'Reconstrucción Terremoto'
|
105
|
+
]
|
106
|
+
|
107
|
+
@@stage_valid_values =
|
108
|
+
[
|
109
|
+
'Archivado',
|
110
|
+
'Comisión Mixta Ley de Presupuesto',
|
111
|
+
'Comisión Mixta por rechazo de idea de legislar',
|
112
|
+
'Comisión Mixta por rechazo de modificaciones',
|
113
|
+
'Disc. informe C.Mixta por rechazo de modific. en C...',
|
114
|
+
'Discusión veto en Cámara de Origen',
|
115
|
+
'Discusión veto en Cámara Revisora',
|
116
|
+
'Insistencia',
|
117
|
+
'Primer trámite constitucional',
|
118
|
+
'Retirado',
|
119
|
+
'Segundo trámite constitucional',
|
120
|
+
'Tercer trámite constitucional',
|
121
|
+
'Tramitación terminada',
|
122
|
+
'Trámite de aprobacion presidencial',
|
123
|
+
'Trámite finalización en Cámara de Origen'
|
124
|
+
]
|
125
|
+
|
126
|
+
@@initial_chamber_valid_values =
|
127
|
+
[
|
128
|
+
'C.Diputados',
|
129
|
+
'Senado'
|
130
|
+
]
|
131
|
+
|
132
|
+
@@current_priority_valid_values =
|
133
|
+
[
|
134
|
+
'Discusión inmediata',
|
135
|
+
'Simple',
|
136
|
+
'Sin urgencia',
|
137
|
+
'Suma'
|
138
|
+
]
|
139
|
+
end
|
140
|
+
end
|
@@ -1,13 +1,22 @@
|
|
1
1
|
require 'roar/representer'
|
2
2
|
require 'roar/representer/feature/http_verbs'
|
3
3
|
require 'roar/representer/feature/client'
|
4
|
+
# require 'roar/representer/json'
|
4
5
|
require 'roar/representer/json/hal'
|
6
|
+
# require 'roar/rails/hal'
|
5
7
|
require 'active_model'
|
6
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'
|
7
14
|
|
8
15
|
module Billit
|
9
16
|
module BillRepresenter
|
10
17
|
include Roar::Representer::JSON::HAL
|
18
|
+
# include Roar::Rails::HAL
|
19
|
+
# include Roar::Representer::JSON
|
11
20
|
|
12
21
|
module Initializer
|
13
22
|
def initialize
|
@@ -45,14 +54,14 @@ module Billit
|
|
45
54
|
property :publish_date
|
46
55
|
property :abstract
|
47
56
|
property :tags
|
48
|
-
|
49
|
-
collection :paperworks, :extend => PaperworkRepresenter, :class => Paperwork
|
50
|
-
property :priorities
|
51
|
-
property :reports
|
52
57
|
property :revisions
|
53
|
-
|
54
|
-
|
55
|
-
|
58
|
+
|
59
|
+
collection :paperworks, extend: PaperworkRepresenter, class: Paperwork
|
60
|
+
collection :priorities, extend: PriorityRepresenter, class: Priority
|
61
|
+
collection :reports, extend: ReportRepresenter, class: Report
|
62
|
+
collection :documents, extend: DocumentRepresenter, class: Document
|
63
|
+
collection :directives, extend: DirectiveRepresenter, class: Directive
|
64
|
+
collection :remarks, extend: RemarkRepresenter, class: Remark
|
56
65
|
|
57
66
|
link :self do
|
58
67
|
bill_url(self.uid)
|
@@ -0,0 +1,31 @@
|
|
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 DirectiveRepresenter
|
10
|
+
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
12
|
+
|
13
|
+
module Initializer
|
14
|
+
def initialize
|
15
|
+
extend Billit::DirectiveRepresenter
|
16
|
+
extend Roar::Representer::Feature::Client
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(klass)
|
22
|
+
klass.send :prepend, Initializer
|
23
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
24
|
+
end
|
25
|
+
|
26
|
+
property :date
|
27
|
+
property :step
|
28
|
+
property :stage
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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 DocumentRepresenter
|
10
|
+
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
12
|
+
|
13
|
+
module Initializer
|
14
|
+
def initialize
|
15
|
+
extend Billit::DocumentRepresenter
|
16
|
+
extend Roar::Representer::Feature::Client
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(klass)
|
22
|
+
klass.send :prepend, Initializer
|
23
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
24
|
+
end
|
25
|
+
|
26
|
+
property :number
|
27
|
+
property :date
|
28
|
+
property :step
|
29
|
+
property :stage
|
30
|
+
property :type
|
31
|
+
property :chamber
|
32
|
+
property :link
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'roar/representer/json'
|
2
|
+
require 'billit_representers/representers/paperwork_representer'
|
3
|
+
|
4
|
+
module Billit
|
5
|
+
module PaperworkCollectionRepresenter
|
6
|
+
# include Roar::Representer
|
7
|
+
include Roar::Representer::JSON
|
8
|
+
include Roar::Representer::Feature::Hypermedia
|
9
|
+
|
10
|
+
collection :paperworks, :extend => PaperworkRepresenter, :class => Paperwork
|
11
|
+
|
12
|
+
def paperworks
|
13
|
+
collect
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'roar/representer'
|
2
2
|
require 'roar/representer/feature/http_verbs'
|
3
3
|
require 'roar/representer/feature/client'
|
4
|
+
# require 'roar/representer/json'
|
5
|
+
# require 'roar/rails/hal'
|
4
6
|
require 'roar/representer/json/hal'
|
5
7
|
|
6
8
|
module Billit
|
7
9
|
module PaperworkRepresenter
|
8
10
|
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
9
12
|
|
10
13
|
module Initializer
|
11
14
|
def initialize
|
@@ -0,0 +1,35 @@
|
|
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 PriorityRepresenter
|
10
|
+
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
12
|
+
|
13
|
+
module Initializer
|
14
|
+
def initialize
|
15
|
+
extend Billit::PriorityRepresenter
|
16
|
+
extend Roar::Representer::Feature::Client
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(klass)
|
22
|
+
klass.send :prepend, Initializer
|
23
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
24
|
+
end
|
25
|
+
|
26
|
+
property :type
|
27
|
+
property :entry_date
|
28
|
+
property :entry_message
|
29
|
+
property :entry_chamber
|
30
|
+
property :withdrawal_date
|
31
|
+
property :withdrawal_message
|
32
|
+
property :withdrawal_chamber
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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 RemarkRepresenter
|
10
|
+
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
12
|
+
|
13
|
+
module Initializer
|
14
|
+
def initialize
|
15
|
+
extend Billit::RemarkRepresenter
|
16
|
+
extend Roar::Representer::Feature::Client
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(klass)
|
22
|
+
klass.send :prepend, Initializer
|
23
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
24
|
+
end
|
25
|
+
|
26
|
+
property :date
|
27
|
+
property :event
|
28
|
+
property :stage
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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 ReportRepresenter
|
10
|
+
include Roar::Representer::JSON::HAL
|
11
|
+
# include Roar::Representer::JSON
|
12
|
+
|
13
|
+
module Initializer
|
14
|
+
def initialize
|
15
|
+
extend Billit::ReportRepresenter
|
16
|
+
extend Roar::Representer::Feature::Client
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(klass)
|
22
|
+
klass.send :prepend, Initializer
|
23
|
+
klass.send :include, Roar::Representer::Feature::HttpVerbs
|
24
|
+
end
|
25
|
+
|
26
|
+
property :date
|
27
|
+
property :step
|
28
|
+
property :stage
|
29
|
+
property :link
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billit_representers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel Augsburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roar
|
@@ -65,10 +65,23 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- billit_representers.gemspec
|
67
67
|
- lib/billit_representers.rb
|
68
|
+
- lib/billit_representers/models/bill.rb
|
69
|
+
- lib/billit_representers/models/directive.rb
|
70
|
+
- lib/billit_representers/models/document.rb
|
71
|
+
- lib/billit_representers/models/paperwork.rb
|
72
|
+
- lib/billit_representers/models/priority.rb
|
73
|
+
- lib/billit_representers/models/remark.rb
|
74
|
+
- lib/billit_representers/models/report.rb
|
68
75
|
- lib/billit_representers/representers/bill_collection_page_representer.rb
|
69
76
|
- lib/billit_representers/representers/bill_collection_representer.rb
|
70
77
|
- lib/billit_representers/representers/bill_representer.rb
|
78
|
+
- lib/billit_representers/representers/directive_representer.rb
|
79
|
+
- lib/billit_representers/representers/document_representer.rb
|
80
|
+
- lib/billit_representers/representers/paperwork_collection_representer.rb
|
71
81
|
- lib/billit_representers/representers/paperwork_representer.rb
|
82
|
+
- lib/billit_representers/representers/priority_representer.rb
|
83
|
+
- lib/billit_representers/representers/remark_representer.rb
|
84
|
+
- lib/billit_representers/representers/report_representer.rb
|
72
85
|
- lib/billit_representers/representers/table_collection_page_representer.rb
|
73
86
|
- lib/billit_representers/representers/table_collection_representer.rb
|
74
87
|
- lib/billit_representers/representers/table_representer.rb
|