nucleo_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ require 'nucleo_client/service_configuration'
2
+
3
+ module NucleoClient
4
+ class Federation < LogicalModel
5
+ include NucleoClient::ServiceConfiguration
6
+ set_resource_path '/federations'
7
+
8
+ attribute :id_federacao
9
+ attribute :fed_nome
10
+
11
+ alias_attribute :id, :id_federacao
12
+ alias_attribute :name, :fed_nome
13
+
14
+ def schools
15
+ School.paginate(federation_id: self.id)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require 'nucleo_client/service_configuration'
2
+
3
+ module NucleoClient
4
+ class School < LogicalModel
5
+ include NucleoClient::ServiceConfiguration
6
+ set_resource_path '/schools'
7
+
8
+ attribute :id_unidade
9
+ attribute :uni_federacao
10
+ attribute :uni_nome
11
+ attribute :uni_status
12
+
13
+ alias_attribute :id, :id_unidade
14
+ alias_attribute :name, :uni_nome
15
+ alias_attribute :federation_id, :uni_federacao
16
+ alias_attribute :status, :uni_status
17
+
18
+ def federation
19
+ Federation.find(federation_id)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ require 'logical_model'
2
+ if defined?(Rails)
3
+ require 'nucleo_client/railties'
4
+ end
@@ -0,0 +1,4 @@
1
+ module NucleoClient
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,20 @@
1
+ module NucleoClient
2
+ module ServiceConfiguration
3
+ def self.included(base)
4
+ base.send('use_hydra', NucleoClient::HYDRA)
5
+ #base.send('force_ssl')
6
+
7
+ host = case ENV['RACK_ENV']
8
+ when 'development'
9
+ 'nucleo_api'
10
+ when 'production'
11
+ 'metododerose.org/nucleo_api'
12
+ end
13
+
14
+ base.send('set_resource_host', host)
15
+ base.send('configure_index_response', {collection: 'collection', total: 'total'})
16
+
17
+ base.send('set_api_key','api_key',ENV['nucleo_api_key'])
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nucleo_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dwayne Macgowan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: logical_model
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.5.6
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.5.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: protected_attributes
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Cliente do nucleo
63
+ email:
64
+ - dwaynemac@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - app/models/nucleo_client/federation.rb
70
+ - app/models/nucleo_client/school.rb
71
+ - lib/nucleo_client/railties.rb
72
+ - lib/nucleo_client/service_configuration.rb
73
+ - lib/nucleo_client.rb
74
+ homepage: ''
75
+ licenses: []
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.25
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Client library Nucleo API
98
+ test_files: []
99
+ has_rdoc: