fedena_sdk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +134 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fedena_sdk.gemspec +29 -0
- data/lib/fedena_sdk.rb +36 -0
- data/lib/fedena_sdk/attendance.rb +58 -0
- data/lib/fedena_sdk/batch.rb +15 -0
- data/lib/fedena_sdk/client.rb +26 -0
- data/lib/fedena_sdk/course.rb +13 -0
- data/lib/fedena_sdk/employee_attendance.rb +43 -0
- data/lib/fedena_sdk/errors.rb +10 -0
- data/lib/fedena_sdk/model.rb +53 -0
- data/lib/fedena_sdk/news.rb +16 -0
- data/lib/fedena_sdk/school.rb +11 -0
- data/lib/fedena_sdk/user.rb +10 -0
- data/lib/fedena_sdk/version.rb +3 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 115c979648973760c2f3a3f6acea137101efecd2
|
4
|
+
data.tar.gz: 594569d491474ff420de3fa036c930823e5e0ff8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2befd32d8b42e688ca6dea148c3d5bb360e67329c3608a78f2bea71b2701a1c4f49adfda49d5ed27acd991a752825e2c3b73f581f99f67a1248c006961565e41
|
7
|
+
data.tar.gz: 587e3dae4748fd767391e1c4d77716046185ba72b08f754f69e1782b49675eddd4b1f6c9d67a2db2efd58d62f437f6857cbc3feb2ab57eb5e42b4385c5d84d9b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at aboobackervyd@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Aboobacker MK
|
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,134 @@
|
|
1
|
+
# FedenaSdk
|
2
|
+
|
3
|
+
Ruby wrapper for fedena api
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fedena_sdk'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fedena_sdk
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Initialize sdk
|
24
|
+
```ruby
|
25
|
+
client = FedenaSdk.authenticate(
|
26
|
+
client_id: "",
|
27
|
+
client_secret: "",
|
28
|
+
uri: '',
|
29
|
+
redirect_uri: "");
|
30
|
+
```
|
31
|
+
|
32
|
+
### Generate access token
|
33
|
+
#### Using username and password
|
34
|
+
```ruby
|
35
|
+
FedenaSdk.access_token_from_password('username','password','redirect_uri');
|
36
|
+
```
|
37
|
+
|
38
|
+
##### Using authcode
|
39
|
+
|
40
|
+
* Get authorise url
|
41
|
+
```ruby
|
42
|
+
client.auth_code.authorize_url(:redirect_uri => '')
|
43
|
+
```
|
44
|
+
* Get auth code from url
|
45
|
+
|
46
|
+
* Generate token
|
47
|
+
```ruby
|
48
|
+
token = client.auth_code.get_token(auth_code,{:redirect_uri => ''},:header_format=>"Token token=\"%s\"")
|
49
|
+
```
|
50
|
+
|
51
|
+
### News
|
52
|
+
|
53
|
+
* Get all News
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
FedenaSdk::News.all
|
57
|
+
```
|
58
|
+
|
59
|
+
### User
|
60
|
+
|
61
|
+
* Get user details
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
FedenaSdk::User.find('username')
|
65
|
+
```
|
66
|
+
|
67
|
+
### School
|
68
|
+
|
69
|
+
* Get current school details
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
FedenaSdk::School.current_school
|
73
|
+
```
|
74
|
+
|
75
|
+
### Attendance
|
76
|
+
* Get attendance status of a student
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
FedenaSdk::Attendance.show(admission_no,date=>'10-12-2014')
|
80
|
+
```
|
81
|
+
* Search in attendance entries
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
FedenaSdk::Attendance.search(query)
|
85
|
+
```
|
86
|
+
|
87
|
+
* Marking attendance
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
attendance = FedenaSdk::Attendance.new(student_admission_no: "", forenoon: "", afternoon: "", date: "", batch_name: "", reason: "")
|
91
|
+
attendance.save
|
92
|
+
```
|
93
|
+
|
94
|
+
* Deleting attendance object
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
attendance.destroy
|
98
|
+
```
|
99
|
+
|
100
|
+
* Deleting attendance entry by admission_no and date
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
FedenaSdk::Attendance.destroy(admission_no,date)
|
104
|
+
```
|
105
|
+
### Course
|
106
|
+
|
107
|
+
* Get all courses
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
FedenaSdk::Course.all
|
111
|
+
```
|
112
|
+
|
113
|
+
### Batch
|
114
|
+
|
115
|
+
* Search for batches
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
FedenaSdk::Batch.search(query)
|
119
|
+
```
|
120
|
+
|
121
|
+
## Development
|
122
|
+
|
123
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
124
|
+
|
125
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tachyons/fedena-sdk-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
130
|
+
|
131
|
+
|
132
|
+
## License
|
133
|
+
|
134
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'fedena_sdk'
|
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
|
data/bin/setup
ADDED
data/fedena_sdk.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 'fedena_sdk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'fedena_sdk'
|
8
|
+
spec.version = FedenaSdk::VERSION
|
9
|
+
spec.authors = ['Aboobacker MK']
|
10
|
+
spec.email = ['aboobackervyd@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Fedena Sdk'
|
13
|
+
spec.description = 'Fedena sdk'
|
14
|
+
spec.homepage = 'https://github.com/tachyons/fedena-sdk-ruby'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'oauth2'
|
23
|
+
spec.add_dependency 'activesupport'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'pry'
|
29
|
+
end
|
data/lib/fedena_sdk.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'fedena_sdk/version'
|
2
|
+
require 'fedena_sdk/errors'
|
3
|
+
require 'fedena_sdk/client'
|
4
|
+
require 'fedena_sdk/model'
|
5
|
+
require 'fedena_sdk/user'
|
6
|
+
require 'fedena_sdk/news'
|
7
|
+
require 'fedena_sdk/school'
|
8
|
+
require 'fedena_sdk/attendance'
|
9
|
+
require 'fedena_sdk/employee_attendance'
|
10
|
+
require 'fedena_sdk/course'
|
11
|
+
require 'fedena_sdk/batch'
|
12
|
+
require 'active_support/all'
|
13
|
+
|
14
|
+
module FedenaSdk
|
15
|
+
class << self
|
16
|
+
attr_accessor :client, :access_token
|
17
|
+
|
18
|
+
def authenticate(options = {})
|
19
|
+
@client = FedenaSdk::Client.new options
|
20
|
+
@oauth2_client = @client.oauth2_client
|
21
|
+
@client
|
22
|
+
end
|
23
|
+
|
24
|
+
def access_token_from_auth_code(auth_code, redirect_uri)
|
25
|
+
@access_token ||= @oauth2_client.auth_code.get_token(auth_code, { redirect_uri: redirect_uri }, header_format: 'Token token="%s"')
|
26
|
+
end
|
27
|
+
|
28
|
+
def access_token_from_password(username, password, redirect_uri)
|
29
|
+
@access_token ||= @oauth2_client.password.get_token(username, password, { redirect_uri: redirect_uri }, header_format: 'Token token="%s"')
|
30
|
+
end
|
31
|
+
|
32
|
+
def current_user
|
33
|
+
FedenaSdk::User.new(@access_token.params['user_info'])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class Attendance < Model
|
3
|
+
attr_accessor :student_admission_no, :forenoon, :afternoon, :date, :batch_name, :reason, :subject_code, :class_timing_name
|
4
|
+
|
5
|
+
def self.show(admission_no, options = {})
|
6
|
+
date = options[:date]
|
7
|
+
attendance_type = options[:attendance_type]
|
8
|
+
subject_code = options[:subject_code]
|
9
|
+
class_timing_name = options[:class_timing_name]
|
10
|
+
url = "/api/attendances/#{admission_no}"
|
11
|
+
options = { params: { attendance_type: attendance_type,
|
12
|
+
date: date,
|
13
|
+
subject_code: subject_code,
|
14
|
+
class_timing_name: class_timing_name } }
|
15
|
+
hash = get(url, options)
|
16
|
+
new hash['attendance_detail']['attendance']
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.search(query)
|
20
|
+
url = '/api/attendances'
|
21
|
+
params = { search: query }
|
22
|
+
options = { params: params }
|
23
|
+
hash = get(url, options)
|
24
|
+
hash['attendance_detail']['attendance'].map do |attendance_hash|
|
25
|
+
new attendance_hash
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def save
|
30
|
+
url = '/api/attendances'
|
31
|
+
params = attributes_hash
|
32
|
+
options = { params: params }
|
33
|
+
hash = post(url, options)
|
34
|
+
new hash['attendance_detail']['attendance']
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.create(*args)
|
38
|
+
attendance = Attendance.new *args
|
39
|
+
attendance.save
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.destroy(admission_no, date)
|
43
|
+
url = "/api/attendances/#{admission_no}"
|
44
|
+
params = { date: date }
|
45
|
+
options = { params: params }
|
46
|
+
request(:delete, url, options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy
|
50
|
+
self.class.destroy(student_admission_no, date)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Overrides
|
54
|
+
def attributes_hash
|
55
|
+
super.merge(admission_no: @student_admission_no)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class Batch < Model
|
3
|
+
attr_accessor :name, :course_code, :start_date, :end_date
|
4
|
+
|
5
|
+
def self.search(query)
|
6
|
+
url = '/api/batches'
|
7
|
+
params = { search: query }
|
8
|
+
options = { params: params }
|
9
|
+
hash = get(url, options)
|
10
|
+
hash['batch_detail']['batch'].map do |batch_hash|
|
11
|
+
new batch_hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'oauth2'
|
2
|
+
|
3
|
+
module FedenaSdk
|
4
|
+
class Client
|
5
|
+
attr_accessor :client_id, :access_token, :client_secret, :redirect_uri, :uri
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
options.each do |key, value|
|
9
|
+
instance_variable_set("@#{key}", value)
|
10
|
+
end
|
11
|
+
yield(self) if block_given?
|
12
|
+
end
|
13
|
+
|
14
|
+
def oauth2_client
|
15
|
+
@client ||= OAuth2::Client.new(@client_id, @client_secret, site: @uri)
|
16
|
+
end
|
17
|
+
|
18
|
+
def authorize_uri
|
19
|
+
oauth2_client.auth_code.authorize_url(redirect_uri: @redirect_uri)
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args)
|
23
|
+
oauth2_client.send(method, *args)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class Course < Model
|
3
|
+
attr_accessor :course_name, :course_code, :section_name, :grading_type
|
4
|
+
|
5
|
+
def self.all
|
6
|
+
url = '/api/courses'
|
7
|
+
hash = get(url)
|
8
|
+
hash['course_detail']['course'].map do |course_hash|
|
9
|
+
new course_hash
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class EmployeeAttendance
|
3
|
+
attr_accessor :attendance_date, :employee_number, :leave_type, :reason, :half_day
|
4
|
+
|
5
|
+
def search(_query)
|
6
|
+
url = '/api/employee_attendances'
|
7
|
+
hash = get(url)
|
8
|
+
hash['attendance_detail']['attendance'].map do |attendance_hash|
|
9
|
+
new attendance_hash
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def employee_leave_types(_query)
|
14
|
+
url = '/api/employee_leave_types'
|
15
|
+
get(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
def save
|
19
|
+
url = '/api/employee_attendances'
|
20
|
+
params = attributes_hash
|
21
|
+
options = { params: params }
|
22
|
+
hash = post(url, options)
|
23
|
+
new hash['attendance_detail']['attendance']
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.create(*args)
|
27
|
+
attendance = EmployeeAttendance.new *args
|
28
|
+
attendance.save
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.destroy(employee_number, date)
|
32
|
+
url = "/api/employee_attendances/#{employee_number}"
|
33
|
+
params = { date: date }
|
34
|
+
options = { params: params }
|
35
|
+
request(:delete, url, options)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Overrides
|
39
|
+
def attributes_hash
|
40
|
+
super.merge(leave_type_code: @leave_type)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class Model
|
3
|
+
def self.attr_accessor(*args)
|
4
|
+
@attributes ||= []
|
5
|
+
@attributes.concat args
|
6
|
+
super(*args)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_reader :attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
def attributes
|
14
|
+
self.class.attributes
|
15
|
+
end
|
16
|
+
|
17
|
+
def attributes_hash
|
18
|
+
attributes.map { |attribute| { attribute => send(attribute) } }.reduce({}, :merge)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(options = {})
|
22
|
+
options.each do |key, value|
|
23
|
+
instance_variable_set("@#{key}", value)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# FIXME: better name for this method
|
28
|
+
def self.get(url, options = {})
|
29
|
+
request(:get, url, options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.post(url, options = {})
|
33
|
+
request(:post, url, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.request(verb, url, options = {})
|
37
|
+
xml = FedenaSdk.access_token.request(verb, url, options).body
|
38
|
+
Hash.from_xml xml
|
39
|
+
end
|
40
|
+
|
41
|
+
def post(*args)
|
42
|
+
self.class.post *args
|
43
|
+
end
|
44
|
+
|
45
|
+
def get(*args)
|
46
|
+
self.class.get *args
|
47
|
+
end
|
48
|
+
|
49
|
+
def request
|
50
|
+
self.class.request *args
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class News < Model
|
3
|
+
attr_accessor :title, :content, :author
|
4
|
+
def self.all(_count = nil)
|
5
|
+
url = '/api/news'
|
6
|
+
hash = get(url)
|
7
|
+
hash['news_detail']['news'].map do |news_hash|
|
8
|
+
new news_hash
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def author_user
|
13
|
+
User.find(@author)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module FedenaSdk
|
2
|
+
class School < Model
|
3
|
+
attr_accessor :institute_name, :institute_address, :institute_phone, :institute_language, :institute_currency, :institute_time_zone, :image
|
4
|
+
|
5
|
+
def self.current_school
|
6
|
+
url = '/api/schools'
|
7
|
+
hash = get(url)
|
8
|
+
new hash['school_detail']['school']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fedena_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aboobacker MK
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Fedena sdk
|
98
|
+
email:
|
99
|
+
- aboobackervyd@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- fedena_sdk.gemspec
|
115
|
+
- lib/fedena_sdk.rb
|
116
|
+
- lib/fedena_sdk/attendance.rb
|
117
|
+
- lib/fedena_sdk/batch.rb
|
118
|
+
- lib/fedena_sdk/client.rb
|
119
|
+
- lib/fedena_sdk/course.rb
|
120
|
+
- lib/fedena_sdk/employee_attendance.rb
|
121
|
+
- lib/fedena_sdk/errors.rb
|
122
|
+
- lib/fedena_sdk/model.rb
|
123
|
+
- lib/fedena_sdk/news.rb
|
124
|
+
- lib/fedena_sdk/school.rb
|
125
|
+
- lib/fedena_sdk/user.rb
|
126
|
+
- lib/fedena_sdk/version.rb
|
127
|
+
homepage: https://github.com/tachyons/fedena-sdk-ruby
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.6.6
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Fedena Sdk
|
151
|
+
test_files: []
|