billit_representers 0.8.11 → 0.8.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fa168063192d657f1c4320652323fb1d23807db
4
- data.tar.gz: dcf1748a31de4e85a0d5c4a8ccad493ffc185b7b
3
+ metadata.gz: 9f555ee664313c79f311962dd8c8ad66ba6a8752
4
+ data.tar.gz: 0b374ddd9ee93d68d4c952cf1dc665994fea3ee7
5
5
  SHA512:
6
- metadata.gz: 4968a1d5dbf5cdc1c2ac60e5779df1c2fba1dcbedf6fb1629d84f4d8c976d1398a9500939180b9fd600991f117793d5b546a6c38a0f0c134f46f6d512164d774
7
- data.tar.gz: aae51533d70d6156abe2325e5faa5f395d3da0332119641e6502aaa0199e04f26c89d498f16b775fa8a4f63f1b2c397b26011126d59a50b94a39da59e8677c22
6
+ metadata.gz: 281ed2b881fc44cf1d416008d064d6f72de0f292f7bf1d65abe0fb1b2957647bcfbdcc6bcb04df6eef1e5259f72f48561038df8d93a669a637e716d04e679cf3
7
+ data.tar.gz: b2fde6dc4710b24101ad1f3eee667f3a463301546152406f70e454c3a80788107652d5d6abe24f52fa80513cc7685092988f6bca799525ae22e4d69f0de3fd1a
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'billit_representers'
3
- gem.version = '0.8.11'
3
+ gem.version = '0.8.12'
4
4
  gem.date = '2014-03-19'
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,24 @@
1
+ require 'billit_representers/representers/bill_model_representer'
2
+ module Billit
3
+ class BillBasic
4
+ include Billit::BillBasicModelRepresenter
5
+
6
+ attr_reader :representable_attrs
7
+
8
+ def self_link
9
+ links[:self].href if links[:self]
10
+ end
11
+
12
+ def law_xml_link
13
+ links[:law_xml].href if links[:law_xml]
14
+ end
15
+
16
+ def law_web_link
17
+ links[:law_web].href if links[:law_web]
18
+ end
19
+
20
+ def bill_draft_link
21
+ links[:bill_draft].href if links[:bill_draft]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,138 @@
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 BillBasicModelRepresenter
11
+ include Roar::Representer::JSON::HAL
12
+ # include Roar::Rails::HAL
13
+ # include Roar::Representer::JSON
14
+
15
+ module Initializer
16
+ def initialize
17
+ extend Billit::BillBasicModelRepresenter
18
+ extend Roar::Representer::Feature::Client
19
+ super
20
+ end
21
+ end
22
+
23
+ def self.included(klass)
24
+ klass.send :prepend, Initializer
25
+ klass.send :include, ActiveModel::Validations
26
+ klass.send :include, Roar::Representer::Feature::HttpVerbs
27
+ klass.validates_presence_of :uid
28
+ klass.validates :subject_areas, inclusion: { in: @@subject_areas_valid_values }
29
+ klass.validates :stage, inclusion: { in: @@stage_valid_values }
30
+ klass.validates :initial_chamber, inclusion: { in: @@initial_chamber_valid_values }
31
+ klass.validates :current_priority, inclusion: { in: @@current_priority_valid_values }
32
+ end
33
+
34
+ property :uid
35
+ property :short_uid, writeable: false
36
+ property :title
37
+ property :creation_date
38
+ property :source
39
+ property :initial_chamber
40
+ property :current_priority, writeable: false
41
+ property :stage
42
+ property :sub_stage
43
+ property :status
44
+ property :resulting_document
45
+ property :law_id, writeable: false
46
+ property :merged_bills
47
+ property :subject_areas
48
+ property :authors
49
+ property :publish_date
50
+ property :abstract
51
+ property :tags
52
+
53
+ link :self do
54
+ bill_url(self.uid)
55
+ end
56
+
57
+ link :law_xml do
58
+ self.law_xml_link
59
+ end
60
+
61
+ link :law_web do
62
+ self.law_web_link
63
+ end
64
+
65
+ link :bill_draft do
66
+ self.bill_draft_link
67
+ end
68
+
69
+ @@subject_areas_valid_values =
70
+ [
71
+ 'Defensa',
72
+ 'Impuestos',
73
+ 'Economía',
74
+ 'Empresas',
75
+ 'Hacienda',
76
+ 'Relaciones Exteriores',
77
+ 'Administración',
78
+ 'Asunto Indígena',
79
+ 'Zona Extrema',
80
+ 'Regionalización',
81
+ 'Salud',
82
+ 'Minería',
83
+ 'Medio Ambiente',
84
+ 'Derechos Animales',
85
+ 'Vivienda',
86
+ 'Obras Públicas',
87
+ 'Transporte',
88
+ 'Telecomunicaciones',
89
+ 'Trabajo',
90
+ 'Protección Social',
91
+ 'Cultura',
92
+ 'Educación',
93
+ 'Deportes',
94
+ 'Transparencia',
95
+ 'Probidad',
96
+ 'Elecciones',
97
+ 'Participación',
98
+ 'Familia',
99
+ 'Seguridad',
100
+ 'Derechos Fundamentales',
101
+ 'Nacionalidad',
102
+ 'Reconstrucción Terremoto'
103
+ ]
104
+
105
+ @@stage_valid_values =
106
+ [
107
+ 'Archivado',
108
+ 'Comisión Mixta Ley de Presupuesto',
109
+ 'Comisión Mixta por rechazo de idea de legislar',
110
+ 'Comisión Mixta por rechazo de modificaciones',
111
+ 'Disc. informe C.Mixta por rechazo de modific. en C...',
112
+ 'Discusión veto en Cámara de Origen',
113
+ 'Discusión veto en Cámara Revisora',
114
+ 'Insistencia',
115
+ 'Primer trámite constitucional',
116
+ 'Retirado',
117
+ 'Segundo trámite constitucional',
118
+ 'Tercer trámite constitucional',
119
+ 'Tramitación terminada',
120
+ 'Trámite de aprobacion presidencial',
121
+ 'Trámite finalización en Cámara de Origen'
122
+ ]
123
+
124
+ @@initial_chamber_valid_values =
125
+ [
126
+ 'C.Diputados',
127
+ 'Senado'
128
+ ]
129
+
130
+ @@current_priority_valid_values =
131
+ [
132
+ 'Discusión inmediata',
133
+ 'Simple',
134
+ 'Sin urgencia',
135
+ 'Suma'
136
+ ]
137
+ end
138
+ 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.11
4
+ version: 0.8.12
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_basic.rb
69
70
  - lib/billit_representers/models/bill_page.rb
70
71
  - lib/billit_representers/models/directive.rb
71
72
  - lib/billit_representers/models/document.rb
@@ -75,6 +76,7 @@ files:
75
76
  - lib/billit_representers/models/remark.rb
76
77
  - lib/billit_representers/models/report.rb
77
78
  - lib/billit_representers/models/revision.rb
79
+ - lib/billit_representers/representers/bill_basic_model_representer.rb
78
80
  - lib/billit_representers/representers/bill_collection_page_representer.rb
79
81
  - lib/billit_representers/representers/bill_collection_representer.rb
80
82
  - lib/billit_representers/representers/bill_model_collection_page_representer.rb