suap_api 0.1.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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/suap_api.rb +9 -0
- data/lib/suap_api/base_url.rb +3 -0
- data/lib/suap_api/connect.rb +20 -0
- data/lib/suap_api/frequency_of_day.rb +7 -0
- data/lib/suap_api/version.rb +3 -0
- data/suap_api.gemspec +29 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36f97c315150662af2e7c079c61bb0d6fffd1e9f
|
4
|
+
data.tar.gz: cd22dbe6db5144d3e9a143fc0e283b9c48062451
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f28b206daad489c99ec8d029fe70d6ba5f92f2aa331b09fe6892dc4ca8b24767b9a17e9bc607e82ff8a1a6be55a43d40ca361d7357190180d160ac91245b5604
|
7
|
+
data.tar.gz: 52c809f21a1112d6e5b2a98d4565777e9c96148fe3833c834989fdf6c327298762af75bef9d57689ba90db331c1ead57ce136ba340068981fade42d22db8554d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Luiz Picolo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
# SUAP API RUBY
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
Um wrapper Ruby para acesso a [API](http://suap.ifms.edu.br/api/docs/) do [SUAP (Sistema Unificado de Administração Publica)](http://portal.ifrn.edu.br/tec-da-informacao/servicos-ti/menus/servicos/copy2_of_suap) do IFMS. Este pacote permite que você tenha acesso aos dados do SUAP na sua aplicação Ruby.
|
8
|
+
|
9
|
+
Atualmente fornece informações para:
|
10
|
+
|
11
|
+
- Frequências do dia
|
12
|
+
|
13
|
+
## Instalação
|
14
|
+
|
15
|
+
Adicione a linha abaixo em seu Gemfile e execute o bundle install:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'suap_api'
|
19
|
+
```
|
20
|
+
|
21
|
+
ou
|
22
|
+
|
23
|
+
gem install suap_api
|
24
|
+
|
25
|
+
## Como usar
|
26
|
+
|
27
|
+
### Frequências do dia
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# Return
|
31
|
+
# "{\"frequencias_hoje\":[{\"acao\":\"E\",\"horario\":\"2017-06-14T07:14:27\"},{\"acao\":\"S\",\"horario\":\"2017-06-14T11:31:33\"},{\"acao\":\"E\",\"horario\":\"2017-06-14T12:22:32\"}],\"total_tempo_semana\":\"15h 53min 34seg\",\"total_tempo_hoje\":\"07:01:49\"}"
|
32
|
+
#
|
33
|
+
connection = SuapApi::Connect.new('SUAPE_VALIDO', 'SENHA')
|
34
|
+
puts SuapApi::FrequencyOfDay.get(connection)
|
35
|
+
```
|
36
|
+
|
37
|
+
## Desenvolvimento (Como contribuir)
|
38
|
+
|
39
|
+
Para ajudar no Desenvolvimento, clone o repositório, instale as dependências e sempre rode os testes para garantir a consistência do sistema.
|
40
|
+
|
41
|
+
$ git clone git@github.com:ifms-na/suap_api.git
|
42
|
+
$ cd suap_api
|
43
|
+
$ bundle install
|
44
|
+
$ USERNAME="usuario_siape" PASSWORD="suasenha_siape" rspec
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
suap_api usa a Licença MIT. Para mais detalhes https://github.com/ifms-na/suap_api/blob/master/LICENSE.txt
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "suap_api"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/suap_api.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module SuapApi
|
2
|
+
class Connect
|
3
|
+
def initialize(username, password)
|
4
|
+
@username = username
|
5
|
+
@password = password
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_json_by_uri(uri)
|
9
|
+
mechanize = Mechanize.new
|
10
|
+
mechanize.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
11
|
+
page = mechanize.get(SuapApi::BASE_URL)
|
12
|
+
form = page.forms.first
|
13
|
+
form['username'] = @username
|
14
|
+
form['password'] = @password
|
15
|
+
page = form.submit
|
16
|
+
api = mechanize.get("#{BASE_URL}#{uri}")
|
17
|
+
api.body
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/suap_api.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "suap_api/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "suap_api"
|
8
|
+
spec.version = SuapApi::VERSION
|
9
|
+
spec.authors = ["Luiz Picolo"]
|
10
|
+
spec.email = ["luizpicolo@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Um wrapper Ruby para acesso a API do SUAP"
|
13
|
+
spec.description = "Um wrapper Ruby para acesso a API do SUAP (Sistema Unificado de Administração Publica) do IFMS"
|
14
|
+
spec.homepage = "https://github.com/ifms-na/suap_api"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_dependency 'json_spec', '~> 1.1', '>= 1.1.5'
|
28
|
+
spec.add_dependency 'mechanize', '~> 2.7', '>= 2.7.5'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: suap_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luiz Picolo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json_spec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.1.5
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.1'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.1.5
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: mechanize
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.7'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 2.7.5
|
85
|
+
type: :runtime
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '2.7'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.7.5
|
95
|
+
description: Um wrapper Ruby para acesso a API do SUAP (Sistema Unificado de Administração
|
96
|
+
Publica) do IFMS
|
97
|
+
email:
|
98
|
+
- luizpicolo@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ".gitignore"
|
104
|
+
- ".rspec"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/console
|
111
|
+
- bin/setup
|
112
|
+
- lib/suap_api.rb
|
113
|
+
- lib/suap_api/base_url.rb
|
114
|
+
- lib/suap_api/connect.rb
|
115
|
+
- lib/suap_api/frequency_of_day.rb
|
116
|
+
- lib/suap_api/version.rb
|
117
|
+
- suap_api.gemspec
|
118
|
+
homepage: https://github.com/ifms-na/suap_api
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.6.12
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: Um wrapper Ruby para acesso a API do SUAP
|
142
|
+
test_files: []
|