Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #888 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Mar 26, 2019
2 parents 9735958 + 7843257 commit dbb1361
Show file tree
Hide file tree
Showing 77 changed files with 1,208 additions and 913 deletions.
4 changes: 2 additions & 2 deletions .markdownlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"style": "sublist"
},
"MD013": {
"code_blocks": false,
"tables": false,
"line_length": 120,
"tables": false
},
"MD024": {
"allow_different_nesting": true
Expand Down
10 changes: 8 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ gem 'aws-sdk-s3', require: false
gem 'image_processing', '~> 1.2'

# authentication
gem 'authy'
gem 'devise'

# assets: core asset dependencies
Expand Down Expand Up @@ -58,10 +59,16 @@ gem 'telephone_number'

# error tracking
gem 'rollbar', github: 'rollbar/rollbar-gem'
gem 'slack-notifier'

# permalinks
gem 'friendly_id', '~> 5.2.0'

# sms
gem 'nexmo'
gem 'smstools'
gem 'twilio-ruby', '~> 5.21.2'

group :development, :test do
gem 'brakeman', require: false
gem 'bullet', github: 'flyerhzm/bullet'
Expand All @@ -76,9 +83,8 @@ end

group :test do
gem 'capybara', '>= 2.15'
gem 'chromedriver-helper'
gem 'codacy-coverage', require: false
gem 'selenium-webdriver'
gem 'webdrivers', '~> 3.0'
gem 'webmock'
end

Expand Down
45 changes: 32 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GIT

GIT
remote: https://github.com/rails/rails.git
revision: efb706daad0e2e1039c6abb4879c837ef8bf4d10
revision: 4ec486145290efb4059b64e84a2bfd9e157bf787
specs:
actioncable (6.0.0.beta3)
actionpack (= 6.0.0.beta3)
Expand Down Expand Up @@ -63,7 +63,7 @@ GIT
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 1.4)
zeitwerk (~> 1.4, >= 1.4.2)
rails (6.0.0.beta3)
actioncable (= 6.0.0.beta3)
actionmailbox (= 6.0.0.beta3)
Expand Down Expand Up @@ -129,11 +129,11 @@ GEM
public_suffix (>= 2.0.2, < 4.0)
ancestry (3.0.5)
activerecord (>= 3.2.0)
archive-zip (0.12.0)
io-like (~> 0.3.0)
ast (2.4.0)
authy (2.7.5)
httpclient (>= 2.5.3.3)
aws-eventstream (1.0.2)
aws-partitions (1.145.0)
aws-partitions (1.146.0)
aws-sdk-core (3.48.2)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
Expand All @@ -142,7 +142,7 @@ GEM
aws-sdk-kms (1.16.0)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.34.0)
aws-sdk-s3 (1.35.0)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
Expand Down Expand Up @@ -177,9 +177,6 @@ GEM
chartkick (3.0.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (2.1.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
cocoon (1.2.12)
codacy-coverage (2.1.0)
simplecov
Expand Down Expand Up @@ -219,6 +216,8 @@ GEM
smart_properties
erubi (1.8.0)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.10.0)
fit-commit (3.8.1)
swearjar (~> 1.3)
Expand All @@ -232,18 +231,19 @@ GEM
activesupport (>= 4.2)
hashdiff (0.3.8)
html_tokenizer (0.0.7)
httpclient (2.8.3)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
image_processing (1.8.0)
mini_magick (>= 4.9.3, < 5)
ruby-vips (>= 2.0.13, < 3)
io-like (0.3.0)
jaro_winkler (1.5.2)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jmespath (1.4.0)
json (2.2.0)
jwt (2.1.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.7.0)
Expand Down Expand Up @@ -271,7 +271,11 @@ GEM
minitest (5.11.3)
msgpack (1.2.9)
multi_json (1.13.1)
multipart-post (2.0.0)
net_http_ssl_fix (0.0.10)
netaddr (2.0.3)
nexmo (5.6.0)
jwt (~> 2)
nio4r (2.3.1)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
Expand Down Expand Up @@ -365,7 +369,9 @@ GEM
simplecov-html (0.10.2)
simpleidn (0.1.1)
unf (~> 0.1.4)
slack-notifier (2.3.2)
smart_properties (1.13.1)
smstools (0.2.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand All @@ -383,6 +389,10 @@ GEM
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
twilio-ruby (5.21.2)
faraday (~> 0.9)
jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
Expand All @@ -394,6 +404,11 @@ GEM
uniform_notifier (1.12.1)
warden (1.2.8)
rack (>= 2.0.6)
webdrivers (3.7.0)
net_http_ssl_fix
nokogiri (~> 1.6)
rubyzip (~> 1.0)
selenium-webdriver (~> 3.0)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand All @@ -409,13 +424,14 @@ GEM
activesupport
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (1.4.0)
zeitwerk (1.4.2)

PLATFORMS
ruby

DEPENDENCIES
ancestry
authy
aws-sdk-s3
bcrypt (~> 3.1.7)
bootsnap (>= 1.4.0)
Expand All @@ -425,7 +441,6 @@ DEPENDENCIES
byebug
capybara (>= 2.15)
chartkick
chromedriver-helper
cocoon
codacy-coverage
coffee-rails (~> 4.2)
Expand All @@ -442,6 +457,7 @@ DEPENDENCIES
letter_opener
listen (>= 3.0.5, < 3.2)
lol_dba
nexmo
nokul-support!
nokul-tenant!
nokul-tenant-omu!
Expand All @@ -461,15 +477,18 @@ DEPENDENCIES
rubocop
ruby-progressbar
sassc-rails
selenium-webdriver
sidekiq
simple_form
simplecov
slack-notifier
smstools
spring
spring-watcher-listen (~> 2.0.0)
telephone_number
twilio-ruby (~> 5.21.2)
uglifier (>= 1.3.0)
web-console!
webdrivers (~> 3.0)
webmock
webpacker
wicked_pdf
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[![Security](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/622121c74c17f4.svg?repo_token=xo-yGdqDKXvCf-jypXd-)](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/shield)
[![Known Vulnerabilities](https://snyk.io/test/github/omu/nokul/badge.svg)](https://snyk.io/test/github/omu/nokul)


[Nokul](https://github.com/omu/nokul) aims to become a complete solution for universities that face many challanges while trying to manage all the complex procedures of a university online.

Dealing with ill-structured processes of a university is hard, especially when they backed with complex legal procedures. Many universities facing similar issues when it comes to automating things, and moving face-to-face operations to online. Nokul aims to remediate these wounds by taking a Turkish university with more than 70 web services, 50K students and 4K employees as a case.
Expand Down
11 changes: 5 additions & 6 deletions app/controllers/calendar_management/calendars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ def destroy
end

def duplicate
@calendar = Calendar.find(params[:calendar_id])
@duplicate_record = DuplicateService.new(@calendar, 'name').duplicate

redirect_to(:calendars, alert: t('.warning')) && return unless @duplicate_record
calendar = Calendar.find(params[:calendar_id])

AcademicCalendars::DuplicateEventsService.new(@calendar, @duplicate_record)
duplicate_record = AcademicCalendars::DuplicateCalendarService.new(calendar, 'name').duplicate
redirect_to(:calendars, alert: t('.warning')) && return unless duplicate_record

redirect_to([:edit, @duplicate_record], notice: t('.success'))
AcademicCalendars::DuplicateEventsService.new(calendar, duplicate_record)
redirect_to([:edit, duplicate_record], notice: t('.success'))
end

def units
Expand Down
7 changes: 7 additions & 0 deletions app/errors/concatenation_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class ConcatenationError < StandardError
def message
I18n.t('errors.can_not_be_concatenated')
end
end
7 changes: 7 additions & 0 deletions app/errors/encoding_mismatch_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class EncodingMismatchError < StandardError
def message
I18n.t('errors.encoding_mismatch')
end
end
7 changes: 0 additions & 7 deletions app/errors/id_number_error.rb

This file was deleted.

7 changes: 7 additions & 0 deletions app/errors/invalid_phone_number_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class InvalidPhoneNumberError < StandardError
def message
I18n.t('errors.invalid_phone_number')
end
end
7 changes: 7 additions & 0 deletions app/errors/unicode_support_error.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class UnicodeSupportError < StandardError
def message
I18n.t('errors.unicode_not_supported')
end
end
20 changes: 20 additions & 0 deletions app/services/academic_calendars/duplicate_calendar_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

module AcademicCalendars
class DuplicateCalendarService
attr_reader :record, :prefixed_param

def initialize(record, prefixed_param)
@record = record
@prefixed_param = prefixed_param
end

def duplicate
clone_record = @record.dup
clone_record.send(@prefixed_param).prepend('[Kopyası] ')
clone_record.committee_decisions << @record.committee_decisions
clone_record.save
clone_record
end
end
end
17 changes: 0 additions & 17 deletions app/services/duplicate_service.rb

This file was deleted.

40 changes: 40 additions & 0 deletions app/services/nexmo/error_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# frozen_string_literal: true

module Nexmo
module ErrorHandler
SOFT_FAIL_CODES = {
'2' => 'Missing Parameters',
'3' => 'Invalid Parameters',
'6' => 'Invalid Message',
'12' => 'Message Too Long',
'22' => 'Invalid Network Code',
'33' => 'Number De-activated'
}.freeze

HARD_FAIL_CODES = {
'1' => 'Throttled',
'4' => 'Invalid Credentials',
'5' => 'Internal Error',
'7' => 'Number Barred',
'8' => 'Partner Account Barred',
'9' => 'Partner Quota Violation',
'10' => 'Too Many Existing Binds',
'11' => 'Account Not Enabled For HTTP',
'14' => 'Invalid Signature',
'15' => 'Invalid Sender Address',
'23' => 'Invalid Callback Url',
'32' => 'Signature And API Secret Disallowed'
}.freeze

def log_or_notify_admin(response)
status = response.status
notifier = Slack::Notifier.new Tenant.credentials.slack[:panik_hook]

if status == '0'
Rails.logger.info "Sent message id=#{response.message_id}"
elsif SOFT_FAIL_CODES.key?(status) || HARD_FAIL_CODES.key?(status)
notifier.ping "Nexmo SMS Error (code: #{status}, text: #{response.error_text})"
end
end
end
end
Loading

0 comments on commit dbb1361

Please sign in to comment.