From 98888f6aea7e0d26c13f990a6fca24cbe1c9a408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 14:49:40 +0300 Subject: [PATCH 01/13] Remove temporary core_exts --- lib/support/support/core_ext/integer.rb | 5 ----- lib/support/support/core_ext/nil.rb | 15 --------------- 2 files changed, 20 deletions(-) delete mode 100644 lib/support/support/core_ext/integer.rb delete mode 100644 lib/support/support/core_ext/nil.rb diff --git a/lib/support/support/core_ext/integer.rb b/lib/support/support/core_ext/integer.rb deleted file mode 100644 index f3d7eadb..00000000 --- a/lib/support/support/core_ext/integer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class Integer - alias safe_to_i to_i -end diff --git a/lib/support/support/core_ext/nil.rb b/lib/support/support/core_ext/nil.rb deleted file mode 100644 index 7f386b34..00000000 --- a/lib/support/support/core_ext/nil.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -class NilClass - def nil_object - nil - end - - alias safe_to_i nil_object - alias safe_to_f nil_object - alias downcase_tr nil_object - alias capitalize_tr nil_object - alias titleize nil_object - alias titleize_tr nil_object - alias upcase_tr nil_object -end From e74ce8fa5e47621c6b7465673bd14da6375807d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 14:50:03 +0300 Subject: [PATCH 02/13] Refactor String class --- lib/support/support/core_ext/string.rb | 27 +++++++++----------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/lib/support/support/core_ext/string.rb b/lib/support/support/core_ext/string.rb index 4f07af2f..b5beeb56 100644 --- a/lib/support/support/core_ext/string.rb +++ b/lib/support/support/core_ext/string.rb @@ -1,25 +1,16 @@ # frozen_string_literal: true class String - def capitalize_tr - capitalize :turkic - end - - def titleize_tr - strip.downcase_tr.gsub(/\b(? Date: Fri, 28 Sep 2018 14:50:24 +0300 Subject: [PATCH 03/13] Improve serializer helpers --- app/serializers/serializer.rb | 76 ++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/app/serializers/serializer.rb b/app/serializers/serializer.rb index 60a51cb6..434e0922 100644 --- a/app/serializers/serializer.rb +++ b/app/serializers/serializer.rb @@ -1,13 +1,79 @@ # frozen_string_literal: true class Serializer < ActiveModel::Serializer + def array_from_string(string, delimiter: ',') + string.split(delimiter).map { |item| item.titleize } + end + def build_date(*args) - return if nil.in?(args) - Date.new(*args.collect(&:safe_to_i)) + args.map! do |arg| + case arg + when Nori::StringWithAttributes, String + arg.to_i + end + end + Date.new(*args) + rescue StandardError + nil + end + + def build_datetime(*args) + args.map! do |arg| + case arg + when Nori::StringWithAttributes, String + arg.to_i + end + end + DateTime.civil(*args) + rescue StandardError + nil + end + + def date(object) + Date.parse object + rescue StandardError + nil + end + + def datetime(object) + DateTime.parse object + rescue StandardError + nil + end + + def float(object) + case object + when Float + return object + when Integer + return object.to_f + when Nori::StringWithAttributes, String + return object.tr(',', '.').to_f + end end - def build_time(*args) - return if nil.in?(args) - Time.utc(*args.collect(&:safe_to_i)) + def integer(object) + case object + when Float, Nori::StringWithAttributes, String + return object.to_i + when Integer + return object + end + end + + SUPPORTED_STRING_METHODS = %i[ + downcase + titleize + upcase + capitalize + ] + private_constant :SUPPORTED_STRING_METHODS + + def string(object, method:) + return if object.is_a?(NilClass) + return object unless method.in?(SUPPORTED_STRING_METHODS) + return object.titleize_turkish if method == :titleize + + object.send(method, :turkic) end end From b431605d477d2915fba924bff74ba9f07bae201a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 14:50:41 +0300 Subject: [PATCH 04/13] Refactor some serializers in yoksis service --- .../graduates/informations_serializer.rb | 30 +++++++------- .../yoksis/meb/students_serializer.rb | 40 +++++++++---------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/app/serializers/yoksis/graduates/informations_serializer.rb b/app/serializers/yoksis/graduates/informations_serializer.rb index 77c8e3c0..e75bb843 100644 --- a/app/serializers/yoksis/graduates/informations_serializer.rb +++ b/app/serializers/yoksis/graduates/informations_serializer.rb @@ -1,29 +1,27 @@ -# frozen_string_literal: true +# frozen_string_literal: :titleize module Yoksis module Graduates class InformationsSerializer < Serializer - attribute(:id_number) { object[:tckno].safe_to_i } - attribute(:first_name) { object[:adi].titleize_tr } - attribute(:last_name) { object[:soyadi].titleize_tr } - attribute(:fathers_name) { object[:baba_adi].titleize_tr } - attribute(:mothers_name) { object[:anne_adi].titleize_tr } - attribute(:diploma_grade) { object[:diploma_notu].safe_to_f } - attribute(:diploma_grading_system) { object[:diploma_not_sistemi].safe_to_i } - attribute(:diploma_no) { object[:diploma_no] } - attribute(:university_id) { object[:univ_id].safe_to_i } - attribute(:university_name) { object[:universite_adi].titleize_tr } - attribute(:faculty) { object[:fak_myo_yo_ens].titleize_tr } - attribute(:program_name) { object[:program_adi].titleize_tr } - attribute(:unit_id) { object[:birim_id].safe_to_i } + attribute(:id_number) { integer object[:tckno] } + attribute(:first_name) { string object[:adi], method: :titleize } + attribute(:last_name) { string object[:soyadi], method: :titleize } + attribute(:fathers_name) { string object[:baba_adi], method: :titleize } + attribute(:mothers_name) { string object[:anne_adi], method: :titleize } + attribute(:diploma_grade) { float object[:diploma_notu] } + attribute(:diploma_grading_system) { integer object[:diploma_not_sistemi] } + attribute(:diploma_no) { string object[:diploma_no], method: :upcase } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite_adi], method: :titleize } + attribute(:faculty) { string object[:fak_myo_yo_ens], method: :titleize } + attribute(:program) { string object[:program_adi], method: :titleize } + attribute(:unit_id) { integer object[:birim_id] } attribute :date_of_birth do - next unless object[:dogum_tarihi] build_date(*object[:dogum_tarihi].values_at(:yil, :ay, :gun)) end attribute :date_of_graduation do - next unless object[:mezuniyet_tarihi] build_date(*object[:mezuniyet_tarihi].values_at(:yil, :ay, :gun)) end end diff --git a/app/serializers/yoksis/meb/students_serializer.rb b/app/serializers/yoksis/meb/students_serializer.rb index ba4ebd26..eba3f906 100644 --- a/app/serializers/yoksis/meb/students_serializer.rb +++ b/app/serializers/yoksis/meb/students_serializer.rb @@ -3,28 +3,28 @@ module Yoksis module Meb class StudentsSerializer < Serializer - attribute(:id_number) { object[:tckimlikno].safe_to_i } - attribute(:first_name) { object[:adi].titleize_tr } - attribute(:last_name) { object[:soyadi].titleize_tr } - attribute(:school_id) { object[:okulkodu].safe_to_i } - attribute(:school_name) { object[:okuladi].titleize_tr } - attribute(:school_field_code) { object[:okulalankodu].safe_to_i } - attribute(:school_field_name) { object[:okulalanadi].titleize_tr } - attribute(:school_branch_code) { object[:okuldalkodu].safe_to_i } - attribute(:school_branch_name) { object[:okuldaladi].titleize_tr } - attribute(:city_name) { object[:okuliladi].titleize_tr } - attribute(:city_code) { object[:okulilkodu].safe_to_i } - attribute(:district_name) { object[:okulilceadi].titleize_tr } - attribute(:district_code) { object[:okulilcekodu].safe_to_i } - attribute(:instruction_type) { object[:ogrenimturu].titleize_tr } - attribute(:grad_status_code) { object[:mezundurumukodu].safe_to_i } - attribute(:grad_status) { object[:mezundurumu].titleize_tr } - attribute(:graduation_date) { object[:mezuniyettarih] } - attribute(:grading_system) { object[:notsistemi].safe_to_i } - attribute(:diploma_grade) { object[:diplomanotupuani].safe_to_f } + attribute(:id_number) { integer object[:tckimlikno] } + attribute(:first_name) { string object[:adi], method: :titleize } + attribute(:last_name) { string object[:soyadi], method: :titleize } + attribute(:school_id) { integer object[:okulkodu] } + attribute(:school_name) { string object[:okuladi], method: :titleize } + attribute(:school_field_code) { integer object[:okulalankodu] } + attribute(:school_field_name) { string object[:okulalanadi], method: :titleize } + attribute(:school_branch_code) { integer object[:okuldalkodu] } + attribute(:school_branch_name) { string object[:okuldaladi], method: :titleize } + attribute(:city_name) { string object[:okuliladi], method: :titleize } + attribute(:city_code) { integer object[:okulilkodu] } + attribute(:district_name) { string object[:okulilceadi], method: :titleize } + attribute(:district_code) { integer object[:okulilcekodu] } + attribute(:instruction_type) { string object[:ogrenimturu], method: :titleize } + attribute(:grad_status_code) { integer object[:mezundurumukodu] } + attribute(:grad_status) { string object[:mezundurumu], method: :titleize } + attribute(:graduation_date) { date object[:mezuniyettarih] } + attribute(:grading_system) { integer object[:notsistemi] } + attribute(:diploma_grade) { float object[:diplomanotupuani] } attribute :top_scoring_student do - object[:okulbirincisi] && !object[:okulbirincisi].safe_to_i.zero? + object[:okulbirincisi] && !object[:okulbirincisi].to_i.zero? end end end From 1fa02b333ff320ba374fe94d8792b34037887e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 15:36:58 +0300 Subject: [PATCH 05/13] Add test for titleize_turkish --- test/core_ext/string_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/core_ext/string_test.rb diff --git a/test/core_ext/string_test.rb b/test/core_ext/string_test.rb new file mode 100644 index 00000000..44f34fae --- /dev/null +++ b/test/core_ext/string_test.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'test_helper' + +class StringTest < ActiveSupport::TestCase + test 'titleize_turkish can titleize a sentence in Turkish' do + cases = [ + ['istinye Çarşısı', 'İstinye Çarşısı'], + ['doğru ve yanlış', 'Doğru ve Yanlış'], + ['Şekerli çay', 'Şekerli Çay'], + ['üzümlü Kek', 'Üzümlü Kek'], + ['sıcak veya Ilık Süt', 'Sıcak veya Ilık Süt'] + ] + + cases.each { |c| assert_equal c.first.titleize_turkish, c.last } + end +end From 4dbccaa5e8fa1412831d7ccb194cdf756707fac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 17:57:01 +0300 Subject: [PATCH 06/13] Refactor some serializers in resumes --- .../military/informations_serializer.rb | 17 ++-- .../administrative_units_serializer.rb | 6 +- .../yoksis/references/base_serializer.rb | 4 +- .../resumes/academic_duties_serializer.rb | 48 ++++++------ .../resumes/academic_links_serializer.rb | 14 ++-- .../administrative_duties_serializer.rb | 34 ++++---- .../yoksis/resumes/articles_serializer.rb | 78 +++++++++---------- .../resumes/artistic_activities_serializer.rb | 56 ++++++------- .../yoksis/resumes/authors_serializer.rb | 30 +++---- .../yoksis/resumes/awards_serializer.rb | 40 +++++----- 10 files changed, 160 insertions(+), 167 deletions(-) diff --git a/app/serializers/yoksis/military/informations_serializer.rb b/app/serializers/yoksis/military/informations_serializer.rb index 5dd810df..d63d1610 100644 --- a/app/serializers/yoksis/military/informations_serializer.rb +++ b/app/serializers/yoksis/military/informations_serializer.rb @@ -3,21 +3,14 @@ module Yoksis module Military class InformationsSerializer < Serializer - attribute(:id_number) { object[:tcKimlikNo].safe_to_i } - attribute(:first_name) { object[:adi].titleize_tr } - attribute(:last_name) { object[:soyadi].titleize_tr } + attribute(:id_number) { integer object[:tcKimlikNo] } + attribute(:first_name) { string object[:adi], method: :titleize } + attribute(:last_name) { string object[:soyadi], method: :titleize } attribute :status do { - code: object[:askerlikDurumKod].safe_to_i, - description: object[:askerlikDurumAciklama].titleize_tr - } - end - - attribute :operation do - { - code: object[:islemKod], - description: object[:islemAciklama] + code: integer(object[:askerlikDurumKod]), + description: string(object[:askerlikDurumAciklama], method: :capitalize) } end end diff --git a/app/serializers/yoksis/references/administrative_units_serializer.rb b/app/serializers/yoksis/references/administrative_units_serializer.rb index 378103b5..f9dab2f6 100644 --- a/app/serializers/yoksis/references/administrative_units_serializer.rb +++ b/app/serializers/yoksis/references/administrative_units_serializer.rb @@ -3,9 +3,9 @@ module Yoksis module References class AdministrativeUnitsSerializer < Serializer - attribute(:id) { object[:birim_id].safe_to_i } - attribute(:name) { object[:birim_adi].titleize_tr } - attribute(:parent_unit_id) { object[:bagli_oldugu_birim_id].safe_to_i } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:unit_name) { string object[:birim_adi], method: :titleize } + attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } end end end diff --git a/app/serializers/yoksis/references/base_serializer.rb b/app/serializers/yoksis/references/base_serializer.rb index c2a8aec3..20d00c99 100644 --- a/app/serializers/yoksis/references/base_serializer.rb +++ b/app/serializers/yoksis/references/base_serializer.rb @@ -3,8 +3,8 @@ module Yoksis module References class BaseSerializer < Serializer - attribute(:code) { object[:kod].safe_to_i } - attribute(:name) { object[:ad].titleize_tr } + attribute(:code) { integer object[:kod] } + attribute(:name) { string object[:ad], method: :titleize } end end end diff --git a/app/serializers/yoksis/resumes/academic_duties_serializer.rb b/app/serializers/yoksis/resumes/academic_duties_serializer.rb index 3b35d7c1..a7b39218 100644 --- a/app/serializers/yoksis/resumes/academic_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_duties_serializer.rb @@ -3,30 +3,30 @@ module Yoksis module Resumes class AcademicDutiesSerializer < Serializer - attribute(:duty_id) { object[:gorev_id].safe_to_i } - attribute(:title_id) { object[:kadro_unvan_id].safe_to_i } - attribute(:title_name) { object[:kadro_unvan_adi].titleize_tr } - attribute(:place_id) { object[:yer_id].safe_to_i } - attribute(:place_name) { object[:yer_ad].titleize_tr } - attribute(:country_id) { object[:ulke_id].safe_to_i } - attribute(:country_name) { object[:ulke_ad].titleize_tr } - attribute(:year_of_start) { object[:bastar1].safe_to_i } - attribute(:year_of_end) { object[:bittar1].safe_to_i } - attribute(:scientific_field_name) { object[:bilimalan_adi].titleize_tr } - attribute(:university_id) { object[:univ_id].safe_to_i } - attribute(:university_name) { object[:univ_birim_adi].titleize_tr } - attribute(:faculty) { object[:fakultebilgisi].titleize_tr } - attribute(:department) { object[:bolumbilgisi].titleize_tr } - attribute(:field) { object[:alanbilgisi].titleize_tr } - attribute(:field_of_specialization_id) { object[:uzmanlik_alani].safe_to_i } - attribute(:field_of_specialization_name) { object[:uzmanlik_alani_ad].titleize_tr } - attribute(:unit_id) { object[:birim_id].safe_to_i } - attribute(:academic_status_id) { object[:akademik_durum].safe_to_i } - attribute(:academic_status_name) { object[:akademik_durum_adi].titleize_tr } - attribute(:academic_unit_name) { object[:akademik_birim_adi].titleize_tr } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:duty_id) { integer object[:gorev_id] } + attribute(:year_of_start) { integer object[:bastar1] } + attribute(:year_of_end) { integer object[:bittar1] } + attribute(:place_id) { integer object[:yer_id] } + attribute(:place_name) { string object[:yer_ad], method: :titleize } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad], method: :titleize } + attribute(:scientific_field_name) { string object[:bilimalan_adi], method: :titleize } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:univ_birim_adi], method: :titleize } + attribute(:faculty) { string object[:fakultebilgisi], method: :titleize } + attribute(:department) { string object[:bolumbilgisi], method: :titleize } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:field) { string object[:alanbilgisi], method: :titleize } + attribute(:field_of_specialization_id) { integer object[:uzmanlik_alani] } + attribute(:field_of_specialization_name) { string object[:uzmanlik_alani_ad], method: :titleize } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:title_name) { string object[:kadro_unvan_adi], method: :titleize } + attribute(:academic_status_id) { integer object[:akademik_durum] } + attribute(:academic_status_name) { string object[:akademik_durum_adi], method: :titleize } + attribute(:academic_unit_name) { string object[:akademik_birim_adi], method: :titleize } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/academic_links_serializer.rb b/app/serializers/yoksis/resumes/academic_links_serializer.rb index faca2095..dc287667 100644 --- a/app/serializers/yoksis/resumes/academic_links_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_links_serializer.rb @@ -3,13 +3,13 @@ module Yoksis module Resumes class AcademicLinksSerializer < Serializer - attribute(:researcher_id) { object[:arastirmaci_id].safe_to_i } - attribute(:staff_first_name) { object[:personel_adi].titleize_tr } - attribute(:staff_last_name) { object[:personel_soyadi].titleize_tr } - attribute(:staff_title) { object[:kadro_unvan_adi].titleize_tr } - attribute(:staff_workplace) { object[:kadro_yeri].titleize_tr } - attribute(:yok_link) { object[:yokakademik_link] } - attribute(:photograph_link) { object[:resim_link] } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:staff_first_name) { string object[:personel_adi], method: :titleize } + attribute(:staff_last_name) { string object[:personel_soyadi], method: :titleize } + attribute(:staff_title) { string object[:kadro_unvan_adi], method: :titleize } + attribute(:staff_workplace) { string object[:kadro_yeri], method: :titleize } + attribute(:yok_link) { string object[:yokakademik_link] } + attribute(:photograph_link) { string object[:resim_link] } end end end diff --git a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb index fdf95f75..fe3bc1f2 100644 --- a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb @@ -3,23 +3,23 @@ module Yoksis module Resumes class AdministrativeDutiesSerializer < Serializer - attribute(:registry_id) { object[:idgor_id].safe_to_i } - attribute(:duty_id) { object[:gorev_id].safe_to_i } - attribute(:name) { object[:gorev_adi].titleize_tr } - attribute(:place_id) { object[:yer_id].safe_to_i } - attribute(:place_name) { object[:yer_ad].titleize_tr } - attribute(:country_id) { object[:ulke_id].safe_to_i } - attribute(:country_name) { object[:ulke_ad].titleize_tr } - attribute(:year_of_start) { object[:bas_tar].safe_to_i } - attribute(:year_of_end) { object[:bit_tar].safe_to_i } - attribute(:university_id) { object[:unv_id].safe_to_i } - attribute(:university_name) { object[:unv_birim_adi].titleize_tr } - attribute(:major) { object[:abd].titleize_tr } - attribute(:faculty) { object[:fakultemyoenst].titleize_tr } - attribute(:department) { object[:bolumbilgisi].titleize_tr } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:idgor_id] } + attribute(:id) { integer object[:gorev_id] } + attribute(:name) { string object[:gorev_adi], method: :titleize } + attribute(:place_id) { integer object[:yer_id] } + attribute(:place_name) { string object[:yer_ad], method: :titleize } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_adi], method: :titleize } + attribute(:year_of_start) { integer object[:bas_tar] } + attribute(:year_of_end) { integer object[:bit_tar] } + attribute(:university_id) { integer object[:unv_id] } + attribute(:university_name) { string object[:unv_birim_adi], method: :titleize } + attribute(:major) { string object[:abd], method: :titleize } + attribute(:faculty) { string object[:fakultemyoenst], method: :titleize } + attribute(:department) { string object[:bolumbilgisi], method: :titleize } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/articles_serializer.rb b/app/serializers/yoksis/resumes/articles_serializer.rb index b188ea43..cca1ec19 100644 --- a/app/serializers/yoksis/resumes/articles_serializer.rb +++ b/app/serializers/yoksis/resumes/articles_serializer.rb @@ -3,45 +3,45 @@ module Yoksis module Resumes class ArticlesSerializer < Serializer - attribute(:publishing_id) { object[:yayin_id].safe_to_i } - attribute(:publishing_language_id) { object[:yayin_dili].safe_to_i } - attribute(:publishing_language_name) { object[:yayin_dili_adi].titleize_tr } - attribute(:name) { object[:makale_adi].titleize_tr } - attribute(:type_id) { object[:makale_turu_id].safe_to_i } - attribute(:type_name) { object[:makale_turu_ad].titleize_tr } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:referee_type_id) { object[:hakem_tur].safe_to_i } - attribute(:referee_type_name) { object[:hakem_tur_ad].titleize_tr } - attribute(:index_id) { object[:endeks_id].safe_to_i } - attribute(:index) { object[:endeks].titleize_tr } - attribute(:author_id) { object[:yazar_id].safe_to_i } - attribute(:authors) { object[:yazar_adi] && object[:yazar_adi].split(',').map(&:strip).map(&:titleize_tr) } - attribute(:number_of_author) { object[:yazar_sayisi].safe_to_i } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:journal_name) { object[:dergi_adi].titleize_tr } - attribute(:month) { object[:ay].safe_to_i } - attribute(:year) { object[:yil].safe_to_i } - attribute(:volume) { object[:cilt].safe_to_i } - attribute(:issue) { object[:sayi].safe_to_i } - attribute(:first_page) { object[:ilk_sayfa].safe_to_i } - attribute(:last_page) { object[:son_sayfa].safe_to_i } - attribute(:doi) { object[:doi].safe_to_i } - attribute(:issn) { object[:issn].safe_to_i } - attribute(:access_type_id) { object[:erisim_turu].safe_to_i } - attribute(:access_type_name) { object[:erisim_turu_ad] } - attribute(:access_link) { object[:erisim_linki] } - attribute(:number_of_citation) { object[:atif_sayisi].safe_to_i } - attribute(:field) { object[:alan_bilgisi].titleize_tr } - attribute(:keywords) { object[:anahtar_kelime].titleize_tr } - attribute(:special_edition_id) { object[:ozel_sayi].safe_to_i } - attribute(:special_edition_name) { object[:ozel_sayi_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:publishing_id) { integer object[:yayin_id] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi], method: :titleize } + attribute(:name) { string object[:makale_adi], method: :titleize } + attribute(:type_id) { integer object[:makale_turu_id] } + attribute(:type_name) { string object[:makale_turu_ad], method: :titleize } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad], method: :titleize } + attribute(:referee_type_id) { integer object[:hakem_tur] } + attribute(:referee_type_name) { string object[:hakem_tur_ad], method: :titleize } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:index) { string object[:endeks], method: :titleize } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split object[:yazar_adi], separator: ',' } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi], method: :titleize } + attribute(:city) { string object[:sehir], method: :titleize } + attribute(:journal_name) { string object[:dergi_adi], method: :titleize } + attribute(:month) { integer object[:ay] } + attribute(:year) { integer object[:yil] } + attribute(:volume) { integer object[:cilt] } + attribute(:issue) { integer object[:sayi] } + attribute(:first_page) { integer object[:ilk_sayfa] } + attribute(:last_page) { integer object[:son_sayfa] } + attribute(:doi) { integer object[:doi] } + attribute(:issn) { integer object[:issn] } + attribute(:access_type_id) { integer object[:erisim_turu] } + attribute(:access_type_name) { string object[:erisim_turu_ad], method: :titleize } + attribute(:access_link) { string object[:erisim_linki] } + attribute(:number_of_citation) { integer object[:atif_sayisi] } + attribute(:field) { string object[:alan_bilgisi], method: :titleize } + attribute(:keywords) { split object[:anahtar_kelime], separator: ',' } + attribute(:special_edition_id) { integer object[:ozel_sayi] } + attribute(:special_edition_name) { string object[:ozel_sayi_ad], method: :titleize } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb index d9852f12..6fda03a5 100644 --- a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb +++ b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb @@ -3,34 +3,34 @@ module Yoksis module Resumes class ArtisticActivitiesSerializer < Serializer - attribute(:registry_id) { object[:s_id].safe_to_i } - attribute(:name) { object[:etkinlik_adi].titleize_tr } - attribute(:place) { object[:etkinlik_yeri].titleize_tr } - attribute(:type_id) { object[:etkinlik_turu].safe_to_i } - attribute(:type_name) { object[:etkinlik_turu_ad].titleize_tr } - attribute(:duration) { object[:etkinlik_suresi].safe_to_i } - attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:language_id) { object[:etkinlik_dili].safe_to_i } - attribute(:language_name) { object[:dil_adi].titleize_tr } - attribute(:date_of_start) { object[:bas_tarih] && Date.parse(object[:bas_tarih]) } - attribute(:date_of_end) { object[:bit_tarih] && Date.parse(object[:bit_tarih]) } - attribute(:organizers) { object[:duzenleyenler].titleize_tr } - attribute(:number_of_person) { object[:kisi_sayisi].safe_to_i } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad].titleize_tr } - attribute(:institution_id) { object[:kurum_id].safe_to_i } - attribute(:institution_name) { object[:kurum_ad].titleize_tr } - attribute(:work_type_id) { object[:tip].safe_to_i } - attribute(:work_type_name) { object[:tip_adi].titleize_tr } - attribute(:main_type_id) { object[:ana_tur].safe_to_i } - attribute(:main_type_name) { object[:anatur_adi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:registry_id) { integer object[:s_id] } + attribute(:name) { string object[:etkinlik_adi], method: :titleize } + attribute(:place) { string object[:etkinlik_yeri], method: :titleize } + attribute(:type_id) { integer object[:etkinlik_turu] } + attribute(:type_name) { string object[:etkinlik_turu_ad], method: :titleize } + attribute(:duration) { integer object[:etkinlik_suresi] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad], method: :titleize } + attribute(:language_id) { integer object[:etkinlik_dili] } + attribute(:language_name) { string object[:dil_adi], method: :titleize } + attribute(:date_of_start) { date object[:bas_tarih] } + attribute(:date_of_end) { date object[:bit_tarih] } + attribute(:organizers) { split object[:duzenleyenler], separator: ',' } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi], method: :titleize } + attribute(:city) { string object[:sehir], method: :titleize } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad], method: :titleize } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad], method: :titleize } + attribute(:work_type_id) { integer object[:tip] } + attribute(:work_type_name) { string object[:tip_adi], method: :titleize } + attribute(:main_type_id) { integer object[:ana_tur] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/authors_serializer.rb b/app/serializers/yoksis/resumes/authors_serializer.rb index 6d6814df..5e0f3937 100644 --- a/app/serializers/yoksis/resumes/authors_serializer.rb +++ b/app/serializers/yoksis/resumes/authors_serializer.rb @@ -3,21 +3,21 @@ module Yoksis module Resumes class AuthorsSerializer < Serializer - attribute(:registry_id) { object[:y_id].safe_to_i } - attribute(:id_number) { object[:tc_kimlik_no].safe_to_i } - attribute(:first_name) { object[:yazarad].titleize_tr } - attribute(:last_name) { object[:yazarsoyad].titleize_tr } - attribute(:researcher_id) { object[:arastirmaci_id].safe_to_i } - attribute(:title_id) { object[:kadro_unvan_id].safe_to_i } - attribute(:title_name) { object[:kadro_unvan_adi].titleize_tr } - attribute(:type_id) { object[:yazar_tur].safe_to_i } - attribute(:type_name) { object[:yazar_tur_ad].titleize_tr } - attribute(:form_id) { object[:yazar_form_id].safe_to_i } - attribute(:university_id) { object[:univ_id].safe_to_i } - attribute(:university_name) { object[:universite].titleize_tr } - attribute(:users_ars_id) { object[:kullanicinin_ars_id].safe_to_i } - attribute(:orc_id) { object[:yazar_orcid].safe_to_i } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:y_id] } + attribute(:id_number) { integer object[:tc_kimlik_no] } + attribute(:first_name) { string object[:yazarad], method: :titleize } + attribute(:last_name) { string object[:yazarsoyad], method: :titleize } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:title_name) { string object[:kadro_unvan_adi], method: :titleize } + attribute(:type_id) { integer object[:yazar_tur] } + attribute(:type_name) { string object[:yazar_tur_ad], method: :titleize } + attribute(:form_id) { integer object[:yazar_form_id] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite], method: :titleize } + attribute(:users_ars_id) { integer object[:kullanicinin_ars_id] } + attribute(:orc_id) { integer object[:yazar_orcid] } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/awards_serializer.rb b/app/serializers/yoksis/resumes/awards_serializer.rb index 16eba4d9..5bebdeff 100644 --- a/app/serializers/yoksis/resumes/awards_serializer.rb +++ b/app/serializers/yoksis/resumes/awards_serializer.rb @@ -3,37 +3,37 @@ module Yoksis module Resumes class AwardsSerializer < Serializer - attribute(:id) { object[:odul_id].safe_to_i } - attribute(:name) { object[:odul_adi].titleize_tr } - attribute(:description) { object[:odul_aciklama].titleize_tr } - attribute(:year) { object[:odul_tarih].safe_to_i } - attribute(:activity_detail_id) { object[:faal_detay_id].safe_to_i } - attribute(:activity_detail_name) { object[:faal_detay_adi].titleize_tr } - attribute(:type_id) { object[:odul_tur_id].safe_to_i } - attribute(:type_name) { object[:odul_turu].titleize_tr } - attribute(:country_id) { object[:ulke_id].safe_to_i } - attribute(:country_name) { object[:ulke_ad].titleize_tr } - attribute(:number_of_person) { object[:kisi_sayisi].titleize_tr } + attribute(:id) { integer object[:odul_id] } + attribute(:name) { string object[:odul_adi], method: :titleize } + attribute(:description) { string object[:odul_aciklama], method: :titleize } + attribute(:year) { integer object[:odul_tarih] } + attribute(:activity_detail_id) { integer object[:faal_detay_id] } + attribute(:activity_detail_name) { string object[:faal_detay_adi], method: :titleize } + attribute(:type_id) { integer object[:odul_tur_id] } + attribute(:type_name) { string object[:odul_turu], method: :titleize } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad], method: :titleize } + attribute(:number_of_person) { integer object[:kisi_sayisi] } attribute :awarder do { - institution_name: object[:kurulus_adi].titleize_tr, - workplace_type_id: object[:isyeri_turu_id].safe_to_i, - workplace_type_name: object[:isyeri_turu_adi].titleize_tr + institution_name: string(object[:kurulus_adi], method: :titleize), + workplace_type_id: integer(object[:isyeri_turu_id]), + workplace_type_name: string(object[:isyeri_turu_adi], method: :titleize) } end attribute :conferee do { - title_id: object[:p_unvan_id].safe_to_i, - title_name: object[:p_unvan_ad].titleize_tr, - institution_id: object[:p_kurum_id].safe_to_i, - institution_name: object[:p_kurum_ad].titleize_tr + title_id: integer(object[:p_unvan_id]), + title_name: string(object[:p_unvan_ad], method: :titleize), + institution_id: integer(object[:p_kurum_id]), + institution_name: string(object[:p_kurum_ad], method: :titleize) } end - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } end end end From ff4876235fa5a4e1a35b4d2b3ace8c656f02588f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Fri, 28 Sep 2018 17:57:13 +0300 Subject: [PATCH 07/13] Minor improvement --- app/serializers/serializer.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/serializers/serializer.rb b/app/serializers/serializer.rb index 434e0922..cb5db193 100644 --- a/app/serializers/serializer.rb +++ b/app/serializers/serializer.rb @@ -1,10 +1,6 @@ # frozen_string_literal: true class Serializer < ActiveModel::Serializer - def array_from_string(string, delimiter: ',') - string.split(delimiter).map { |item| item.titleize } - end - def build_date(*args) args.map! do |arg| case arg @@ -61,6 +57,12 @@ def integer(object) end end + def split(string, separator:) + return unless string + + string.split(separator).map { |item| item.titleize } + end + SUPPORTED_STRING_METHODS = %i[ downcase titleize @@ -69,7 +71,7 @@ def integer(object) ] private_constant :SUPPORTED_STRING_METHODS - def string(object, method:) + def string(object, method: nil) return if object.is_a?(NilClass) return object unless method.in?(SUPPORTED_STRING_METHODS) return object.titleize_turkish if method == :titleize From 457665e17493820cbfa478770544b4a42d1025c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Tue, 16 Oct 2018 17:36:52 +0300 Subject: [PATCH 08/13] Refactor serializer helpers --- app/serializers/serializer.rb | 118 +++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 52 deletions(-) diff --git a/app/serializers/serializer.rb b/app/serializers/serializer.rb index cb5db193..f58f9040 100644 --- a/app/serializers/serializer.rb +++ b/app/serializers/serializer.rb @@ -1,81 +1,95 @@ # frozen_string_literal: true class Serializer < ActiveModel::Serializer + def float(object) + case object + when NilClass + return + when Float + object + when Nori::StringWithAttributes, String + object.tr(',', '.').to_f + when Integer + object.to_f + else + raise TypeError, "#{object} is not an Float or convertable type" + end + end + + def integer(object) + case object + when NilClass + return + when Integer + object + when Float, Nori::StringWithAttributes, String + object.to_i + else + raise TypeError, "#{object} is not an Integer or convertable type" + end + end + + def split_string(object, block = nil, separator: ',', titleize_turkish: true) + return unless object + raise TypeError, "#{object} is not a String" unless object.is_a?(String) + + split = object.split(separator) + + split.map!(&:titleize_turkish) if titleize_turkish + block ? split.try(&block) : split + end + + def string(object, block = nil, titleize_turkish: true) + str = case object + when NilClass + return + when String, Nori::StringWithAttributes + object + when Float, Integer + object.to_s + else + raise TypeError, "#{object} is not an String or convertable type" + end + + str = titleize_turkish ? str.titleize_turkish : str + block ? str.try(&block) : str + end + def build_date(*args) + return unless args.all? + args.map! do |arg| case arg when Nori::StringWithAttributes, String arg.to_i end end + Date.new(*args) - rescue StandardError - nil end def build_datetime(*args) + return unless args.all? + args.map! do |arg| case arg when Nori::StringWithAttributes, String arg.to_i end end - DateTime.civil(*args) - rescue StandardError - nil - end - - def date(object) - Date.parse object - rescue StandardError - nil - end - def datetime(object) - DateTime.parse object - rescue StandardError - nil - end - - def float(object) - case object - when Float - return object - when Integer - return object.to_f - when Nori::StringWithAttributes, String - return object.tr(',', '.').to_f - end - end - - def integer(object) - case object - when Float, Nori::StringWithAttributes, String - return object.to_i - when Integer - return object - end + DateTime.civil(*args) end - def split(string, separator:) - return unless string + def parse_date(object) + return unless object - string.split(separator).map { |item| item.titleize } + Date.parse object.to_s end - SUPPORTED_STRING_METHODS = %i[ - downcase - titleize - upcase - capitalize - ] - private_constant :SUPPORTED_STRING_METHODS - - def string(object, method: nil) - return if object.is_a?(NilClass) - return object unless method.in?(SUPPORTED_STRING_METHODS) - return object.titleize_turkish if method == :titleize + def parse_datetime(object) + return unless object - object.send(method, :turkic) + DateTime.parse object.to_s end end From fa826d58372262a2958ab9f2b30dab68bdd67c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Tue, 16 Oct 2018 17:37:24 +0300 Subject: [PATCH 09/13] Refactor all serializers --- .../kps/queries/addresses_serializer.rb | 110 +++---- .../kps/queries/identities_serializer.rb | 283 +++++++++--------- .../osym/examination/groups_serializer.rb | 4 +- .../result_informations_serializer.rb | 6 +- .../graduates/informations_serializer.rb | 40 +-- .../yoksis/meb/students_serializer.rb | 37 ++- .../military/informations_serializer.rb | 14 +- .../administrative_units_serializer.rb | 6 +- .../yoksis/references/base_serializer.rb | 4 +- .../resumes/academic_duties_serializer.rb | 48 +-- .../resumes/academic_links_serializer.rb | 14 +- .../administrative_duties_serializer.rb | 34 +-- .../yoksis/resumes/articles_serializer.rb | 78 ++--- .../resumes/artistic_activities_serializer.rb | 56 ++-- .../yoksis/resumes/authors_serializer.rb | 30 +- .../yoksis/resumes/awards_serializer.rb | 34 +-- .../yoksis/resumes/books_serializer.rb | 70 ++--- .../resumes/certifications_serializer.rb | 47 +-- .../yoksis/resumes/citations_serializer.rb | 30 +- .../yoksis/resumes/designs_serializer.rb | 42 +-- .../yoksis/resumes/editorships_serializer.rb | 68 ++--- .../education_informations_serializer.rb | 66 ++-- .../yoksis/resumes/fields_serializer.rb | 22 +- .../resumes/foreign_languages_serializer.rb | 26 +- ...entive_activity_declarations_serializer.rb | 14 +- .../incentive_applications_serializer.rb | 10 +- .../yoksis/resumes/lectures_serializer.rb | 26 +- .../yoksis/resumes/memberships_serializer.rb | 22 +- .../resumes/other_experiences_serializer.rb | 26 +- .../yoksis/resumes/papers_serializer.rb | 76 ++--- .../yoksis/resumes/patents_serializer.rb | 44 +-- .../yoksis/resumes/projects_serializer.rb | 52 ++-- .../yoksis/resumes/refereeing_serializer.rb | 42 +-- .../resumes/thesis_advisors_serializer.rb | 34 +-- .../yoksis/staff/academicians_serializer.rb | 10 +- .../yoksis/staff/nationalities_serializer.rb | 4 +- .../students/informations_serializer.rb | 176 +++++------ .../yoksis/units/changes_serializer.rb | 20 +- .../yoksis/units/units_serializer.rb | 50 ++-- .../yoksis/units/universities_serializer.rb | 40 +-- 40 files changed, 915 insertions(+), 900 deletions(-) diff --git a/app/serializers/kps/queries/addresses_serializer.rb b/app/serializers/kps/queries/addresses_serializer.rb index 45f58fec..7494694a 100644 --- a/app/serializers/kps/queries/addresses_serializer.rb +++ b/app/serializers/kps/queries/addresses_serializer.rb @@ -3,77 +3,77 @@ module Kps module Queries class AddressesSerializer < Serializer - attribute(:id_number) { object[:kimlik_no].safe_to_i } + attribute(:id_number) { integer object[:kimlik_no] } attribute :current_address do address = object[:yerlesim_yeri_adresi] { - full_address: address[:acik_adres].titleize_tr, - no: address[:adres_no].safe_to_i, + full_address: string(address[:acik_adres]), + no: integer(address[:adres_no]), type: { - code: address.dig(:adres_tip, :kod).safe_to_i, - description: address.dig(:adres_tip, :aciklama).titleize_tr + code: integer(address.dig(:adres_tip, :kod)), + description: string(address.dig(:adres_tip, :aciklama)) }, city_and_district_addresses: { independent_unit_status: { - code: address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :kod).safe_to_i, - description: address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :aciklama)) }, dependent_unit_type: { - code: address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :kod).safe_to_i, - description: address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :aciklama)) }, apartment: { - block: address.dig(:il_ilce_merkez_adresi, :bina_ada).titleize_tr, - pilot: address.dig(:il_ilce_merkez_adresi, :bina_parsel).titleize_tr, - layout: address.dig(:il_ilce_merkez_adresi, :bina_pafta).titleize_tr, - block_name: address.dig(:il_ilce_merkez_adresi, :bina_blok_adi).titleize_tr, - code: address.dig(:il_ilce_merkez_adresi, :bina_kodu).safe_to_i, - no: address.dig(:il_ilce_merkez_adresi, :bina_no).safe_to_i, - site_name: address.dig(:il_ilce_merkez_adresi, :bina_site_adi), + block: string(address.dig(:il_ilce_merkez_adresi, :bina_ada)), + pilot: string(address.dig(:il_ilce_merkez_adresi, :bina_parsel)), + layout: string(address.dig(:il_ilce_merkez_adresi, :bina_pafta)), + block_name: string(address.dig(:il_ilce_merkez_adresi, :bina_blok_adi)), + code: integer(address.dig(:il_ilce_merkez_adresi, :bina_kodu)), + no: integer(address.dig(:il_ilce_merkez_adresi, :bina_no)), + site_name: string(address.dig(:il_ilce_merkez_adresi, :bina_site_adi)), status: { - code: address.dig(:il_ilce_merkez_adresi, :bina_durum, :kod).safe_to_i, - description: address.dig(:il_ilce_merkez_adresi, :bina_durum, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :bina_durum, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bina_durum, :aciklama)) }, numbering_type: { - code: address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :kod).safe_to_i, - description: address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :aciklama)) }, structure_type: { - code: address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :kod).safe_to_i, - description: address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :aciklama)) } }, - csbm: address.dig(:il_ilce_merkez_adresi, :csbm).titleize_tr, - csbm_code: address.dig(:il_ilce_merkez_adresi, :csbm_kodu).safe_to_i, - exterior_door_no: address.dig(:il_ilce_merkez_adresi, :dis_kapi_no).safe_to_i, - interior_door_no: address.dig(:il_ilce_merkez_adresi, :ic_kapi_no).safe_to_i, + csbm: string(address.dig(:il_ilce_merkez_adresi, :csbm)), + csbm_code: integer(address.dig(:il_ilce_merkez_adresi, :csbm_kodu)), + exterior_door_no: integer(address.dig(:il_ilce_merkez_adresi, :dis_kapi_no)), + interior_door_no: integer(address.dig(:il_ilce_merkez_adresi, :ic_kapi_no)), city: { - code: address.dig(:il_ilce_merkez_adresi, :il_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :il).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :il_kodu)), + name: string(address.dig(:il_ilce_merkez_adresi, :il)) }, district: { - code: address.dig(:il_ilce_merkez_adresi, :ilce_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :ilce).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :ilce_kodu)), + name: string(address.dig(:il_ilce_merkez_adresi, :ilce)) }, neighborhood: { - code: address.dig(:il_ilce_merkez_adresi, :mahalle_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :mahalle).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :mahalle_kodu)), + name: string(address.dig(:il_ilce_merkez_adresi, :mahalle)) }, reason_of_stucture_use: { - code: address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :kod).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :aciklama).titleize_tr + code: integer(address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :kod)), + name: string(address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :aciklama)) }, }, - village_address: address[:koy_adresi].titleize_tr, - abroad_address: address[:yurt_disi_adresi].titleize_tr, - reason_of_relocation: address[:tasinma_neden].titleize_tr, - municipality_address: address[:belde_adresi].titleize_tr, - declarant_id_number: address[:beyanda_bulunan_kimlik_no].safe_to_i, - date_of_relocation: address[:tasinma_tarihi] && build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), - date_of_declaration: address[:beyan_tarihi] && build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), - date_of_registration: address[:tescil_tarihi] && build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + village_address: string(address[:koy_adresi]), + abroad_address: string(address[:yurt_disi_adresi]), + reason_of_relocation: string(address[:tasinma_neden]), + municipality_address: string(address[:belde_adresi]), + declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), + date_of_relocation: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), + date_of_declaration: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), + date_of_registration: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) } end @@ -84,21 +84,21 @@ class AddressesSerializer < Serializer next if address[:hata_bilgisi] object << { - declarant_id_number: address[:beyanda_bulunan_kimlik_no].safe_to_i, - full_address: address[:acik_adres].titleize_tr, - address_no: address[:adres_no].safe_to_i, + declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), + full_address: string(address[:acik_adres]), + address_no: integer(address[:adres_no]), address_type: { - code: address.dig(:adres_tip, :kod), - description: address.dig(:adres_tip, :aciklama).titleize_tr + code: integer(address.dig(:adres_tip, :kod)), + description: string(address.dig(:adres_tip, :aciklama)) }, - village_address: address[:koy_adresi].titleize_tr, - municipality_address: address[:belde_adresi].titleize_tr, - city_address: address[:il_ilce_merkez_adresi].titleize_tr, - abroad_address: address[:yurt_disi_adresi].titleize_tr, - reason_of_relocation: address[:tasinma_neden].titleize_tr, - date_of_relocation: address[:tasinma_tarihi] && build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), - date_of_declaration: address[:beyan_tarihi] && build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), - date_of_registration: address[:tescil_tarihi] && build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + village_address: string(address[:koy_adresi]), + municipality_address: string(address[:belde_adresi]), + city_address: string(address[:il_ilce_merkez_adresi]), + abroad_address: string(address[:yurt_disi_adresi]), + reason_of_relocation: string(address[:tasinma_neden]), + date_of_relocation: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), + date_of_declaration: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), + date_of_registration: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) } end diff --git a/app/serializers/kps/queries/identities_serializer.rb b/app/serializers/kps/queries/identities_serializer.rb index b1b61748..d27b96a7 100644 --- a/app/serializers/kps/queries/identities_serializer.rb +++ b/app/serializers/kps/queries/identities_serializer.rb @@ -3,7 +3,7 @@ module Kps module Queries class IdentitiesSerializer < Serializer - attribute(:id_number) { object[:kimlik_no].safe_to_i } + attribute(:id_number) { integer object[:kimlik_no] } attribute :blue_card_informations do informations = object.dig(:mavi_kartli_kisi_kutukleri) @@ -12,69 +12,78 @@ class IdentitiesSerializer < Serializer personal_informations = informations[:kisi_bilgisi] basic_informations = { - first_name: personal_informations.dig(:temel_bilgisi, :ad).titleize_tr, - last_name: personal_informations.dig(:temel_bilgisi, :soyad).titleize_tr, - fathers_name: personal_informations.dig(:temel_bilgisi, :baba_ad).titleize_tr, - mothers_name: personal_informations.dig(:temel_bilgisi, :anne_ad).titleize_tr, + first_name: string(personal_informations.dig(:temel_bilgisi, :ad)), + last_name: string(personal_informations.dig(:temel_bilgisi, :soyad)), + fathers_name: string(personal_informations.dig(:temel_bilgisi, :baba_ad)), + mothers_name: string(personal_informations.dig(:temel_bilgisi, :anne_ad)), gender: { - code: personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod).safe_to_i, - description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama).titleize_tr + code: integer(personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod)), + description: string(personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama)) }, - place_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_yer).titleize_tr, - date_of_birth: build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) + place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)), + date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) } status_informations = { status: { - code: personal_informations.dig(:durum_bilgisi, :durum, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama).titleize_tr + code: integer(personal_informations.dig(:durum_bilgisi, :durum, :kod)), + description: string(personal_informations.dig(:durum_bilgisi, :durum, :aciklama)) }, marital_status: { - code: personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama).titleize_tr + code: integer(personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod)), + description: string(personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama)) }, - date_of_death: build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) + date_of_death: personal_informations.dig(:durum_bilgisi, :olum_tarih) && build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) } personal_informations = personal_informations[:hata_bilgisi].present? ? nil : { - id_number: personal_informations[:kimlik_no].safe_to_i, - old_id_number: personal_informations[:es_tc_kimlik_no].safe_to_i, - new_id_number: personal_informations[:kazanilan_tc_kimlik_no].safe_to_i, - fathers_id_number: personal_informations[:baba_tc_kimlik_no].safe_to_i, - mothers_id_number: personal_informations[:anne_tc_kimlik_no].safe_to_i, - real_person_id_number: personal_informations[:gercek_kisi_kimlik_no].safe_to_i, - country: personal_informations[:ulke].titleize_tr, + id_number: integer(personal_informations[:kimlik_no]), + old_id_number: integer(personal_informations[:es_tc_kimlik_no]), + new_id_number: integer(personal_informations[:kazanilan_tc_kimlik_no]), + fathers_id_number: integer(personal_informations[:baba_tc_kimlik_no]), + mothers_id_number: integer(personal_informations[:anne_tc_kimlik_no]), + real_person_id_number: integer(personal_informations[:gercek_kisi_kimlik_no]), + country: personal_informations[:ulke] && { + code: integer(personal_informations.dig(:ulke, :kod)), + description: string(personal_informations.dig(:ulke, :aciklama)) + }, status_informations: status_informations, basic_informations: basic_informations } card_informations = informations[:mavi_kart_bilgisi] card_informations = card_informations[:hata_bilgisi].present? ? nil : { - id_number: card_informations[:kimlik_no].safe_to_i, - first_name: card_informations[:ad].titleize_tr, - last_name: card_informations[:soyad].titleize_tr, - fathers_name: card_informations[:baba_ad].titleize_tr, - mothers_name: card_informations[:anne_ad].titleize_tr, + id_number: integer(card_informations[:kimlik_no]), + first_name: string(card_informations[:ad]), + last_name: string(card_informations[:soyad]), + fathers_name: string(card_informations[:baba_ad]), + mothers_name: string(card_informations[:anne_ad]), gender: { - code: card_informations.dig(:cinsiyet, :kod).safe_to_i, - description: card_informations.dig(:cinsiyet, :aciklama).titleize_tr + code: integer(card_informations.dig(:cinsiyet, :kod)), + description: string(card_informations.dig(:cinsiyet, :aciklama)) + }, + nationality: card_informations[:uyruk] && { + code: integer(card_informations.dig(:uyruk, :kod)), + description: string(card_informations.dig(:uyruk, :aciklama)) }, - nationality: card_informations[:uyruk].titleize_tr, marital_status: { - code: card_informations.dig(:medeni_hal, :kod).safe_to_i, - description: card_informations.dig(:medeni_hal, :aciklama).titleize_tr + code: integer(card_informations.dig(:medeni_hal, :kod)), + description: string(card_informations.dig(:medeni_hal, :aciklama)) + }, + place_of_birth: string(card_informations[:dogum_yer]), + code_of_place_of_birth: integer(card_informations[:dogum_yer_kod]), + date_of_birth: card_informations[:dogum_tarih] && build_date(*card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + previous_last_name: string(card_informations[:onceki_soyad]), + unit: string(card_informations[:birim]), + number: integer(card_informations[:no]), + registration_number: integer(card_informations[:kayit_no]), + serial_number: string(card_informations[:seri], titleize_turkish: false), + issuing_reason: card_informations[:verilis_neden] && { + code: integer(card_informations.dig(:verilis_neden, :kod)), + description: string(card_informations.dig(:verilis_neden, :aciklama)) }, - place_of_birth: card_informations[:dogum_yer].titleize_tr, - code_of_place_of_birth: card_informations[:dogum_yer_kod].safe_to_i, - date_of_birth: build_date(*card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - previous_last_name: card_informations[:onceki_soyad].titleize_tr, - unit: card_informations[:birim].titleize_tr, - number: card_informations[:no].safe_to_i, - registration_number: card_informations[:kayit_no].safe_to_i, - serial_number: card_informations[:seri], - issuing_reason: card_informations[:verilis_neden].titleize_tr, - issuing_date: build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)) + issuing_date: card_informations[:verilme_tarih] && build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)) } next unless [personal_informations, card_informations].any? @@ -91,19 +100,19 @@ class IdentitiesSerializer < Serializer temporary_identity_informations = informations[:gecici_kimlik_bilgisi] temporary_identity_informations = temporary_identity_informations[:hata_bilgisi].present? ? nil : { - id_number: temporary_identity_informations[:tc_kimlik_no].safe_to_i, - first_name: temporary_identity_informations[:ad].titleize_tr, - last_name: temporary_identity_informations[:soyad].titleize_tr, - fathers_name: temporary_identity_informations[:baba_ad].titleize_tr, - mothers_name: temporary_identity_informations[:anne_ad].titleize_tr, + id_number: integer(temporary_identity_informations[:tc_kimlik_no]), + first_name: string(temporary_identity_informations[:ad]), + last_name: integer(temporary_identity_informations[:soyad]), + fathers_name: string(temporary_identity_informations[:baba_ad]), + mothers_name: string(temporary_identity_informations[:anne_ad]), gender: { - code: temporary_identity_informations.dig(:cinsiyet, :kod).safe_to_i, - description: temporary_identity_informations.dig(:cinsiyet, :aciklama).titleize_tr + code: integer(temporary_identity_informations.dig(:cinsiyet, :kod)), + description: string(temporary_identity_informations.dig(:cinsiyet, :aciklama)) }, date_of_birth: temporary_identity_informations[:dogum_tarih] && build_date(*temporary_identity_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - previous_last_name: temporary_identity_informations[:onceki_soyad].titleize_tr, - document_number: temporary_identity_informations[:belge_no].safe_to_i, - issuing_district: temporary_identity_informations[:duzenleyen_ilce].titleize_tr, + previous_last_name: string(temporary_identity_informations[:onceki_soyad]), + document_number: integer(temporary_identity_informations[:belge_no]), + issuing_district: string(temporary_identity_informations[:duzenleyen_ilce]), issuing_date: temporary_identity_informations[:duzenlenme_tarih] && build_date(*temporary_identity_informations[:duzenlenme_tarih].values_at(:yil, :ay, :gun)), date_of_expiration: temporary_identity_informations[:son_gecerlilik_tarih] && build_date(*temporary_identity_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)) } @@ -111,54 +120,54 @@ class IdentitiesSerializer < Serializer personal_informations = informations[:kisi_bilgisi] status_informations = { - religion: personal_informations.dig(:durum_bilgisi, :din).titleize_tr, + religion: string(personal_informations.dig(:durum_bilgisi, :din)), status: { - code: personal_informations.dig(:durum_bilgisi, :durum, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama).titleize_tr + code: integer(personal_informations.dig(:durum_bilgisi, :durum, :kod)), + description: string(personal_informations.dig(:durum_bilgisi, :durum, :aciklama)) }, marital_status: { - code: personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama).titleize_tr + code: integer(personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod)), + description: string(personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama)) }, - date_of_death: build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) + date_of_death: personal_informations.dig(:durum_bilgisi, :olum_tarih) && build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) } place_of_registry_informations = { - family_serial_number: personal_informations.dig(:kayit_yeri_bilgisi, :aile_sira_no).safe_to_i, - individual_serial_number: personal_informations.dig(:kayit_yeri_bilgisi, :birey_sira_no).safe_to_i, + family_serial_number: integer(personal_informations.dig(:kayit_yeri_bilgisi, :aile_sira_no)), + individual_serial_number: integer(personal_informations.dig(:kayit_yeri_bilgisi, :birey_sira_no)), volume: { - code: personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :aciklama).titleize_tr + code: integer(personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :kod)), + description: string(personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :aciklama)) }, city: { - code: personal_informations.dig(:kayit_yeri_bilgisi, :il, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :il, :aciklama).titleize_tr + code: integer(personal_informations.dig(:kayit_yeri_bilgisi, :il, :kod)), + description: string(personal_informations.dig(:kayit_yeri_bilgisi, :il, :aciklama)) }, district: { - code: personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :aciklama).titleize_tr + code: integer(personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :kod)), + description: string(personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :aciklama)) } } basic_informations = { - first_name: personal_informations.dig(:temel_bilgisi, :ad).titleize_tr, - last_name: personal_informations.dig(:temel_bilgisi, :soyad).titleize_tr, - fathers_name: personal_informations.dig(:temel_bilgisi, :baba_ad).titleize_tr, - mothers_name: personal_informations.dig(:temel_bilgisi, :anne_ad).titleize_tr, + first_name: string(personal_informations.dig(:temel_bilgisi, :ad)), + last_name: string(personal_informations.dig(:temel_bilgisi, :soyad)), + fathers_name: string(personal_informations.dig(:temel_bilgisi, :baba_ad)), + mothers_name: string(personal_informations.dig(:temel_bilgisi, :anne_ad)), gender: { - code: personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod).safe_to_i, - description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama).titleize_tr + code: integer(personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod)), + description: string(personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama)) }, - place_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_yer).titleize_tr, - date_of_birth: build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) + place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)), + date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) } personal_informations = personal_informations[:hata_bilgisi].present? ? nil : { - id_number: personal_informations[:tc_kimlik_no].safe_to_i, - old_id_number: personal_informations[:es_tc_kimlik_no].safe_to_i, - fathers_id_number: personal_informations[:baba_tc_kimlik_no].safe_to_i, - mothers_id_number: personal_informations[:anne_tc_kimlik_no].safe_to_i, - code_of_place_of_birth: personal_informations[:dogum_yer_kod].safe_to_i, + id_number: integer(personal_informations[:tc_kimlik_no]), + old_id_number: integer(personal_informations[:es_tc_kimlik_no]), + fathers_id_number: integer(personal_informations[:baba_tc_kimlik_no]), + mothers_id_number: integer(personal_informations[:anne_tc_kimlik_no]), + code_of_place_of_birth: integer(personal_informations[:dogum_yer_kod]), basic_informations: basic_informations, status_informations: status_informations, place_of_registry: place_of_registry_informations @@ -166,56 +175,56 @@ class IdentitiesSerializer < Serializer old_identity_card_informations = informations[:nufus_cuzdani_bilgisi] old_identity_card_informations = old_identity_card_informations[:hata_bilgisi].present? ? nil : { - id_number: old_identity_card_informations[:tc_kimlik_no].safe_to_i, - first_name: old_identity_card_informations[:ad].titleize_tr, - last_name: old_identity_card_informations[:soyad].titleize_tr, - fathers_name: old_identity_card_informations[:baba_ad].titleize_tr, - mothers_name: old_identity_card_informations[:anne_ad].titleize_tr, - place_of_birth: old_identity_card_informations[:dogum_yer].titleize_tr, - date_of_birth: build_date(*old_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - number: old_identity_card_informations[:no].safe_to_i, - registration_number: old_identity_card_informations[:cuzdan_kayit_no].safe_to_i, - serial_number: old_identity_card_informations[:seri], - issuing_date: build_date(*old_identity_card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)), + id_number: integer(old_identity_card_informations[:tc_kimlik_no]), + first_name: string(old_identity_card_informations[:ad]), + last_name: string(old_identity_card_informations[:soyad]), + fathers_name: string(old_identity_card_informations[:baba_ad]), + mothers_name: string(old_identity_card_informations[:anne_ad]), + place_of_birth: string(old_identity_card_informations[:dogum_yer]), + date_of_birth: old_identity_card_informations[:dogum_tarih] && build_date(*old_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + number: integer(old_identity_card_informations[:no]), + registration_number: integer(old_identity_card_informations[:cuzdan_kayit_no]), + serial_number: string(old_identity_card_informations[:seri], titleize_turkish: false), + issuing_date: old_identity_card_informations[:verilme_tarih] && build_date(*old_identity_card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)), issuing_reason: { - code: old_identity_card_informations.dig(:cuzdan_verilme_neden, :kod).safe_to_i, - description: old_identity_card_informations.dig(:cuzdan_verilme_neden, :aciklama).titleize_tr + code: integer(old_identity_card_informations.dig(:cuzdan_verilme_neden, :kod)), + description: string(old_identity_card_informations.dig(:cuzdan_verilme_neden, :aciklama)) }, issuing_district: { - code: old_identity_card_informations.dig(:verildigi_ilce, :kod).safe_to_i, - description: old_identity_card_informations.dig(:verildigi_ilce, :aciklama).titleize_tr + code: integer(old_identity_card_informations.dig(:verildigi_ilce, :kod)), + description: string(old_identity_card_informations.dig(:verildigi_ilce, :aciklama)) } } new_identity_card_photograph_informations = informations[:tckk_fotograf_bilgisi] new_identity_card_photograph_informations = new_identity_card_photograph_informations[:hata_bilgisi].present? ? nil : { - id_number: new_identity_card_photograph_informations[:tc_kimlik_no].safe_to_i, - photograph: new_identity_card_photograph_informations[:fotograf], + id_number: integer(new_identity_card_photograph_informations[:tc_kimlik_no]), + photograph: string(new_identity_card_photograph_informations[:fotograf], titleize_turkish: false), } new_identity_card_informations = informations[:tckk_bilgisi] new_identity_card_informations = new_identity_card_informations[:hata_bilgisi].present? ? nil : { - id_number: new_identity_card_informations[:id_number].safe_to_i, - first_name: new_identity_card_informations[:ad].titleize_tr, - last_name: new_identity_card_informations[:soyad].titleize_tr, - fathers_name: new_identity_card_informations[:baba_ad].titleize_tr, - mothers_name: new_identity_card_informations[:anne_ad].titleize_tr, + id_number: integer(new_identity_card_informations[:id_number]), + first_name: string(new_identity_card_informations[:ad]), + last_name: string(new_identity_card_informations[:soyad]), + fathers_name: string(new_identity_card_informations[:baba_ad]), + mothers_name: string(new_identity_card_informations[:anne_ad]), gender: { - code: new_identity_card_informations.dig(:cinsiyet, :kod).safe_to_i, - description: new_identity_card_informations.dig(:cinsiyet, :aciklama).titleize_tr + code: integer(new_identity_card_informations.dig(:cinsiyet, :kod)), + description: string(new_identity_card_informations.dig(:cinsiyet, :aciklama)) }, - place_of_birth: new_identity_card_informations[:dogum_yer].titleize_tr, - date_of_birth: build_date(*new_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - registry_number: new_identity_card_informations[:kayit_no].safe_to_i, - serial_number: new_identity_card_informations[:seri_no].safe_to_i, + place_of_birth: string(new_identity_card_informations[:dogum_yer]), + date_of_birth: new_identity_card_informations[:dogum_tarih] && build_date(*new_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + registry_number: integer(new_identity_card_informations[:kayit_no]), + serial_number: integer(new_identity_card_informations[:seri_no]), date_of_expiration: new_identity_card_informations[:son_gecerlilik_tarih] && build_date(*new_identity_card_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)), admission_reason: new_identity_card_informations[:basvuru_neden] && { - code: new_identity_card_informations.dig(:basvuru_neden, :kod).safe_to_i, - description: new_identity_card_informations.dig(:basvuru_neden, :aciklama).titleize_tr, + code: integer(new_identity_card_informations.dig(:basvuru_neden, :kod)), + description: string(new_identity_card_informations.dig(:basvuru_neden, :aciklama)), }, - deliverer_unit: new_identity_card_informations[:teslim_eden_birim].titleize_tr, + deliverer_unit: string(new_identity_card_informations[:teslim_eden_birim]), date_of_delivery: new_identity_card_informations[:teslim_tarih] && build_date(*new_identity_card_informations[:teslim_tarih].values_at(:yil, :ay, :gun)), - issuing_authority: new_identity_card_informations[:veren_makam].titleize_tr, + issuing_authority: string(new_identity_card_informations[:veren_makam]), photograph: new_identity_card_photograph_informations } @@ -240,51 +249,51 @@ class IdentitiesSerializer < Serializer basic_informations = foreigner[:temel_bilgisi] basic_informations = basic_informations[:hata_bilgisi].present? ? nil : { - first_name: basic_informations[:ad].titleize, - last_name: basic_informations[:soyad].titleize, - fathers_name: basic_informations[:baba_ad].titleize, - mothers_name: basic_informations[:anne_ad].titleize, + first_name: string(basic_informations[:ad], ->(p) { p.titleize }, titleize_turkish: false), + last_name: string(basic_informations[:soyad], ->(p) { p.titleize }, titleize_turkish: false), + fathers_name: string(basic_informations[:baba_ad], ->(p) { p.titleize }, titleize_turkish: false), + mothers_name: string(basic_informations[:anne_ad], ->(p) { p.titleize }, titleize_turkish: false), gender: { - code: basic_informations.dig(:cinsiyet, :kod).safe_to_i, - description: basic_informations.dig(:cinsiyet, :aciklama).titleize_tr + code: integer(basic_informations.dig(:cinsiyet, :kod)), + description: string(basic_informations.dig(:cinsiyet, :aciklama)) }, - place_of_birth: basic_informations[:dogum_yer].titleize + place_of_birth: string(basic_informations[:dogum_yer], ->(p) { p.titleize }, titleize_turkish: false) } status_informations = foreigner[:durum_bilgisi] status_informations = status_informations[:hata_bilgisi].present? ? nil : { - code: status_informations[:kod].safe_to_i, - description: status_informations[:aciklama].titleize_tr + code: integer(status_informations[:kod]), + description: string(status_informations[:aciklama]) } admittance_informations = { - number: foreigner[:izin_no].safe_to_i, - date_of_start: foreigner[:izin_baslangic_tarih], - date_of_end: foreigner[:izin_bitis_tarih], + number: integer(foreigner[:izin_no]), + date_of_start: parse_date(foreigner[:izin_baslangic_tarih]), + date_of_end: parse_date(foreigner[:izin_bitis_tarih]), issuing_city: { - code: foreigner.dig(:izin_duzenlenen_il, :kod).safe_to_i, - description: foreigner.dig(:izin_duzenlenen_il, :aciklama).titleize_tr + code: integer(foreigner.dig(:izin_duzenlenen_il, :kod)), + description: string(foreigner.dig(:izin_duzenlenen_il, :aciklama)) } } { - id_number: foreigner[:kimlik_no].safe_to_i, - mothers_id_number: foreigner[:anne_kimlik_no].safe_to_i, - fathers_id_number: foreigner[:baba_kimlik_no].safe_to_i, - old_id_number: foreigner[:es_tc_kimlik_no].safe_to_i, - new_id_number: foreigner[:kazanilan_tc_kimlik_no].safe_to_i, - real_person_id_number: foreigner[:gercek_kisi_kimlik_no].safe_to_i, - code_of_place_of_birth: foreigner[:dogum_yer_kod].safe_to_i, - date_of_birth: build_date(*foreigner[:dogum_tarih].values_at(:yil, :ay, :gun)), - date_of_death: build_date(*foreigner[:olum_tarih].values_at(:yil, :ay, :gun)), + id_number: integer(foreigner[:kimlik_no]), + mothers_id_number: integer(foreigner[:anne_kimlik_no]), + fathers_id_number: integer(foreigner[:baba_kimlik_no]), + old_id_number: integer(foreigner[:es_tc_kimlik_no]), + new_id_number: integer(foreigner[:kazanilan_tc_kimlik_no]), + real_person_id_number: integer(foreigner[:gercek_kisi_kimlik_no]), + code_of_place_of_birth: integer(foreigner[:dogum_yer_kod]), + date_of_birth: foreigner[:dogum_tarih] && build_date(*foreigner[:dogum_tarih].values_at(:yil, :ay, :gun)), + date_of_death: foreigner[:olum_tarih] && build_date(*foreigner[:olum_tarih].values_at(:yil, :ay, :gun)), nationality: { - code: foreigner.dig(:uyruk, :kod).safe_to_i, - description: foreigner.dig(:uyruk, :aciklama).titleize_tr + code: integer(foreigner.dig(:uyruk, :kod)), + description: string(foreigner.dig(:uyruk, :aciklama)) }, admittance: admittance_informations, source_unit: { - code: foreigner.dig(:kaynak_birim, :kod).safe_to_i, - description: foreigner.dig(:kaynak_birim, :aciklama).titleize_tr + code: integer(foreigner.dig(:kaynak_birim, :kod)), + description: string(foreigner.dig(:kaynak_birim, :aciklama)) }, basic_informations: basic_informations, status: status_informations diff --git a/app/serializers/osym/examination/groups_serializer.rb b/app/serializers/osym/examination/groups_serializer.rb index a782e325..e010a0a1 100644 --- a/app/serializers/osym/examination/groups_serializer.rb +++ b/app/serializers/osym/examination/groups_serializer.rb @@ -3,8 +3,8 @@ module Osym module Examination class GroupsSerializer < ActiveModel::Serializer - attribute(:id) { object[:id].safe_to_i } - attribute(:name) { object[:ad].upcase_tr } + attribute(:id) { integer object[:id] } + attribute(:name) { string object[:ad], ->(p) { p.upcase :turkic } } end end end diff --git a/app/serializers/osym/examination/result_informations_serializer.rb b/app/serializers/osym/examination/result_informations_serializer.rb index fe034db9..7a485d18 100644 --- a/app/serializers/osym/examination/result_informations_serializer.rb +++ b/app/serializers/osym/examination/result_informations_serializer.rb @@ -3,9 +3,9 @@ module Osym module Examination class ResultInformationsSerializer < ActiveModel::Serializer - attribute(:id) { object[:id].safe_to_i } - attribute(:name) { object[:ad] } - attribute(:date_of_release) { object[:aciklama_tarihi] } + attribute(:id) { integer object[:id] } + attribute(:name) { string object[:ad] } + attribute(:date_of_release) { parse_date object[:aciklama_tarihi] } end end end diff --git a/app/serializers/yoksis/graduates/informations_serializer.rb b/app/serializers/yoksis/graduates/informations_serializer.rb index e75bb843..bf500eef 100644 --- a/app/serializers/yoksis/graduates/informations_serializer.rb +++ b/app/serializers/yoksis/graduates/informations_serializer.rb @@ -1,29 +1,35 @@ -# frozen_string_literal: :titleize +# frozen_string_literal: true module Yoksis module Graduates class InformationsSerializer < Serializer - attribute(:id_number) { integer object[:tckno] } - attribute(:first_name) { string object[:adi], method: :titleize } - attribute(:last_name) { string object[:soyadi], method: :titleize } - attribute(:fathers_name) { string object[:baba_adi], method: :titleize } - attribute(:mothers_name) { string object[:anne_adi], method: :titleize } - attribute(:diploma_grade) { float object[:diploma_notu] } - attribute(:diploma_grading_system) { integer object[:diploma_not_sistemi] } - attribute(:diploma_no) { string object[:diploma_no], method: :upcase } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:universite_adi], method: :titleize } - attribute(:faculty) { string object[:fak_myo_yo_ens], method: :titleize } - attribute(:program) { string object[:program_adi], method: :titleize } - attribute(:unit_id) { integer object[:birim_id] } + attribute(:id_number) { integer object[:tckno] } + attribute(:first_name) { string object[:adi] } + attribute(:last_name) { string object[:soyadi] } + attribute(:fathers_name) { string object[:baba_adi] } + attribute(:mothers_name) { string object[:anne_adi] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite_adi] } + attribute(:faculty) { string object[:fak_myo_yo_ens] } + attribute(:program) { string object[:program_adi] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:diploma_grading_system) { integer object[:diploma_not_sistemi] } + attribute(:diploma_grade) { float object[:diploma_notu] } + attribute(:diploma_no) { string object[:diploma_no], ->(p) { p.upcase :turkic } } attribute :date_of_birth do - build_date(*object[:dogum_tarihi].values_at(:yil, :ay, :gun)) + next unless object[:dogum_tarihi] + + year, month, day = object[:dogum_tarihi].values_at :yil, :ay, :gun + build_date year, month, day end attribute :date_of_graduation do - build_date(*object[:mezuniyet_tarihi].values_at(:yil, :ay, :gun)) + next unless object[:mezuniyet_tarihi] + + year, month, day = object[:mezuniyet_tarihi].values_at :yil, :ay, :gun + build_date year, month, day end end end -end \ No newline at end of file +end diff --git a/app/serializers/yoksis/meb/students_serializer.rb b/app/serializers/yoksis/meb/students_serializer.rb index eba3f906..b5ee7c49 100644 --- a/app/serializers/yoksis/meb/students_serializer.rb +++ b/app/serializers/yoksis/meb/students_serializer.rb @@ -3,25 +3,24 @@ module Yoksis module Meb class StudentsSerializer < Serializer - attribute(:id_number) { integer object[:tckimlikno] } - attribute(:first_name) { string object[:adi], method: :titleize } - attribute(:last_name) { string object[:soyadi], method: :titleize } - attribute(:school_id) { integer object[:okulkodu] } - attribute(:school_name) { string object[:okuladi], method: :titleize } - attribute(:school_field_code) { integer object[:okulalankodu] } - attribute(:school_field_name) { string object[:okulalanadi], method: :titleize } - attribute(:school_branch_code) { integer object[:okuldalkodu] } - attribute(:school_branch_name) { string object[:okuldaladi], method: :titleize } - attribute(:city_name) { string object[:okuliladi], method: :titleize } - attribute(:city_code) { integer object[:okulilkodu] } - attribute(:district_name) { string object[:okulilceadi], method: :titleize } - attribute(:district_code) { integer object[:okulilcekodu] } - attribute(:instruction_type) { string object[:ogrenimturu], method: :titleize } - attribute(:grad_status_code) { integer object[:mezundurumukodu] } - attribute(:grad_status) { string object[:mezundurumu], method: :titleize } - attribute(:graduation_date) { date object[:mezuniyettarih] } - attribute(:grading_system) { integer object[:notsistemi] } - attribute(:diploma_grade) { float object[:diplomanotupuani] } + attribute(:id_number) { integer object[:tckimlikno] } + attribute(:first_name) { string object[:adi] } + attribute(:last_name) { string object[:soyadi] } + attribute(:city_name) { string object[:okuliladi] } + attribute(:city_code) { integer object[:okulilkodu] } + attribute(:district_name) { string object[:okulilceadi] } + attribute(:district_code) { integer object[:okulilcekodu] } + attribute(:school_id) { integer object[:okulkodu] } + attribute(:school_name) { string object[:okuladi] } + attribute(:school_field_code) { integer object[:okulalankodu] } + attribute(:school_field_name) { string object[:okulalanadi] } + attribute(:school_branch_code) { integer object[:okuldalkodu] } + attribute(:school_branch_name) { string object[:okuldaladi] } + attribute(:instruction_type) { string object[:ogrenimturu] } + attribute(:grad_status_code) { integer object[:mezundurumukodu] } + attribute(:grad_status_name) { string object[:mezundurumu] } + attribute(:graduation_date) { parse_date object[:mezuniyettarih] } + attribute(:grading_system) { integer object[:notsistemi] } attribute :top_scoring_student do object[:okulbirincisi] && !object[:okulbirincisi].to_i.zero? diff --git a/app/serializers/yoksis/military/informations_serializer.rb b/app/serializers/yoksis/military/informations_serializer.rb index d63d1610..2f4627cb 100644 --- a/app/serializers/yoksis/military/informations_serializer.rb +++ b/app/serializers/yoksis/military/informations_serializer.rb @@ -3,16 +3,10 @@ module Yoksis module Military class InformationsSerializer < Serializer - attribute(:id_number) { integer object[:tcKimlikNo] } - attribute(:first_name) { string object[:adi], method: :titleize } - attribute(:last_name) { string object[:soyadi], method: :titleize } - - attribute :status do - { - code: integer(object[:askerlikDurumKod]), - description: string(object[:askerlikDurumAciklama], method: :capitalize) - } - end + attribute(:id_number) { integer object[:tcKimlikNo] } + attribute(:first_name) { string object[:adi] } + attribute(:last_name) { string object[:soyadi] } + attribute(:status) { integer object[:askerlikDurumKod] } end end end diff --git a/app/serializers/yoksis/references/administrative_units_serializer.rb b/app/serializers/yoksis/references/administrative_units_serializer.rb index f9dab2f6..f9b02405 100644 --- a/app/serializers/yoksis/references/administrative_units_serializer.rb +++ b/app/serializers/yoksis/references/administrative_units_serializer.rb @@ -3,9 +3,9 @@ module Yoksis module References class AdministrativeUnitsSerializer < Serializer - attribute(:unit_id) { integer object[:birim_id] } - attribute(:unit_name) { string object[:birim_adi], method: :titleize } - attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } + attribute(:unit_name) { string object[:birim_adi], ->(p) { p.upcase :turkic } } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } end end end diff --git a/app/serializers/yoksis/references/base_serializer.rb b/app/serializers/yoksis/references/base_serializer.rb index 20d00c99..645c7218 100644 --- a/app/serializers/yoksis/references/base_serializer.rb +++ b/app/serializers/yoksis/references/base_serializer.rb @@ -3,8 +3,8 @@ module Yoksis module References class BaseSerializer < Serializer - attribute(:code) { integer object[:kod] } - attribute(:name) { string object[:ad], method: :titleize } + attribute(:code) { integer object[:kod] } + attribute(:name) { string object[:ad] } end end end diff --git a/app/serializers/yoksis/resumes/academic_duties_serializer.rb b/app/serializers/yoksis/resumes/academic_duties_serializer.rb index a7b39218..757c47be 100644 --- a/app/serializers/yoksis/resumes/academic_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_duties_serializer.rb @@ -3,30 +3,30 @@ module Yoksis module Resumes class AcademicDutiesSerializer < Serializer - attribute(:duty_id) { integer object[:gorev_id] } - attribute(:year_of_start) { integer object[:bastar1] } - attribute(:year_of_end) { integer object[:bittar1] } - attribute(:place_id) { integer object[:yer_id] } - attribute(:place_name) { string object[:yer_ad], method: :titleize } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_ad], method: :titleize } - attribute(:scientific_field_name) { string object[:bilimalan_adi], method: :titleize } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:univ_birim_adi], method: :titleize } - attribute(:faculty) { string object[:fakultebilgisi], method: :titleize } - attribute(:department) { string object[:bolumbilgisi], method: :titleize } - attribute(:unit_id) { integer object[:birim_id] } - attribute(:field) { string object[:alanbilgisi], method: :titleize } - attribute(:field_of_specialization_id) { integer object[:uzmanlik_alani] } - attribute(:field_of_specialization_name) { string object[:uzmanlik_alani_ad], method: :titleize } - attribute(:title_id) { integer object[:kadro_unvan_id] } - attribute(:title_name) { string object[:kadro_unvan_adi], method: :titleize } - attribute(:academic_status_id) { integer object[:akademik_durum] } - attribute(:academic_status_name) { string object[:akademik_durum_adi], method: :titleize } - attribute(:academic_unit_name) { string object[:akademik_birim_adi], method: :titleize } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:duty_id) { integer object[:gorev_id] } + attribute(:place_name) { string object[:yer_ad] } + attribute(:place_id) { integer object[:yer_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:university_name) { string object[:univ_birim_adi] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:faculty) { string object[:fakultebilgisi] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:title_name) { string object[:kadro_unvan_adi] } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:year_of_start) { integer object[:bastar1] } + attribute(:year_of_end) { integer object[:bittar1] } + attribute(:field) { string object[:alanbilgisi] } + attribute(:field_of_specialization_id) { integer object[:uzmanlik_alani] } + attribute(:field_of_specialization_name) { string object[:uzmanlik_alani_ad] } + attribute(:scientific_field_name) { string object[:bilimalan_adi] } + attribute(:academic_status_id) { integer object[:akademik_durum] } + attribute(:academic_status_name) { string object[:akademik_durum_adi] } + attribute(:academic_unit_name) { string object[:akademik_birim_adi], ->(p) { p.gsub(/\/*$/, '') } } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/academic_links_serializer.rb b/app/serializers/yoksis/resumes/academic_links_serializer.rb index dc287667..bc9d9864 100644 --- a/app/serializers/yoksis/resumes/academic_links_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_links_serializer.rb @@ -3,13 +3,13 @@ module Yoksis module Resumes class AcademicLinksSerializer < Serializer - attribute(:researcher_id) { integer object[:arastirmaci_id] } - attribute(:staff_first_name) { string object[:personel_adi], method: :titleize } - attribute(:staff_last_name) { string object[:personel_soyadi], method: :titleize } - attribute(:staff_title) { string object[:kadro_unvan_adi], method: :titleize } - attribute(:staff_workplace) { string object[:kadro_yeri], method: :titleize } - attribute(:yok_link) { string object[:yokakademik_link] } - attribute(:photograph_link) { string object[:resim_link] } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:staff_first_name) { string object[:personel_adi] } + attribute(:staff_last_name) { string object[:personel_soyadi] } + attribute(:staff_title) { string object[:kadro_unvan_adi] } + attribute(:staff_workplace) { string object[:kadro_yeri] } + attribute(:yok_link) { string object[:yokakademik_link], titleize_turkish: false } + attribute(:photograph_link) { string object[:resim_link] } end end end diff --git a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb index fe3bc1f2..353801c0 100644 --- a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb @@ -3,23 +3,23 @@ module Yoksis module Resumes class AdministrativeDutiesSerializer < Serializer - attribute(:registry_id) { integer object[:idgor_id] } - attribute(:id) { integer object[:gorev_id] } - attribute(:name) { string object[:gorev_adi], method: :titleize } - attribute(:place_id) { integer object[:yer_id] } - attribute(:place_name) { string object[:yer_ad], method: :titleize } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_adi], method: :titleize } - attribute(:year_of_start) { integer object[:bas_tar] } - attribute(:year_of_end) { integer object[:bit_tar] } - attribute(:university_id) { integer object[:unv_id] } - attribute(:university_name) { string object[:unv_birim_adi], method: :titleize } - attribute(:major) { string object[:abd], method: :titleize } - attribute(:faculty) { string object[:fakultemyoenst], method: :titleize } - attribute(:department) { string object[:bolumbilgisi], method: :titleize } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:registry_id) { integer object[:idgor_id] } + attribute(:id) { integer object[:gorev_id] } + attribute(:name) { string object[:gorev_adi] } + attribute(:place_id) { integer object[:yer_id] } + attribute(:place_name) { string object[:yer_ad] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:year_of_start) { integer object[:bas_tar] } + attribute(:year_of_end) { integer object[:bit_tar] } + attribute(:university_id) { integer object[:unv_id] } + attribute(:university_name) { string object[:unv_birim_adi] } + attribute(:major) { string object[:abd] } + attribute(:faculty) { string object[:fakultemyoenst] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/articles_serializer.rb b/app/serializers/yoksis/resumes/articles_serializer.rb index cca1ec19..e67ef99c 100644 --- a/app/serializers/yoksis/resumes/articles_serializer.rb +++ b/app/serializers/yoksis/resumes/articles_serializer.rb @@ -3,45 +3,45 @@ module Yoksis module Resumes class ArticlesSerializer < Serializer - attribute(:publishing_id) { integer object[:yayin_id] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi], method: :titleize } - attribute(:name) { string object[:makale_adi], method: :titleize } - attribute(:type_id) { integer object[:makale_turu_id] } - attribute(:type_name) { string object[:makale_turu_ad], method: :titleize } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad], method: :titleize } - attribute(:referee_type_id) { integer object[:hakem_tur] } - attribute(:referee_type_name) { string object[:hakem_tur_ad], method: :titleize } - attribute(:index_id) { integer object[:endeks_id] } - attribute(:index) { string object[:endeks], method: :titleize } - attribute(:author_id) { integer object[:yazar_id] } - attribute(:authors) { split object[:yazar_adi], separator: ',' } - attribute(:number_of_author) { integer object[:yazar_sayisi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi], method: :titleize } - attribute(:city) { string object[:sehir], method: :titleize } - attribute(:journal_name) { string object[:dergi_adi], method: :titleize } - attribute(:month) { integer object[:ay] } - attribute(:year) { integer object[:yil] } - attribute(:volume) { integer object[:cilt] } - attribute(:issue) { integer object[:sayi] } - attribute(:first_page) { integer object[:ilk_sayfa] } - attribute(:last_page) { integer object[:son_sayfa] } - attribute(:doi) { integer object[:doi] } - attribute(:issn) { integer object[:issn] } - attribute(:access_type_id) { integer object[:erisim_turu] } - attribute(:access_type_name) { string object[:erisim_turu_ad], method: :titleize } - attribute(:access_link) { string object[:erisim_linki] } - attribute(:number_of_citation) { integer object[:atif_sayisi] } - attribute(:field) { string object[:alan_bilgisi], method: :titleize } - attribute(:keywords) { split object[:anahtar_kelime], separator: ',' } - attribute(:special_edition_id) { integer object[:ozel_sayi] } - attribute(:special_edition_name) { string object[:ozel_sayi_ad], method: :titleize } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:publishing_id) { integer object[:yayin_id] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi] } + attribute(:name) { string object[:makale_adi] } + attribute(:type_id) { integer object[:makale_turu_id] } + attribute(:type_name) { string object[:makale_turu_ad] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:referee_type_id) { integer object[:hakem_tur] } + attribute(:referee_type_name) { string object[:hakem_tur_ad] } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:index) { string object[:endeks] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:city) { string object[:sehir] } + attribute(:journal_name) { string object[:dergi_adi] } + attribute(:month) { integer object[:ay] } + attribute(:year) { integer object[:yil] } + attribute(:volume) { integer object[:cilt] } + attribute(:issue) { integer object[:sayi] } + attribute(:first_page) { integer object[:ilk_sayfa] } + attribute(:last_page) { integer object[:son_sayfa] } + attribute(:doi) { integer object[:doi] } + attribute(:issn) { integer object[:issn] } + attribute(:access_type_id) { integer object[:erisim_turu] } + attribute(:access_type_name) { string object[:erisim_turu_ad] } + attribute(:access_link) { string object[:erisim_linki], titleize_turkish: false } + attribute(:number_of_citation) { integer object[:atif_sayisi] } + attribute(:field) { string object[:alan_bilgisi] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:special_edition_id) { integer object[:ozel_sayi] } + attribute(:special_edition_name) { string object[:ozel_sayi_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb index 6fda03a5..1d4f9ca5 100644 --- a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb +++ b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb @@ -3,34 +3,34 @@ module Yoksis module Resumes class ArtisticActivitiesSerializer < Serializer - attribute(:registry_id) { integer object[:s_id] } - attribute(:name) { string object[:etkinlik_adi], method: :titleize } - attribute(:place) { string object[:etkinlik_yeri], method: :titleize } - attribute(:type_id) { integer object[:etkinlik_turu] } - attribute(:type_name) { string object[:etkinlik_turu_ad], method: :titleize } - attribute(:duration) { integer object[:etkinlik_suresi] } - attribute(:scope_id) { integer object[:kapsam] } - attribute(:scope_name) { string object[:kapsam_ad], method: :titleize } - attribute(:language_id) { integer object[:etkinlik_dili] } - attribute(:language_name) { string object[:dil_adi], method: :titleize } - attribute(:date_of_start) { date object[:bas_tarih] } - attribute(:date_of_end) { date object[:bit_tarih] } - attribute(:organizers) { split object[:duzenleyenler], separator: ',' } - attribute(:number_of_person) { integer object[:kisi_sayisi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi], method: :titleize } - attribute(:city) { string object[:sehir], method: :titleize } - attribute(:title_id) { integer object[:unvan_id] } - attribute(:title_name) { string object[:unvan_ad], method: :titleize } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad], method: :titleize } - attribute(:work_type_id) { integer object[:tip] } - attribute(:work_type_name) { string object[:tip_adi], method: :titleize } - attribute(:main_type_id) { integer object[:ana_tur] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad], method: :titleize } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:registry_id) { integer object[:s_id] } + attribute(:name) { string object[:etkinlik_adi] } + attribute(:place) { string object[:etkinlik_yeri] } + attribute(:type_id) { integer object[:etkinlik_turu] } + attribute(:type_name) { string object[:etkinlik_turu_ad] } + attribute(:duration) { integer object[:etkinlik_suresi] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:language_id) { integer object[:etkinlik_dili] } + attribute(:language_name) { string object[:dil_adi] } + attribute(:date_of_start) { parse_date object[:bas_tarih] } + attribute(:date_of_end) { parse_date object[:bit_tarih] } + attribute(:organizers) { split_string object[:duzenleyenler] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:city) { string object[:sehir] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad] } + attribute(:work_type_id) { integer object[:tip] } + attribute(:work_type_name) { string object[:tip_adi] } + attribute(:main_type_id) { integer object[:ana_tur] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/authors_serializer.rb b/app/serializers/yoksis/resumes/authors_serializer.rb index 5e0f3937..d5e3b3e8 100644 --- a/app/serializers/yoksis/resumes/authors_serializer.rb +++ b/app/serializers/yoksis/resumes/authors_serializer.rb @@ -3,21 +3,21 @@ module Yoksis module Resumes class AuthorsSerializer < Serializer - attribute(:registry_id) { integer object[:y_id] } - attribute(:id_number) { integer object[:tc_kimlik_no] } - attribute(:first_name) { string object[:yazarad], method: :titleize } - attribute(:last_name) { string object[:yazarsoyad], method: :titleize } - attribute(:researcher_id) { integer object[:arastirmaci_id] } - attribute(:title_id) { integer object[:kadro_unvan_id] } - attribute(:title_name) { string object[:kadro_unvan_adi], method: :titleize } - attribute(:type_id) { integer object[:yazar_tur] } - attribute(:type_name) { string object[:yazar_tur_ad], method: :titleize } - attribute(:form_id) { integer object[:yazar_form_id] } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:universite], method: :titleize } - attribute(:users_ars_id) { integer object[:kullanicinin_ars_id] } - attribute(:orc_id) { integer object[:yazar_orcid] } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:registry_id) { integer object[:y_id] } + attribute(:id_number) { integer object[:tc_kimlik_no] } + attribute(:first_name) { string object[:yazarad] } + attribute(:last_name) { string object[:yazarsoyad] } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:title_name) { string object[:kadro_unvan_adi] } + attribute(:type_id) { integer object[:yazar_tur] } + attribute(:type_name) { string object[:yazar_tur_ad] } + attribute(:form_id) { integer object[:yazar_form_id] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite] } + attribute(:users_ars_id) { integer object[:kullanicinin_ars_id] } + attribute(:orc_id) { integer object[:yazar_orcid] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/awards_serializer.rb b/app/serializers/yoksis/resumes/awards_serializer.rb index 5bebdeff..5a2dc0e9 100644 --- a/app/serializers/yoksis/resumes/awards_serializer.rb +++ b/app/serializers/yoksis/resumes/awards_serializer.rb @@ -3,37 +3,37 @@ module Yoksis module Resumes class AwardsSerializer < Serializer - attribute(:id) { integer object[:odul_id] } - attribute(:name) { string object[:odul_adi], method: :titleize } - attribute(:description) { string object[:odul_aciklama], method: :titleize } - attribute(:year) { integer object[:odul_tarih] } - attribute(:activity_detail_id) { integer object[:faal_detay_id] } - attribute(:activity_detail_name) { string object[:faal_detay_adi], method: :titleize } - attribute(:type_id) { integer object[:odul_tur_id] } - attribute(:type_name) { string object[:odul_turu], method: :titleize } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_ad], method: :titleize } - attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:id) { integer object[:odul_id] } + attribute(:name) { string object[:odul_adi] } + attribute(:description) { string object[:odul_aciklama] } + attribute(:year) { integer object[:odul_tarih] } + attribute(:activity_detail_id) { integer object[:faal_detay_id] } + attribute(:activity_detail_name) { string object[:faal_detay_adi] } + attribute(:type_id) { integer object[:odul_tur_id] } + attribute(:type_name) { string object[:odul_turu] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } attribute :awarder do { - institution_name: string(object[:kurulus_adi], method: :titleize), + institution_name: string(object[:kurulus_adi]), workplace_type_id: integer(object[:isyeri_turu_id]), - workplace_type_name: string(object[:isyeri_turu_adi], method: :titleize) + workplace_type_name: string(object[:isyeri_turu_adi]) } end attribute :conferee do { title_id: integer(object[:p_unvan_id]), - title_name: string(object[:p_unvan_ad], method: :titleize), + title_name: string(object[:p_unvan_ad]), institution_id: integer(object[:p_kurum_id]), - institution_name: string(object[:p_kurum_ad], method: :titleize) + institution_name: string(object[:p_kurum_ad]) } end - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { datetime object[:guncelleme_tarihi] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/books_serializer.rb b/app/serializers/yoksis/resumes/books_serializer.rb index 7118812d..2d7f1c5a 100644 --- a/app/serializers/yoksis/resumes/books_serializer.rb +++ b/app/serializers/yoksis/resumes/books_serializer.rb @@ -3,41 +3,41 @@ module Yoksis module Resumes class BooksSerializer < Serializer - attribute(:registry_id) { object[:y_id].safe_to_i } - attribute(:publishing_house) { object[:yayin_evi].titleize_tr } - attribute(:publishing_language_id) { object[:yayin_dili].safe_to_i } - attribute(:publishing_language_name) { object[:yayin_dili_adi].titleize_tr } - attribute(:name) { object[:kitap_adi].safe_to_i } - attribute(:type_id) { object[:kitap_tur_id].safe_to_i } - attribute(:type_name) { object[:kitap_tur].titleize_tr } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:contribution_rate_id) { object[:katki_duzeyi].safe_to_i } - attribute(:contribution_rate_name) { object[:katki_duzeyi_ad].titleize_tr } - attribute(:chapter_name) { object[:bolum_adi].titleize_tr } - attribute(:number_of_author) { object[:yazar_sayisi].safe_to_i } - attribute(:authors) { object[:yazar_adi] && object[:yazar_adi].split(',').map(&:strip).map(&:titleize_tr).titleize_tr } - attribute(:editor_name) { object[:editor_adi].titleize_tr } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:year) { object[:yil].safe_to_i } - attribute(:isbn) { object[:isbn].titleize_tr } - attribute(:number_of_copy) { object[:kacinci_basim].safe_to_i } - attribute(:number_of_page) { object[:sayfa_sayisi].safe_to_i } - attribute(:chapter_first_page) { object[:bolum_ilk_sayfa].safe_to_i } - attribute(:chapter_last_page) { object[:bolum_son_sayfa].safe_to_i } - attribute(:releasing_type_id) { object[:basim_turu].safe_to_i } - attribute(:releasing_type_name) { object[:basim_turu_ad].titleize_tr } - attribute(:access_link) { object[:erisim_linki] } - attribute(:field) { object[:alan_bilgisi].titleize_tr } - attribute(:keywords) { object[:anahtar_kelime].titleize_tr } - attribute(:author_id) { object[:yazar_id].safe_to_i } - attribute(:number_of_citation) { object[:atif_sayisi].safe_to_i } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:registry_id) { integer object[:y_id] } + attribute(:publishing_house) { string object[:yayin_evi] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi] } + attribute(:name) { integer object[:kitap_adi] } + attribute(:type_id) { integer object[:kitap_tur_id] } + attribute(:type_name) { string object[:kitap_tur] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:contribution_rate_id) { integer object[:katki_duzeyi] } + attribute(:contribution_rate_name) { string object[:katki_duzeyi_ad] } + attribute(:chapter_name) { string object[:bolum_adi] } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:editor_name) { string object[:editor_adi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:city) { string object[:sehir] } + attribute(:year) { integer object[:yil] } + attribute(:isbn) { string object[:isbn] } + attribute(:number_of_copy) { integer object[:kacinci_basim] } + attribute(:number_of_page) { integer object[:sayfa_sayisi] } + attribute(:chapter_first_page) { integer object[:bolum_ilk_sayfa] } + attribute(:chapter_last_page) { integer object[:bolum_son_sayfa] } + attribute(:releasing_type_id) { integer object[:basim_turu] } + attribute(:releasing_type_name) { string object[:basim_turu_ad] } + attribute(:access_link) { string object[:erisim_linki] } + attribute(:field) { string object[:alan_bilgisi] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:number_of_citation) { integer object[:atif_sayisi] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/certifications_serializer.rb b/app/serializers/yoksis/resumes/certifications_serializer.rb index 148db7a1..77c93aa9 100644 --- a/app/serializers/yoksis/resumes/certifications_serializer.rb +++ b/app/serializers/yoksis/resumes/certifications_serializer.rb @@ -3,35 +3,38 @@ module Yoksis module Resumes class CertificationsSerializer < Serializer - attribute(:registry_id) { object[:s_id].safe_to_i } - attribute(:name) { object[:adi].titleize_tr } - attribute(:content) { object[:icerik].titleize_tr } - attribute(:type_id) { object[:tur_id].safe_to_i } - attribute(:type_name) { object[:tur_adi].titleize_tr } - attribute(:place) { object[:yer].titleize_tr } - attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:stint) { object[:sure].safe_to_i } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad].titleize_tr } - attribute(:institution_id) { object[:kurum_id].safe_to_i } - attribute(:institution_name) { object[:kurum_ad].titleize_tr } - attribute(:number_of_person) { object[:kisi_sayisi].safe_to_i } - attribute(:country) { object[:ulke_sehir] && object[:ulke_sehir].split('/').first.titleize_tr } - attribute(:city) { object[:ulke_sehir] && object[:ulke_sehir].split('/').last.titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:registry_id) { integer object[:s_id] } + attribute(:name) { string object[:adi] } + attribute(:content) { string object[:icerik] } + attribute(:type_id) { integer object[:tur_id] } + attribute(:type_name) { string object[:tur_adi] } + attribute(:place) { string object[:yer] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:stint) { integer object[:sure] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:country) { string object[:ulke_sehir] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } attribute :date_of_start do next unless object[:bastar] - build_date(*object[:bastar].split('.').reverse.collect(&:safe_to_i)) + + year, month, day = object[:bastar].split('.').reverse + build_date year, month, day end attribute :date_of_end do next unless object[:bittar] - build_date(*object[:bittar].split('.').reverse.collect(&:safe_to_i)) + + year, month, day = object[:bittar].split('.').reverse + build_date year, month, day end end end diff --git a/app/serializers/yoksis/resumes/citations_serializer.rb b/app/serializers/yoksis/resumes/citations_serializer.rb index 3a8861a8..796ab15a 100644 --- a/app/serializers/yoksis/resumes/citations_serializer.rb +++ b/app/serializers/yoksis/resumes/citations_serializer.rb @@ -3,21 +3,21 @@ module Yoksis module Resumes class CitationsSerializer < Serializer - attribute(:registry_id) { object[:a_id].safe_to_i } - attribute(:term) { object[:donem].safe_to_i } - attribute(:type_id) { object[:tur].safe_to_i } - attribute(:type_name) { object[:tur_ad].titleize_tr } - attribute(:work_type) { object[:eser_turu].titleize_tr } - attribute(:work_id) { object[:eser_id].safe_to_i } - attribute(:international_book_citation) { object[:uluslar_kit_atf].safe_to_i } - attribute(:national_book_citation) { object[:ulusal_kit_atf].safe_to_i } - attribute(:ssci_index) { object[:ssci_indeks_atf].safe_to_i } - attribute(:scope_index) { object[:alan_indeks_atf].safe_to_i } - attribute(:other_citations) { object[:diger_atif] } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } - attribute(:esci) { object[:esci].safe_to_i } - attribute(:composer_work) { object[:besteci_eser] } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:a_id] } + attribute(:term) { integer object[:donem] } + attribute(:type_id) { integer object[:tur] } + attribute(:type_name) { string object[:tur_ad] } + attribute(:work_type) { string object[:eser_turu] } + attribute(:work_id) { integer object[:eser_id] } + attribute(:international_book_citation) { integer object[:uluslar_kit_atf] } + attribute(:national_book_citation) { integer object[:ulusal_kit_atf] } + attribute(:ssci_index) { integer object[:ssci_indeks_atf] } + attribute(:scope_index) { integer object[:alan_indeks_atf] } + attribute(:other_citations) { string object[:diger_atif], titleize_turkish: false } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:esci) { integer object[:esci] } + attribute(:composer_work) { string object[:besteci_eser], titleize_turkish: false } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/designs_serializer.rb b/app/serializers/yoksis/resumes/designs_serializer.rb index c0c51270..997860f9 100644 --- a/app/serializers/yoksis/resumes/designs_serializer.rb +++ b/app/serializers/yoksis/resumes/designs_serializer.rb @@ -3,27 +3,27 @@ module Yoksis module Resumes class DesignsSerializer < Serializer - attribute(:registry_id) { object[:p_tasarim_id].safe_to_i } - attribute(:name) { object[:tasarim_adi].titleize_tr } - attribute(:summary) { object[:tasarim_ozeti].titleize_tr } - attribute(:type_id) { object[:tasarim_turu].safe_to_i } - attribute(:type_name) { object[:tasarim_turu_adi].titleize_tr } - attribute(:type_detail_id) { object[:tasarim_turu_detay].safe_to_i } - attribute(:type_detail_name) { object[:tasarim_turu_detay_ad].titleize_tr } - attribute(:date_of_start) { object[:bas_tarihi] && Date.parse(object[:bas_tarihi]) } - attribute(:date_of_end) { object[:bitis_tarih] && Date.parse(object[:bitis_tarih]) } - attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:owners) { object[:tasarim_sahipleri] && object[:tasarim_sahipleri].split(',').map(&:strip).map(&:titleize_tr) } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad].titleize_tr } - attribute(:institution_id) { object[:kurum_id].safe_to_i } - attribute(:institution_name) { object[:kurum_ad].titleize_tr } - attribute(:number_of_person) { object[:kisi_sayisi].safe_to_i } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:registry_id) { integer object[:p_tasarim_id] } + attribute(:name) { string object[:tasarim_adi] } + attribute(:summary) { string object[:tasarim_ozeti] } + attribute(:type_id) { integer object[:tasarim_turu] } + attribute(:type_name) { string object[:tasarim_turu_adi] } + attribute(:type_detail_id) { integer object[:tasarim_turu_detay] } + attribute(:type_detail_name) { string object[:tasarim_turu_detay_ad] } + attribute(:date_of_start) { parse_date object[:bas_tarihi] } + attribute(:date_of_end) { parse_date object[:bitis_tarih] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:owners) { split_string object[:tasarim_sahipleri] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/editorships_serializer.rb b/app/serializers/yoksis/resumes/editorships_serializer.rb index e769c148..9e3d884b 100644 --- a/app/serializers/yoksis/resumes/editorships_serializer.rb +++ b/app/serializers/yoksis/resumes/editorships_serializer.rb @@ -3,40 +3,40 @@ module Yoksis module Resumes class EditorshipsSerializer < Serializer - attribute(:publishing_id) { object[:yayin_id].safe_to_i } - attribute(:publishing_name) { object[:yayin_adi].titleize_tr } - attribute(:publishing_house) { object[:yayin_evi].titleize_tr } - attribute(:publishing_language_id) { object[:yayin_dili].safe_to_i } - attribute(:publishing_language_name) { object[:yayin_dili_adi].titleize_tr } - attribute(:type_id) { object[:editorluk_tur].safe_to_i } - attribute(:type_name) { object[:editorluk_tur_ad].titleize_tr } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:editor_duty_id) { object[:editor_gorev].safe_to_i } - attribute(:editor_duty_name) { object[:editor_gorev_ad].titleize_tr } - attribute(:authors) { object[:yazar_adi] && object[:yazar_adi].split(',').map(&:strip).map(&:titleize_tr) } - attribute(:number_of_author) { object[:yazar_sayisi].safe_to_i } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:index_id) { object[:endeks_id].safe_to_i } - attribute(:index) { object[:endeks] } - attribute(:year) { object[:yil].safe_to_i } - attribute(:date_of_start) { object[:bas_tarih] && Date.parse(object[:bas_tarih]) } - attribute(:date_of_end) { object[:bit_tarih] && Date.parse(object[:bit_tarih]) } - attribute(:doi) { object[:doi].safe_to_i } - attribute(:issn) { object[:issn].safe_to_i } - attribute(:access_type_id) { object[:erisim_turu].safe_to_i } - attribute(:access_type_name) { object[:erisim_turu_ad].titleize_tr } - attribute(:access_link) { object[:erisim_linki] } - attribute(:citations_number) { object[:atif_sayisi].safe_to_i } - attribute(:field) { object[:alan_bilgisi].titleize_tr } - attribute(:keywords) { object[:anahtar_kelime].titleize_tr } - attribute(:author_id) { object[:yazar_id].safe_to_i } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:publishing_id) { integer object[:yayin_id] } + attribute(:publishing_name) { string object[:yayin_adi] } + attribute(:publishing_house) { string object[:yayin_evi] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi] } + attribute(:type_id) { integer object[:editorluk_tur] } + attribute(:type_name) { string object[:editorluk_tur_ad] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:editor_duty_id) { integer object[:editor_gorev] } + attribute(:editor_duty_name) { string object[:editor_gorev_ad] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:city) { string object[:sehir] } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:index) { string object[:endeks] } + attribute(:year) { integer object[:yil] } + attribute(:date_of_start) { parse_date object[:bas_tarih] } + attribute(:date_of_end) { parse_date object[:bit_tarih] } + attribute(:doi) { integer object[:doi] } + attribute(:issn) { integer object[:issn] } + attribute(:access_type_id) { integer object[:erisim_turu] } + attribute(:access_type_name) { string object[:erisim_turu_ad] } + attribute(:access_link) { string object[:erisim_linki], titleize_turkish: false } + attribute(:citations_number) { integer object[:atif_sayisi] } + attribute(:field) { string object[:alan_bilgisi] } + attribute(:keywords) { string object[:anahtar_kelime] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/education_informations_serializer.rb b/app/serializers/yoksis/resumes/education_informations_serializer.rb index 029b59d6..7296a41e 100644 --- a/app/serializers/yoksis/resumes/education_informations_serializer.rb +++ b/app/serializers/yoksis/resumes/education_informations_serializer.rb @@ -3,39 +3,39 @@ module Yoksis module Resumes class EducationInformationsSerializer < Serializer - attribute(:registry_id) { object[:id].safe_to_i } - attribute(:place_id) { object[:yer_id].safe_to_i } - attribute(:place_name) { object[:yer_ad].titleize_tr } - attribute(:year_of_start) { object[:bastar1].safe_to_i } - attribute(:year_of_end) { object[:bittar1].safe_to_i } - attribute(:country_id) { object[:ulke_id].safe_to_i } - attribute(:country_name) { object[:ulke_ad].titleize_tr } - attribute(:other_field) { object[:diger_alan].titleize_tr } - attribute(:yok_unit_id) { object[:birim_yok].safe_to_i } - attribute(:program_id) { object[:program_id].safe_to_i } - attribute(:program_name) { object[:program_adi].titleize_tr } - attribute(:other_university) { object[:diger_universite].titleize_tr } - attribute(:thesis_name) { object[:tez_adi].titleize_tr } - attribute(:thesis_step_id) { object[:tez_asamasi].safe_to_i } - attribute(:thesis_step_name) { object[:tez_asamasi_ad].titleize_tr } - attribute(:start_date_of_thesis) { object[:tez_bas_tar].safe_to_i } - attribute(:end_date_of_thesis) { object[:tez_bit_tar].safe_to_i } - attribute(:university_id) { object[:univ_id].safe_to_i } - attribute(:university_name) { object[:unv_birim_adi].titleize_tr } - attribute(:academic_unit_id) { object[:akademik_birim_id].safe_to_i } - attribute(:academic_unit_name) { object[:akademik_birim_adi].titleize_tr } - attribute(:faculty) { object[:fakultebilgisi].titleize_tr } - attribute(:department) { object[:bolumbilgisi].titleize_tr } - attribute(:field) { object[:alanbilgisi].titleize_tr } - attribute(:diploma_no) { object[:diploma_no].safe_to_i } - attribute(:number_of_diploma_equivalency) { object[:diplomadenklik_tarih_sayi].safe_to_i } - attribute(:advisors_id_number) { object[:danisman_tc].safe_to_i } - attribute(:advisor) { object[:danisman_ad_soyad].titleize_tr } - attribute(:c_unit_id) { object[:c_birim_id].safe_to_i } - attribute(:c_unit_name) { object[:c_birim_ad].safe_to_i } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } + attribute(:registry_id) { integer object[:id] } + attribute(:place_id) { integer object[:yer_id] } + attribute(:place_name) { string object[:yer_ad] } + attribute(:year_of_start) { integer object[:bastar1] } + attribute(:year_of_end) { integer object[:bittar1] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:other_field) { string object[:diger_alan] } + attribute(:yok_unit_id) { integer object[:birim_yok] } + attribute(:program_id) { integer object[:program_id] } + attribute(:program_name) { string object[:program_adi] } + attribute(:other_university) { string object[:diger_universite] } + attribute(:thesis_name) { string object[:tez_adi] } + attribute(:thesis_step_id) { integer object[:tez_asamasi] } + attribute(:thesis_step_name) { string object[:tez_asamasi_ad] } + attribute(:start_date_of_thesis) { integer object[:tez_bas_tar] } + attribute(:end_date_of_thesis) { integer object[:tez_bit_tar] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:unv_birim_adi] } + attribute(:academic_unit_id) { integer object[:akademik_birim_id] } + attribute(:academic_unit_name) { string object[:akademik_birim_adi] } + attribute(:faculty) { string object[:fakultebilgisi] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:field) { string object[:alanbilgisi] } + attribute(:diploma_no) { integer object[:diploma_no] } + attribute(:number_of_diploma_equivalency) { integer object[:diplomadenklik_tarih_sayi] } + attribute(:advisors_id_number) { integer object[:danisman_tc] } + attribute(:advisor) { string object[:danisman_ad_soyad] } + attribute(:c_unit_id) { integer object[:c_birim_id] } + attribute(:c_unit_name) { integer object[:c_birim_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/fields_serializer.rb b/app/serializers/yoksis/resumes/fields_serializer.rb index 71924246..108ca12a 100644 --- a/app/serializers/yoksis/resumes/fields_serializer.rb +++ b/app/serializers/yoksis/resumes/fields_serializer.rb @@ -3,20 +3,20 @@ module Yoksis module Resumes class FieldsSerializer < Serializer - attribute(:registry_id) { object[:t_uak_id].safe_to_i } - attribute(:field_id) { object[:temel_alan_id].safe_to_i } - attribute(:field_name) { object[:temel_alan_ad].titleize_tr } - attribute(:scientific_field_id) { object[:bilim_alan_id].safe_to_i } - attribute(:scientific_field_name) { object[:bilim_alan_ad].titleize_tr } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:t_uak_id] } + attribute(:field_id) { integer object[:temel_alan_id] } + attribute(:field_name) { string object[:temel_alan_ad] } + attribute(:scientific_field_id) { integer object[:bilim_alan_id] } + attribute(:scientific_field_name) { string object[:bilim_alan_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } attribute :keywords do [ - { id: object[:anahtarkelime1_id].safe_to_i, name: object[:anahtarkelime1_ad].titleize_tr }, - { id: object[:anahtarkelime2_id].safe_to_i, name: object[:anahtarkelime2_ad].titleize_tr }, - { id: object[:anahtarkelime3_id].safe_to_i, name: object[:anahtarkelime3_ad].titleize_tr } + { id: integer(object[:anahtarkelime1_id]), name: string(object[:anahtarkelime1_ad]) }, + { id: integer(object[:anahtarkelime2_id]), name: string(object[:anahtarkelime2_ad]) }, + { id: integer(object[:anahtarkelime3_id]), name: string(object[:anahtarkelime3_ad]) } ] end end diff --git a/app/serializers/yoksis/resumes/foreign_languages_serializer.rb b/app/serializers/yoksis/resumes/foreign_languages_serializer.rb index 709c0b73..dd0ef800 100644 --- a/app/serializers/yoksis/resumes/foreign_languages_serializer.rb +++ b/app/serializers/yoksis/resumes/foreign_languages_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class ForeignLanguagesSerializer < Serializer - attribute(:registry_id) { object[:y_id].safe_to_i } - attribute(:language_id) { object[:dil_id].safe_to_i } - attribute(:language_name) { object[:dil_ad].titleize_tr } - attribute(:language_testing_id) { object[:dil_sinav_id].safe_to_i } - attribute(:language_testing_name) { object[:dil_sinav_ad].upcase_tr } - attribute(:language_testing_point) { object[:puan].safe_to_i } - attribute(:equivalent_point) { object[:esdegerpuan].safe_to_i } - attribute(:year) { object[:yil].safe_to_i } - attribute(:term_id) { object[:donem_id].safe_to_i } - attribute(:term_name) { object[:donem_ad].titleize_tr } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:y_id] } + attribute(:language_id) { integer object[:dil_id] } + attribute(:language_name) { string object[:dil_ad] } + attribute(:language_testing_id) { integer object[:dil_sinav_id] } + attribute(:language_testing_name) { string object[:dil_sinav_ad], ->(p) { p.upcase :turkic } } + attribute(:language_testing_point) { integer object[:puan] } + attribute(:equivalent_point) { integer object[:esdegerpuan] } + attribute(:year) { integer object[:yil] } + attribute(:term_id) { integer object[:donem_id] } + attribute(:term_name) { string object[:donem_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb b/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb index fb07a3e0..658dcf01 100644 --- a/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb +++ b/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb @@ -3,13 +3,13 @@ module Yoksis module Resumes class IncentiveActivityDeclarationsSerializer < Serializer - attribute(:registry_id) { object[:fb_id].safe_to_i } - attribute(:type_id) { object[:tur].safe_to_i } - attribute(:type_name) { object[:tur_ad].titleize_tr } - attribute(:work_id) { object[:eser_id].safe_to_i } - attribute(:work_type_id) { object[:eser_tur].safe_to_i } - attribute(:work_type_name) { object[:eser_tur_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:registry_id) { integer object[:fb_id] } + attribute(:type_id) { integer object[:tur] } + attribute(:type_name) { string object[:tur_ad] } + attribute(:work_id) { integer object[:eser_id] } + attribute(:work_type_id) { integer object[:eser_tur] } + attribute(:work_type_name) { string object[:eser_tur_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/incentive_applications_serializer.rb b/app/serializers/yoksis/resumes/incentive_applications_serializer.rb index 4c412244..3b02955e 100644 --- a/app/serializers/yoksis/resumes/incentive_applications_serializer.rb +++ b/app/serializers/yoksis/resumes/incentive_applications_serializer.rb @@ -3,11 +3,11 @@ module Yoksis module Resumes class IncentiveApplicationsSerializer < Serializer - attribute(:application_id) { object[:basvuru_id].safe_to_i } - attribute(:term_id) { object[:donem_id].safe_to_i } - attribute(:term_name) { object[:donem_ad].titleize_tr } - attribute(:date_of_application) { object[:basvuru_tarihi] && Date.parse(object[:basvuru_tarihi]) } - attribute(:date_of_final_application) { object[:son_islem_tarihi] && Date.parse(object[:son_islem_tarihi]) } + attribute(:application_id) { integer object[:basvuru_id] } + attribute(:term_id) { integer object[:donem_id] } + attribute(:term_name) { string object[:donem_ad] } + attribute(:date_of_application) { parse_date object[:basvuru_tarihi] } + attribute(:date_of_final_application) { parse_date object[:son_islem_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/lectures_serializer.rb b/app/serializers/yoksis/resumes/lectures_serializer.rb index c3d31b1a..63e83749 100644 --- a/app/serializers/yoksis/resumes/lectures_serializer.rb +++ b/app/serializers/yoksis/resumes/lectures_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class LecturesSerializer < Serializer - attribute(:lecture_id) { object[:ders_id].safe_to_i } - attribute(:lecture_name) { object[:ders_adi].titleize_tr } - attribute(:education_level_id) { object[:ogrenim_id].safe_to_i } - attribute(:education_level_name) { object[:ogrenim_adi].titleize_tr } - attribute(:academic_term_id) { object[:akademik_yil_id].safe_to_i } - attribute(:academic_term) { object[:akademik_yil] } - attribute(:language_id) { object[:dil_id].safe_to_i } - attribute(:language_name) { object[:dil_adi].titleize_tr } - attribute(:weekly_course_hours) { object[:ders_saati].safe_to_i } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:date_of_insert) { object[:ekleme_tarihi] && Time.zone.parse(object[:ekleme_tarihi]) } + attribute(:lecture_id) { integer object[:ders_id] } + attribute(:lecture_name) { string object[:ders_adi] } + attribute(:education_level_id) { integer object[:ogrenim_id] } + attribute(:education_level_name) { string object[:ogrenim_adi] } + attribute(:academic_term_id) { integer object[:akademik_yil_id] } + attribute(:academic_term) { integer object[:akademik_yil] } + attribute(:language_id) { integer object[:dil_id] } + attribute(:language_name) { string object[:dil_adi] } + attribute(:weekly_course_hours) { integer object[:ders_saati] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:date_of_insert) { parse_datetime object[:ekleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/memberships_serializer.rb b/app/serializers/yoksis/resumes/memberships_serializer.rb index abca7ebb..65468578 100644 --- a/app/serializers/yoksis/resumes/memberships_serializer.rb +++ b/app/serializers/yoksis/resumes/memberships_serializer.rb @@ -3,17 +3,17 @@ module Yoksis module Resumes class MembershipsSerializer < Serializer - attribute(:membership_id) { object[:uyelik_id].safe_to_i } - attribute(:membership_status_id) { object[:uyelik_durumu].safe_to_i } - attribute(:membership_status_name) { object[:uyelik_durumu_ad].titleize_tr } - attribute(:institution_name) { object[:kurulus_adi].titleize_tr } - attribute(:institution_type_id) { object[:kurulus_turu].safe_to_i } - attribute(:institution_type_name) { object[:kurulus_turu_ad].titleize_tr } - attribute(:year_of_start) { object[:bas_tar].safe_to_i } - attribute(:year_of_end) { object[:bit_tar].safe_to_i } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:membership_id) { integer object[:uyelik_id] } + attribute(:membership_status_id) { integer object[:uyelik_durumu] } + attribute(:membership_status_name) { string object[:uyelik_durumu_ad] } + attribute(:institution_name) { string object[:kurulus_adi] } + attribute(:institution_type_id) { integer object[:kurulus_turu] } + attribute(:institution_type_name) { string object[:kurulus_turu_ad] } + attribute(:year_of_start) { integer object[:bas_tar] } + attribute(:year_of_end) { integer object[:bit_tar] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/other_experiences_serializer.rb b/app/serializers/yoksis/resumes/other_experiences_serializer.rb index 88493541..34459d5f 100644 --- a/app/serializers/yoksis/resumes/other_experiences_serializer.rb +++ b/app/serializers/yoksis/resumes/other_experiences_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class OtherExperiencesSerializer < Serializer - attribute(:experience_id) { object[:deneyim_id].titleize_tr } - attribute(:university_id) { object[:kurulus_id].safe_to_i } - attribute(:university_name) { object[:kurulus_adi].titleize_tr } - attribute(:duty_name) { object[:gorev_adi].titleize_tr } - attribute(:year_of_start) { object[:bas_tar].safe_to_i } - attribute(:year_of_end) { object[:bit_tar].safe_to_i } - attribute(:job_description) { object[:is_tanimi].titleize_tr } - attribute(:workplace_type_id) { object[:isyeri_tur_id].safe_to_i } - attribute(:workplace_type_name) { object[:isyeri_tur_ad].titleize_tr } - attribute(:position_type) { object[:calisma_durumu].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } + attribute(:experience_id) { string object[:deneyim_id] } + attribute(:university_id) { integer object[:kurulus_id] } + attribute(:university_name) { string object[:kurulus_adi] } + attribute(:duty_name) { string object[:gorev_adi] } + attribute(:year_of_start) { integer object[:bas_tar] } + attribute(:year_of_end) { integer object[:bit_tar] } + attribute(:job_description) { string object[:is_tanimi] } + attribute(:workplace_type_id) { integer object[:isyeri_tur_id] } + attribute(:workplace_type_name) { string object[:isyeri_tur_ad] } + attribute(:position_type) { string object[:calisma_durumu] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/papers_serializer.rb b/app/serializers/yoksis/resumes/papers_serializer.rb index 585e7fe3..3110d7d7 100644 --- a/app/serializers/yoksis/resumes/papers_serializer.rb +++ b/app/serializers/yoksis/resumes/papers_serializer.rb @@ -3,44 +3,44 @@ module Yoksis module Resumes class PapersSerializer < Serializer - attribute(:publishing_id) { object[:yayin_id].safe_to_i } - attribute(:publishing_language_id) { object[:yayin_dili].safe_to_i } - attribute(:publishing_language_name) { object[:yayin_dili_adi].titleize_tr } - attribute(:publishing_status_id) { object[:yayin_durumu].safe_to_i } - attribute(:publishing_status_name) { object[:yayin_durumu_ad].titleize_tr } - attribute(:presentation_type_id) { object[:bildiri_sunum_turu].safe_to_i } - attribute(:presentation_type_name) { object[:bildiri_sunum_turu_ad].titleize_tr } - attribute(:name) { object[:bildiri_adi] } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad] } - attribute(:type_id) { object[:bildiri_tur_id].safe_to_i } - attribute(:type_name) { object[:bildiri_tur].titleize_tr } - attribute(:author_id) { object[:yazar_id].safe_to_i } - attribute(:number_of_author) { object[:yazar_sayisi].safe_to_i } - attribute(:authors) { object[:yazar_adi] && object[:yazar_adi].split(',').map(&:strip).map(&:titleize_tr) } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:date_of_release) { object[:basim_tarihi] && Date.parse(object[:basim_tarihi]) } - attribute(:release_type_id) { object[:basim_turu].safe_to_i } - attribute(:release_type_name) { object[:basim_turu_ad].titleize_tr } - attribute(:volume) { object[:cilt].safe_to_i } - attribute(:issue) { object[:sayi].safe_to_i } - attribute(:first_page) { object[:ilk_sayfa].safe_to_i } - attribute(:last_page) { object[:son_sayfa].safe_to_i } - attribute(:doi) { object[:doi].safe_to_i } - attribute(:issn) { object[:issn].safe_to_i } - attribute(:print_isbn) { object[:print_isbn].safe_to_i } - attribute(:access_link) { object[:access_link] } - attribute(:number_of_citation) { object[:atif_sayisi].safe_to_i } - attribute(:field) { object[:alan_bilgisi].titleize_tr } - attribute(:keywords) { object[:anahtar_kelime].titleize_tr } - attribute(:special_edition_id) { object[:ozel_sayi].safe_to_i } - attribute(:special_edition_name) { object[:ozel_sayi_ad].titleize_tr } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:publishing_id) { integer object[:yayin_id] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi] } + attribute(:publishing_status_id) { integer object[:yayin_durumu] } + attribute(:publishing_status_name) { string object[:yayin_durumu_ad] } + attribute(:presentation_type_id) { integer object[:bildiri_sunum_turu] } + attribute(:presentation_type_name) { string object[:bildiri_sunum_turu_ad] } + attribute(:name) { string object[:bildiri_adi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:type_id) { integer object[:bildiri_tur_id] } + attribute(:type_name) { string object[:bildiri_tur] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:date_of_release) { parse_date object[:basim_tarihi] } + attribute(:release_type_id) { integer object[:basim_turu] } + attribute(:release_type_name) { string object[:basim_turu_ad] } + attribute(:volume) { integer object[:cilt] } + attribute(:issue) { integer object[:sayi] } + attribute(:first_page) { integer object[:ilk_sayfa] } + attribute(:last_page) { integer object[:son_sayfa] } + attribute(:doi) { integer object[:doi] } + attribute(:issn) { integer object[:issn] } + attribute(:print_isbn) { integer object[:print_isbn] } + attribute(:access_link) { string object[:access_link], titleize_turkish: false } + attribute(:number_of_citation) { integer object[:atif_sayisi] } + attribute(:field) { string object[:alan_bilgisi] } + attribute(:keywords) { string object[:anahtar_kelime] } + attribute(:special_edition_id) { integer object[:ozel_sayi] } + attribute(:special_edition_name) { string object[:ozel_sayi_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/patents_serializer.rb b/app/serializers/yoksis/resumes/patents_serializer.rb index 6ca3daef..920485ae 100644 --- a/app/serializers/yoksis/resumes/patents_serializer.rb +++ b/app/serializers/yoksis/resumes/patents_serializer.rb @@ -3,28 +3,28 @@ module Yoksis module Resumes class PatentsSerializer < Serializer - attribute(:patent_id) { object[:patent_id].safe_to_i } - attribute(:name) { object[:patent_adi].titleize_tr } - attribute(:no) { object[:patent_no].safe_to_i } - attribute(:class) { object[:patent_sinif].upcase_tr } - attribute(:year) { object[:patent_tarihi].safe_to_i } - attribute(:applicants) { object[:basvuru_sahipleri].upcase_tr } - attribute(:inventors) { object[:bulus_sahipleri].upcase_tr } - attribute(:number_of_person) { object[:kisi_sayisi].safe_to_i } - attribute(:category_id) { object[:kategori_id].safe_to_i } - attribute(:category_name) { object[:kategori].titleize_tr } - attribute(:file_type_id) { object[:dosya_tipi_id].safe_to_i } - attribute(:file_type_name) { object[:dosya_tipi].titleize_tr } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam].titleize_tr } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad].titleize_tr } - attribute(:institution_id) { object[:kurum_id].safe_to_i } - attribute(:institution_name) { object[:kurum_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } + attribute(:patent_id) { integer object[:patent_id] } + attribute(:name) { string object[:patent_adi] } + attribute(:no) { integer object[:patent_no] } + attribute(:class) { string object[:patent_sinif], ->(p) { p.upcase :turkic } } + attribute(:year) { integer object[:patent_tarihi] } + attribute(:applicants) { split_string object[:basvuru_sahipleri] } + attribute(:inventors) { split_string object[:bulus_sahipleri] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:category_id) { integer object[:kategori_id] } + attribute(:category_name) { string object[:kategori] } + attribute(:file_type_id) { integer object[:dosya_tipi_id] } + attribute(:file_type_name) { string object[:dosya_tipi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/projects_serializer.rb b/app/serializers/yoksis/resumes/projects_serializer.rb index 727ffb52..03210f8e 100644 --- a/app/serializers/yoksis/resumes/projects_serializer.rb +++ b/app/serializers/yoksis/resumes/projects_serializer.rb @@ -3,38 +3,42 @@ module Yoksis module Resumes class ProjectsSerializer < Serializer - attribute(:project_id) { object[:proje_id].safe_to_i } - attribute(:name) { object[:proje_ad].titleize_tr } - attribute(:subject) { object[:proje_konusu].titleize_tr } - attribute(:status_id) { object[:proje_durumu_id].safe_to_i } - attribute(:status_name) { object[:proje_durumu_ad].titleize_tr } - attribute(:budget) { object[:butce].safe_to_i } - attribute(:location_id) { object[:proje_konumu_id].safe_to_i } - attribute(:location_name) { object[:proje_konumu_ad].titleize_tr } - attribute(:type_id) { object[:proje_turu_id].safe_to_i } - attribute(:type_name) { object[:proje_turu_ad].titleize_tr } - attribute(:currency_id) { object[:para_birimi_id].safe_to_i } - attribute(:currency_name) { object[:para_birimi_ad].titleize_tr } - attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad].titleize_tr } - attribute(:institution_id) { object[:kurum_id].safe_to_i } - attribute(:institution_name) { object[:kurum_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:project_id) { integer object[:proje_id] } + attribute(:name) { string object[:proje_ad] } + attribute(:subject) { string object[:proje_konusu] } + attribute(:status_id) { integer object[:proje_durumu_id] } + attribute(:status_name) { string object[:proje_durumu_ad] } + attribute(:budget) { integer object[:butce] } + attribute(:location_id) { integer object[:proje_konumu_id] } + attribute(:location_name) { string object[:proje_konumu_ad] } + attribute(:type_id) { integer object[:proje_turu_id] } + attribute(:type_name) { string object[:proje_turu_ad] } + attribute(:currency_id) { integer object[:para_birimi_id] } + attribute(:currency_name) { string object[:para_birimi_ad] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:institution_id) { integer object[:kurum_id] } + attribute(:institution_name) { string object[:kurum_ad] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } attribute :date_of_start do next unless object[:bas_tar] - build_date(*object[:bas_tar].split('.').reverse.collect(&:safe_to_i)) + + year, month, day = object[:bas_tar].split('.').reverse + build_date year, month, day end attribute :date_of_end do next unless object[:bit_tar] - build_date(*object[:bit_tar].split('.').reverse.collect(&:safe_to_i)) + + year, month, day = object[:bit_tar].split('.').reverse + build_date year, month, day end end end diff --git a/app/serializers/yoksis/resumes/refereeing_serializer.rb b/app/serializers/yoksis/resumes/refereeing_serializer.rb index ceff631c..49f30b52 100644 --- a/app/serializers/yoksis/resumes/refereeing_serializer.rb +++ b/app/serializers/yoksis/resumes/refereeing_serializer.rb @@ -3,27 +3,27 @@ module Yoksis module Resumes class RefereeingSerializer < Serializer - attribute(:publishing_id) { object[:yayin_id].safe_to_i } - attribute(:publishing_place) { object[:yayin_yeri].titleize_tr } - attribute(:publishing_language_id) { object[:yayin_dili].safe_to_i } - attribute(:publishing_language_name) { object[:yayin_dili_adi].titleize_tr } - attribute(:type_id) { object[:hakemlik_turu].safe_to_i } - attribute(:type_name) { object[:hakemlik_turu_ad].titleize_tr } - attribute(:number_of_refereeing) { object[:hakemlik_sayisi].safe_to_i } - attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad].titleize_tr } - attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi].titleize_tr } - attribute(:city) { object[:sehir].titleize_tr } - attribute(:index_id) { object[:endeks_id].safe_to_i } - attribute(:index) { object[:endeks] } - attribute(:year) { object[:yil].safe_to_i } - attribute(:field) { object[:alan_bilgisi].titleize_tr } - attribute(:keywords) { object[:anahtar_kelime].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } + attribute(:publishing_id) { integer object[:yayin_id] } + attribute(:publishing_place) { string object[:yayin_yeri] } + attribute(:publishing_language_id) { integer object[:yayin_dili] } + attribute(:publishing_language_name) { string object[:yayin_dili_adi] } + attribute(:type_id) { integer object[:hakemlik_turu] } + attribute(:type_name) { string object[:hakemlik_turu_ad] } + attribute(:number_of_refereeing) { integer object[:hakemlik_sayisi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:city) { string object[:sehir] } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:index) { string object[:endeks], titleize_turkish: false } + attribute(:year) { integer object[:yil] } + attribute(:field) { string object[:alan_bilgisi] } + attribute(:keywords) { string object[:anahtar_kelime] } + attribute(:active_or_passive_id) { integer object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:incentive_points) { float object[:tesv_puan] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb b/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb index dc158f75..f7b94363 100644 --- a/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb +++ b/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb @@ -3,23 +3,23 @@ module Yoksis module Resumes class ThesisAdvisorsSerializer < Serializer - attribute(:data_source) { object[:verikaynak].titleize_tr } - attribute(:name) { object[:tez_adi].titleize_tr } - attribute(:type_id) { object[:tur_id].safe_to_i } - attribute(:type_name) { object[:tur_adi].titleize_tr } - attribute(:place_id) { object[:yer_id].safe_to_i } - attribute(:place_name) { object[:yer_adi].titleize_tr } - attribute(:country) { object[:ulke].titleize_tr } - attribute(:year) { object[:yil].safe_to_i } - attribute(:registry_id) { object[:kayit_id].safe_to_i } - attribute(:status) { object[:durum_adi].titleize_tr } - attribute(:author) { "#{object[:yazar_adi]} #{object[:yazar_soyadi]}".titleize_tr } - attribute(:university) { object[:universite_ad].titleize_tr } - attribute(:major) { object[:abd_ad].titleize_tr } - attribute(:institution) { object[:enstitu_ad].titleize_tr } - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } + attribute(:data_source) { string object[:verikaynak] } + attribute(:name) { string object[:tez_adi] } + attribute(:type_id) { integer object[:tur_id] } + attribute(:type_name) { string object[:tur_adi] } + attribute(:place_id) { integer object[:yer_id] } + attribute(:place_name) { string object[:yer_adi] } + attribute(:country) { string object[:ulke] } + attribute(:year) { integer object[:yil] } + attribute(:registry_id) { integer object[:kayit_id] } + attribute(:status) { string object[:durum_adi] } + attribute(:author) { string "#{object[:yazar_adi]} #{object[:yazar_soyadi]}" } + attribute(:university) { string object[:universite_ad] } + attribute(:major) { string object[:abd_ad] } + attribute(:institution) { string object[:enstitu_ad] } + attribute(:active_or_passive_id) { float object[:aktif_pasif] } + attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/staff/academicians_serializer.rb b/app/serializers/yoksis/staff/academicians_serializer.rb index bcdf17f5..d2afdf6b 100644 --- a/app/serializers/yoksis/staff/academicians_serializer.rb +++ b/app/serializers/yoksis/staff/academicians_serializer.rb @@ -3,11 +3,11 @@ module Yoksis module Staff class AcademiciansSerializer < Serializer - attribute(:id_number) { object[:tc_kimlik_no].safe_to_i } - attribute(:first_name) { object[:adi].titleize_tr } - attribute(:last_name) { object[:soyadi].titleize_tr } - attribute(:title) { object[:kadro_unvan].titleize_tr } - attribute(:unit_id) { object[:birim_id].safe_to_i } + attribute(:id_number) { integer object[:tc_kimlik_no] } + attribute(:first_name) { string object[:adi] } + attribute(:last_name) { string object[:soyadi] } + attribute(:title) { string object[:kadro_unvan] } + attribute(:unit_id) { integer object[:birim_id] } end end end diff --git a/app/serializers/yoksis/staff/nationalities_serializer.rb b/app/serializers/yoksis/staff/nationalities_serializer.rb index b14b919a..dc553c1c 100644 --- a/app/serializers/yoksis/staff/nationalities_serializer.rb +++ b/app/serializers/yoksis/staff/nationalities_serializer.rb @@ -3,8 +3,8 @@ module Yoksis module Staff class NationalitiesSerializer < Serializer - attribute(:code) { object[:kod].safe_to_i } - attribute(:name) { object[:ad].titleize_tr } + attribute(:code) { integer object[:kod] } + attribute(:name) { string object[:ad] } end end end diff --git a/app/serializers/yoksis/students/informations_serializer.rb b/app/serializers/yoksis/students/informations_serializer.rb index 96e758f4..7abd3a6a 100644 --- a/app/serializers/yoksis/students/informations_serializer.rb +++ b/app/serializers/yoksis/students/informations_serializer.rb @@ -8,19 +8,19 @@ class InformationsSerializer < Serializer next unless informations[:tc_kimlik_no] { - id_number: informations[:tc_kimlik_no].safe_to_i, - first_name: informations[:adi].titleize_tr, - last_name: informations[:soyadi].titleize_tr, - fathers_name: informations[:baba_adi].titleize_tr, - mothers_name: informations[:anne_adi].titleize_tr, - date_of_birth: informations[:dogum_tarihi] && build_date(*informations[:dogum_tarihi].values_at(:yil, :ay, :gun)), + id_number: integer(informations[:tc_kimlik_no]), + first_name: string(informations[:adi]), + last_name: string(informations[:soyadi]), + fathers_name: string(informations[:baba_adi]), + mothers_name: string(informations[:anne_adi]), + date_of_birth: build_date(*informations[:dogum_tarihi].values_at(:yil, :ay, :gun)), nationality: { - code: informations.dig(:uyrugu, :kod).safe_to_i, - name: informations.dig(:uyrugu, :ad).titleize_tr + code: integer(informations.dig(:uyrugu, :kod)), + name: string(informations.dig(:uyrugu, :ad)) }, gender: { - code: informations.dig(:cinsiyeti, :kod).safe_to_i, - name: informations.dig(:cinsiyeti, :ad).titleize_tr + code: integer(informations.dig(:cinsiyeti, :kod)), + name: string(informations.dig(:cinsiyeti, :ad)) } } end @@ -30,51 +30,51 @@ class InformationsSerializer < Serializer next unless informations[:kayit_tarihi] { - student_number: informations[:ogrenci_no].safe_to_i, - entrance_point: informations[:giris_puani].safe_to_i, - current_term: informations[:aktif_donem_no].safe_to_i, - ects: informations[:akts].safe_to_f, - prep_term: informations[:kac_donem_hazirlik].safe_to_i, - registration_date: informations[:kayit_tarihi] && build_time(*informations[:kayit_tarihi].values_at(:yil, :ay, :gun, :saat, :dakika, :saniye)), + student_number: integer(informations[:ogrenci_no]), + entrance_point: float(informations[:giris_puani]), + current_term: integer(informations[:aktif_donem_no]), + ects: float(informations[:akts]), + prep_term: integer(informations[:kac_donem_hazirlik]), + registration_date: build_datetime(*informations[:kayit_tarihi].values_at(:yil, :ay, :gun, :saat, :dakika, :saniye)), prep_class: { - code: informations.dig(:hazirlik_sinifi, :kod).safe_to_i, - name: informations.dig(:hazirlik_sinifi, :ad).titleize_tr + code: integer(informations.dig(:hazirlik_sinifi, :kod)), + name: string(informations.dig(:hazirlik_sinifi, :ad)) }, entrance_point_type: { - code: informations.dig(:giris_puan_turu, :kod).safe_to_i, - name: informations.dig(:giris_puan_turu, :ad).capitalize_tr + code: integer(informations.dig(:giris_puan_turu, :kod)), + name: string(informations.dig(:giris_puan_turu, :ad), ->(p) { p.upcase :turkic }) }, entrance_type: { - code: informations.dig(:giris_turu, :kod).safe_to_i, - name: informations.dig(:giris_turu, :ad).upcase_tr + code: integer(informations.dig(:giris_turu, :kod)), + name: string(informations.dig(:giris_turu, :ad), ->(p) { p.upcase :turkic }) }, rights: { - code: informations.dig(:ogrencilik_hakki_varmi, :kod).safe_to_i, - name: informations.dig(:ogrencilik_hakki_varmi, :ad).titleize_tr + code: integer(informations.dig(:ogrencilik_hakki_varmi, :kod)), + name: string(informations.dig(:ogrencilik_hakki_varmi, :ad)) }, - end_date_of_studentship_right: informations[:ogrencilik_hakki_bitti_tarih] && build_date(*informations[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun)), + end_date_of_studentship_right: build_date(*informations[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun)), status: { - code: informations.dig(:ogrencilik_statusu, :kod).safe_to_i, - name: informations.dig(:ogrencilik_statusu, :ad).titleize_tr + code: integer(informations.dig(:ogrencilik_statusu, :kod)), + name: string(informations.dig(:ogrencilik_statusu, :ad)) }, disability_type: { - code: informations.dig(:engel_turu, :kod).safe_to_i, - name: informations.dig(:engel_turu, :ad).titleize_tr + code: integer(informations.dig(:engel_turu, :kod)), + name: string(informations.dig(:engel_turu, :ad)) }, - disability_rate: informations[:engel_orani].safe_to_i, + disability_rate: integer(informations[:engel_orani]), dropout_type: { - code: informations.dig(:ayrilma_nedeni, :kod).safe_to_i, - name: informations.dig(:ayrilma_nedeni, :ad).titleize_tr + code: integer(informations.dig(:ayrilma_nedeni, :kod)), + name: string(informations.dig(:ayrilma_nedeni, :ad)) }, - dropout_date: informations[:ayrilma_tarihi] && build_date(*informations[:ayrilma_tarihi].values_at(:yil, :ay, :gun)), + dropout_date: build_date(*informations[:ayrilma_tarihi].values_at(:yil, :ay, :gun)), martyrs_relative: { - code: informations.dig(:gazi_sehit_yakini, :kod).safe_to_i, - name: informations.dig(:gazi_sehit_yakini, :ad).titleize_tr + code: integer(informations.dig(:gazi_sehit_yakini, :kod)), + name: string(informations.dig(:gazi_sehit_yakini, :ad)) }, diploma: { - gpa: informations.dig(:diploma, :notu).safe_to_f, - grading_system: informations.dig(:diploma, :not_sistemi).safe_to_f, - no: informations.dig(:diploma, :no).safe_to_i + gpa: float(informations.dig(:diploma, :notu)), + grading_system: float(informations.dig(:diploma, :not_sistemi)), + no: integer(informations.dig(:diploma, :no)) } } end @@ -84,50 +84,50 @@ class InformationsSerializer < Serializer next unless informations.dig(:birim, :kod) { - long_name: informations[:birim_uzun_adi].titleize_tr, - english_name: informations[:birim_adi_ingilizce].titleize, - parent_unit_id: informations[:bagli_oldugu_birim_id].safe_to_i, - period_of_study: informations[:ogrenim_suresi].safe_to_i, - osym_id: informations[:kilavuz_kodu].safe_to_i, + long_name: string(informations[:birim_uzun_adi]), + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false), + parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), + period_of_study: integer(informations[:ogrenim_suresi]), + osym_id: integer(informations[:kilavuz_kodu]), university: { - code: informations.dig(:universite, :kod).safe_to_i, - name: informations.dig(:universite, :ad).titleize_tr + code: integer(informations.dig(:universite, :kod)), + name: string(informations.dig(:universite, :ad)) }, university_type: { - code: informations.dig(:universite_turu, :kod).safe_to_i, - name: informations.dig(:universite_turu, :ad).titleize_tr + code: integer(informations.dig(:universite_turu, :kod)), + name: string(informations.dig(:universite_turu, :ad)) }, unit: { - code: informations.dig(:birim, :kod).safe_to_i, - name: informations.dig(:birim, :ad).titleize_tr + code: integer(informations.dig(:birim, :kod)), + name: string(informations.dig(:birim, :ad)) }, unit_type: { - code: informations.dig(:birim_turu, :kod).safe_to_i, - name: informations.dig(:birim_turu, :ad).titleize_tr + code: integer(informations.dig(:birim_turu, :kod)), + name: string(informations.dig(:birim_turu, :ad)) }, faculty: { - code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr + code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(informations.dig(:fakulte_yo_myo_enstitu, :ad)) }, status: { - code: informations.dig(:aktiflik, :kod).safe_to_i, - name: informations.dig(:aktiflik, :ad).titleize_tr + code: integer(informations.dig(:aktiflik, :kod)), + name: string(informations.dig(:aktiflik, :ad)) }, instruction_language: { - code: informations.dig(:ogrenim_dili, :kod).safe_to_i, - name: informations.dig(:ogrenim_dili, :ad).titleize_tr + code: integer(informations.dig(:ogrenim_dili, :kod)), + name: string(informations.dig(:ogrenim_dili, :ad)) }, instruction_type: { - code: informations.dig(:ogrenim_turu, :kod).safe_to_i, - name: informations.dig(:ogrenim_turu, :ad).titleize_tr + code: integer(informations.dig(:ogrenim_turu, :kod)), + name: string(informations.dig(:ogrenim_turu, :ad)) }, city: { - code: informations.dig(:il, :kod).safe_to_i, - name: informations.dig(:il, :ad).titleize_tr + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) }, district: { - code: informations.dig(:ilce, :kod).safe_to_i, - name: informations.dig(:ilce, :ad).titleize_tr + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) } } end @@ -137,50 +137,50 @@ class InformationsSerializer < Serializer next unless informations.dig(:universite, :kod) { - long_name: informations[:birim_uzun_adi].titleize_tr, - english_name: informations[:birim_adi_ingilizce].titleize, - parent_unit_id: informations[:bagli_oldugu_birim_id].safe_to_i, - period_of_study: informations[:ogrenim_suresi].safe_to_i, - osym_id: informations[:kilavuz_kodu].safe_to_i, + long_name: string(informations[:birim_uzun_adi]), + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false), + parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), + period_of_study: integer(informations[:ogrenim_suresi]), + osym_id: integer(informations[:kilavuz_kodu]), university: { - code: informations.dig(:universite, :kod).safe_to_i, - name: informations.dig(:universite, :ad).titleize_tr + code: integer(informations.dig(:universite, :kod)), + name: string(informations.dig(:universite, :ad)) }, university_type: { - code: informations.dig(:universite_turu, :kod).safe_to_i, - name: informations.dig(:universite_turu, :ad).titleize_tr + code: integer(informations.dig(:universite_turu, :kod)), + name: string(informations.dig(:universite_turu, :ad)) }, unit: { - code: informations.dig(:birim, :kod).safe_to_i, - name: informations.dig(:birim, :ad).titleize_tr + code: integer(informations.dig(:birim, :kod)), + name: string(informations.dig(:birim, :ad)) }, unit_type: { - code: informations.dig(:birim_turu, :kod).safe_to_i, - name: informations.dig(:birim_turu, :ad).titleize_tr + code: integer(informations.dig(:birim_turu, :kod)), + name: string(informations.dig(:birim_turu, :ad)) }, faculty: { - code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr + code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(informations.dig(:fakulte_yo_myo_enstitu, :ad)) }, status: { - code: informations.dig(:aktiflik, :kod).safe_to_i, - name: informations.dig(:aktiflik, :ad).titleize_tr + code: integer(informations.dig(:aktiflik, :kod)), + name: string(informations.dig(:aktiflik, :ad)) }, instruction_language: { - code: informations.dig(:ogrenim_dili, :kod).safe_to_i, - name: informations.dig(:ogrenim_dili, :ad).titleize_tr + code: integer(informations.dig(:ogrenim_dili, :kod)), + name: string(informations.dig(:ogrenim_dili, :ad)) }, instruction_type: { - code: informations.dig(:ogrenim_turu, :kod).safe_to_i, - name: informations.dig(:ogrenim_turu, :ad).titleize_tr + code: integer(informations.dig(:ogrenim_turu, :kod)), + name: string(informations.dig(:ogrenim_turu, :ad)) }, city: { - code: informations.dig(:il, :kod).safe_to_i, - name: informations.dig(:il, :ad).titleize_tr + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) }, district: { - code: informations.dig(:ilce, :kod).safe_to_i, - name: informations.dig(:ilce, :ad).titleize_tr + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) } } end diff --git a/app/serializers/yoksis/units/changes_serializer.rb b/app/serializers/yoksis/units/changes_serializer.rb index 452c3045..d4adfbca 100644 --- a/app/serializers/yoksis/units/changes_serializer.rb +++ b/app/serializers/yoksis/units/changes_serializer.rb @@ -3,29 +3,29 @@ module Yoksis module Units class ChangesSerializer < Serializer - attribute(:unit_id) { object[:birim_id].safe_to_i } - attribute(:unit_name) { object[:birim_adi].titleize_tr } - attribute(:parent_unit_id) { object[:bagli_oldugu_birim_id].safe_to_i } - attribute(:date_of_update) { object[:degisiklik_tarihi] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:unit_name) { string object[:birim_adi] } + attribute(:parent_unit_id) { string object[:bagli_oldugu_birim_id] } + attribute(:date_of_update) { parse_datetime object[:degisiklik_tarihi] } attribute :unit_type do { - code: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad).titleize_tr + code: integer(object.dig(:birim_turu, :kod)), + name: string(object.dig(:birim_turu, :ad)) } end attribute :status do { - code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad).titleize_tr + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) } end attribute :change_type do { - code: object.dig(:degisiklik_turu, :kod).safe_to_i, - name: object.dig(:degisiklik_turu, :ad).titleize_tr + code: integer(object.dig(:degisiklik_turu, :kod)), + name: string(object.dig(:degisiklik_turu, :ad)) } end end diff --git a/app/serializers/yoksis/units/units_serializer.rb b/app/serializers/yoksis/units/units_serializer.rb index d5d558ff..ab64f15a 100644 --- a/app/serializers/yoksis/units/units_serializer.rb +++ b/app/serializers/yoksis/units/units_serializer.rb @@ -3,79 +3,79 @@ module Yoksis module Units class UnitsSerializer < Serializer - attribute(:long_name) { object.dig(:birim_uzun_adi).titleize_tr } - attribute(:english_name) { object.dig(:birim_adi_ingilizce).titleize } - attribute(:parent_unit_id) { object.dig(:bagli_oldugu_birim_id).safe_to_i } - attribute(:period_of_study) { object.dig(:ogrenim_suresi).safe_to_i } - attribute(:osym_id) { object.dig(:kilavuz_kodu).safe_to_i } + attribute(:long_name) { string object[:birim_uzun_adi] } + attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false } + attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } + attribute(:period_of_study) { integer object[:ogrenim_suresi] } + attribute(:osym_id) { integer object[:kilavuz_kodu] } attribute :university do { - code: object.dig(:universite, :kod).safe_to_i, - name: object.dig(:universite, :ad).titleize_tr + code: integer(object.dig(:universite, :kod)), + name: string(object.dig(:universite, :ad)) } end attribute :university_type do { - code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad).titleize_tr + code: integer(object.dig(:universite_turu, :kod)), + name: string(object.dig(:universite_turu, :ad)) } end attribute :unit do { - code: object.dig(:birim, :kod).safe_to_i, - name: object.dig(:birim, :ad).titleize_tr + code: integer(object.dig(:birim, :kod)), + name: string(object.dig(:birim, :ad)) } end attribute :unit_type do { - code: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad).titleize_tr + code: integer(object.dig(:birim_turu, :kod)), + name: string(object.dig(:birim_turu, :ad)) } end attribute :faculty do { - code: object.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: object.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr + code: integer(object.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(object.dig(:fakulte_yo_myo_enstitu, :ad)) } end attribute :status do { - code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad).titleize_tr + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) } end attribute :instruction_language do { - code: object.dig(:ogrenim_dili, :kod).safe_to_i, - name: object.dig(:ogrenim_dili, :ad).titleize_tr + code: integer(object.dig(:ogrenim_dili, :kod)), + name: string(object.dig(:ogrenim_dili, :ad)) } end attribute :instruction_type do { - code: object.dig(:ogrenim_turu, :kod).safe_to_i, - name: object.dig(:ogrenim_turu, :ad).titleize_tr + code: integer(object.dig(:ogrenim_turu, :kod)), + name: string(object.dig(:ogrenim_turu, :ad)) } end attribute :city do { - code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad).titleize_tr + code: integer(object.dig(:il, :kod)), + name: string(object.dig(:il, :ad)) } end attribute :district do { - code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad).titleize_tr + code: integer(object.dig(:ilce, :kod)), + name: string(object.dig(:ilce, :ad)) } end end diff --git a/app/serializers/yoksis/units/universities_serializer.rb b/app/serializers/yoksis/units/universities_serializer.rb index b7adca0a..8dd550a6 100644 --- a/app/serializers/yoksis/units/universities_serializer.rb +++ b/app/serializers/yoksis/units/universities_serializer.rb @@ -3,54 +3,54 @@ module Yoksis module Units class UniversitiesSerializer < Serializer - attribute(:unit_id) { object[:birim_id].safe_to_i } - attribute(:name) { object[:birim_adi].titleize_tr } - attribute(:english_name) { object[:birim_adi_ingilizce].titleize } - attribute(:phone) { object[:telefon] } - attribute(:fax) { object[:faks] } - attribute(:address) { object[:adres].titleize_tr } - attribute(:website) { object[:web] } - attribute(:email) { object[:eposta] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:name) { string object[:birim_adi] } + attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false } + attribute(:phone) { string object[:telefon] } + attribute(:fax) { string object[:faks] } + attribute(:address) { string object[:adres] } + attribute(:website) { string object[:web] } + attribute(:email) { string object[:eposta] } attribute :university_type do { - code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad).titleize_tr + code: integer(object.dig(:universite_turu, :kod)), + name: string(object.dig(:universite_turu, :ad)) } end attribute :status do { - code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad).titleize_tr + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) } end attribute :city do { - code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad).titleize_tr + code: integer(object.dig(:il, :kod)), + name: string(object.dig(:il, :ad)) } end attribute :district do { - code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad).titleize_tr + code: integer(object.dig(:ilce, :kod)), + name: string(object.dig(:ilce, :ad)) } end attribute :big_city do { - code: object.dig(:buyuksehir, :kod).safe_to_i, - name: object.dig(:buyuksehir, :ad).titleize_tr + code: integer(object.dig(:buyuksehir, :kod)), + name: string(object.dig(:buyuksehir, :ad)) } end attribute :seaside do { - code: object.dig(:deniz_kiyisi, :kod).safe_to_i, - name: object.dig(:deniz_kiyisi, :ad).titleize_tr + code: integer(object.dig(:deniz_kiyisi, :kod)), + name: string(object.dig(:deniz_kiyisi, :ad)) } end end From 49adc8097bb376d5ef8d8ea20a219b71d3d69f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Wed, 17 Oct 2018 12:32:03 +0300 Subject: [PATCH 10/13] Improve serializer's helper --- app/serializers/serializer.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/serializers/serializer.rb b/app/serializers/serializer.rb index f58f9040..acbefaff 100644 --- a/app/serializers/serializer.rb +++ b/app/serializers/serializer.rb @@ -29,17 +29,17 @@ def integer(object) end end - def split_string(object, block = nil, separator: ',', titleize_turkish: true) + def split_string(object, block = nil, separator: ',', case_conversion: true) return unless object raise TypeError, "#{object} is not a String" unless object.is_a?(String) - split = object.split(separator) + splitted = object.split(separator) + splitted.map!(&:titleize_turkish) if case_conversion - split.map!(&:titleize_turkish) if titleize_turkish - block ? split.try(&block) : split + block ? splitted.try(&block) : splitted end - def string(object, block = nil, titleize_turkish: true) + def string(object, block = nil, case_conversion: true) str = case object when NilClass return @@ -51,7 +51,7 @@ def string(object, block = nil, titleize_turkish: true) raise TypeError, "#{object} is not an String or convertable type" end - str = titleize_turkish ? str.titleize_turkish : str + str = case_conversion ? str.titleize_turkish : str block ? str.try(&block) : str end From 83c407974b004d197b0753350275cf7e7b688fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Wed, 17 Oct 2018 12:32:36 +0300 Subject: [PATCH 11/13] Refactor all serializers --- .../kps/queries/addresses_serializer.rb | 56 +++---- .../kps/queries/identities_serializer.rb | 82 +++++----- .../result_informations_serializer.rb | 6 +- .../graduates/informations_serializer.rb | 16 +- .../yoksis/meb/students_serializer.rb | 26 +-- .../administrative_units_serializer.rb | 2 +- .../resumes/academic_duties_serializer.rb | 48 +++--- .../resumes/academic_links_serializer.rb | 14 +- .../administrative_duties_serializer.rb | 34 ++-- .../yoksis/resumes/articles_serializer.rb | 78 ++++----- .../resumes/artistic_activities_serializer.rb | 40 ++--- .../yoksis/resumes/authors_serializer.rb | 30 ++-- .../yoksis/resumes/awards_serializer.rb | 27 ++- .../yoksis/resumes/books_serializer.rb | 70 ++++---- .../resumes/certifications_serializer.rb | 42 ++--- .../yoksis/resumes/citations_serializer.rb | 30 ++-- .../yoksis/resumes/designs_serializer.rb | 42 ++--- .../yoksis/resumes/editorships_serializer.rb | 68 ++++---- .../education_informations_serializer.rb | 66 ++++---- .../yoksis/resumes/fields_serializer.rb | 18 +- .../resumes/foreign_languages_serializer.rb | 26 +-- ...entive_activity_declarations_serializer.rb | 4 +- .../incentive_applications_serializer.rb | 10 +- .../yoksis/resumes/lectures_serializer.rb | 26 +-- .../yoksis/resumes/memberships_serializer.rb | 22 +-- .../resumes/other_experiences_serializer.rb | 26 +-- .../yoksis/resumes/papers_serializer.rb | 76 ++++----- .../yoksis/resumes/patents_serializer.rb | 44 ++--- .../yoksis/resumes/projects_serializer.rb | 48 +++--- .../yoksis/resumes/refereeing_serializer.rb | 42 ++--- .../resumes/thesis_advisors_serializer.rb | 34 ++-- .../students/informations_serializer.rb | 154 +++++++++--------- .../yoksis/units/changes_serializer.rb | 18 +- .../yoksis/units/units_serializer.rb | 64 ++++---- .../yoksis/units/universities_serializer.rb | 48 +++--- 35 files changed, 718 insertions(+), 719 deletions(-) diff --git a/app/serializers/kps/queries/addresses_serializer.rb b/app/serializers/kps/queries/addresses_serializer.rb index 7494694a..edb10458 100644 --- a/app/serializers/kps/queries/addresses_serializer.rb +++ b/app/serializers/kps/queries/addresses_serializer.rb @@ -16,30 +16,22 @@ class AddressesSerializer < Serializer description: string(address.dig(:adres_tip, :aciklama)) }, city_and_district_addresses: { - independent_unit_status: { - code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :kod)), - description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :aciklama)) - }, - dependent_unit_type: { - code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :kod)), - description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :aciklama)) - }, apartment: { block: string(address.dig(:il_ilce_merkez_adresi, :bina_ada)), - pilot: string(address.dig(:il_ilce_merkez_adresi, :bina_parsel)), - layout: string(address.dig(:il_ilce_merkez_adresi, :bina_pafta)), block_name: string(address.dig(:il_ilce_merkez_adresi, :bina_blok_adi)), code: integer(address.dig(:il_ilce_merkez_adresi, :bina_kodu)), + layout: string(address.dig(:il_ilce_merkez_adresi, :bina_pafta)), no: integer(address.dig(:il_ilce_merkez_adresi, :bina_no)), + pilot: string(address.dig(:il_ilce_merkez_adresi, :bina_parsel)), site_name: string(address.dig(:il_ilce_merkez_adresi, :bina_site_adi)), - status: { - code: integer(address.dig(:il_ilce_merkez_adresi, :bina_durum, :kod)), - description: string(address.dig(:il_ilce_merkez_adresi, :bina_durum, :aciklama)) - }, numbering_type: { code: integer(address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :kod)), description: string(address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :aciklama)) }, + status: { + code: integer(address.dig(:il_ilce_merkez_adresi, :bina_durum, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bina_durum, :aciklama)) + }, structure_type: { code: integer(address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :kod)), description: string(address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :aciklama)) @@ -53,10 +45,18 @@ class AddressesSerializer < Serializer code: integer(address.dig(:il_ilce_merkez_adresi, :il_kodu)), name: string(address.dig(:il_ilce_merkez_adresi, :il)) }, + dependent_unit_type: { + code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :aciklama)) + }, district: { code: integer(address.dig(:il_ilce_merkez_adresi, :ilce_kodu)), name: string(address.dig(:il_ilce_merkez_adresi, :ilce)) }, + independent_unit_status: { + code: integer(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :kod)), + description: string(address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_durum, :aciklama)) + }, neighborhood: { code: integer(address.dig(:il_ilce_merkez_adresi, :mahalle_kodu)), name: string(address.dig(:il_ilce_merkez_adresi, :mahalle)) @@ -64,16 +64,16 @@ class AddressesSerializer < Serializer reason_of_stucture_use: { code: integer(address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :kod)), name: string(address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :aciklama)) - }, + } }, - village_address: string(address[:koy_adresi]), abroad_address: string(address[:yurt_disi_adresi]), - reason_of_relocation: string(address[:tasinma_neden]), - municipality_address: string(address[:belde_adresi]), + daclaration_date: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), - date_of_relocation: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), - date_of_declaration: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), - date_of_registration: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + municipality_address: string(address[:belde_adresi]), + reason_of_relocation: string(address[:tasinma_neden]), + registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + relocation_date: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), + village_address: string(address[:koy_adresi]), } end @@ -84,21 +84,21 @@ class AddressesSerializer < Serializer next if address[:hata_bilgisi] object << { + address_no: integer(address[:adres_no]), declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), full_address: string(address[:acik_adres]), - address_no: integer(address[:adres_no]), address_type: { code: integer(address.dig(:adres_tip, :kod)), description: string(address.dig(:adres_tip, :aciklama)) }, - village_address: string(address[:koy_adresi]), - municipality_address: string(address[:belde_adresi]), - city_address: string(address[:il_ilce_merkez_adresi]), abroad_address: string(address[:yurt_disi_adresi]), + city_address: string(address[:il_ilce_merkez_adresi]), + daclaration_date: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), + municipality_address: string(address[:belde_adresi]), reason_of_relocation: string(address[:tasinma_neden]), - date_of_relocation: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), - date_of_declaration: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), - date_of_registration: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + relocation_date: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), + village_address: string(address[:koy_adresi]), } end diff --git a/app/serializers/kps/queries/identities_serializer.rb b/app/serializers/kps/queries/identities_serializer.rb index d27b96a7..62c3ec90 100644 --- a/app/serializers/kps/queries/identities_serializer.rb +++ b/app/serializers/kps/queries/identities_serializer.rb @@ -20,8 +20,8 @@ class IdentitiesSerializer < Serializer code: integer(personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod)), description: string(personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama)) }, - place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)), - date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) + date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)), + place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)) } status_informations = { @@ -39,17 +39,17 @@ class IdentitiesSerializer < Serializer personal_informations = personal_informations[:hata_bilgisi].present? ? nil : { id_number: integer(personal_informations[:kimlik_no]), - old_id_number: integer(personal_informations[:es_tc_kimlik_no]), - new_id_number: integer(personal_informations[:kazanilan_tc_kimlik_no]), fathers_id_number: integer(personal_informations[:baba_tc_kimlik_no]), mothers_id_number: integer(personal_informations[:anne_tc_kimlik_no]), + new_id_number: integer(personal_informations[:kazanilan_tc_kimlik_no]), + old_id_number: integer(personal_informations[:es_tc_kimlik_no]), real_person_id_number: integer(personal_informations[:gercek_kisi_kimlik_no]), country: personal_informations[:ulke] && { code: integer(personal_informations.dig(:ulke, :kod)), description: string(personal_informations.dig(:ulke, :aciklama)) }, - status_informations: status_informations, - basic_informations: basic_informations + basic_informations: basic_informations, + status_informations: status_informations } card_informations = informations[:mavi_kart_bilgisi] @@ -71,19 +71,19 @@ class IdentitiesSerializer < Serializer code: integer(card_informations.dig(:medeni_hal, :kod)), description: string(card_informations.dig(:medeni_hal, :aciklama)) }, - place_of_birth: string(card_informations[:dogum_yer]), code_of_place_of_birth: integer(card_informations[:dogum_yer_kod]), date_of_birth: card_informations[:dogum_tarih] && build_date(*card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + number: integer(card_informations[:no]), + place_of_birth: string(card_informations[:dogum_yer]), previous_last_name: string(card_informations[:onceki_soyad]), + registry_number: integer(card_informations[:kayit_no]), + serial_number: string(card_informations[:seri], case_conversion: false), unit: string(card_informations[:birim]), - number: integer(card_informations[:no]), - registration_number: integer(card_informations[:kayit_no]), - serial_number: string(card_informations[:seri], titleize_turkish: false), + issuing_date: card_informations[:verilme_tarih] && build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)), issuing_reason: card_informations[:verilis_neden] && { code: integer(card_informations.dig(:verilis_neden, :kod)), description: string(card_informations.dig(:verilis_neden, :aciklama)) - }, - issuing_date: card_informations[:verilme_tarih] && build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)) + } } next unless [personal_informations, card_informations].any? @@ -110,16 +110,17 @@ class IdentitiesSerializer < Serializer description: string(temporary_identity_informations.dig(:cinsiyet, :aciklama)) }, date_of_birth: temporary_identity_informations[:dogum_tarih] && build_date(*temporary_identity_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - previous_last_name: string(temporary_identity_informations[:onceki_soyad]), + expire_date: temporary_identity_informations[:son_gecerlilik_tarih] && build_date(*temporary_identity_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)), document_number: integer(temporary_identity_informations[:belge_no]), - issuing_district: string(temporary_identity_informations[:duzenleyen_ilce]), issuing_date: temporary_identity_informations[:duzenlenme_tarih] && build_date(*temporary_identity_informations[:duzenlenme_tarih].values_at(:yil, :ay, :gun)), - date_of_expiration: temporary_identity_informations[:son_gecerlilik_tarih] && build_date(*temporary_identity_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)) + issuing_district: string(temporary_identity_informations[:duzenleyen_ilce]), + previous_last_name: string(temporary_identity_informations[:onceki_soyad]) } personal_informations = informations[:kisi_bilgisi] status_informations = { + date_of_death: personal_informations.dig(:durum_bilgisi, :olum_tarih) && build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)), religion: string(personal_informations.dig(:durum_bilgisi, :din)), status: { code: integer(personal_informations.dig(:durum_bilgisi, :durum, :kod)), @@ -128,8 +129,7 @@ class IdentitiesSerializer < Serializer marital_status: { code: integer(personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod)), description: string(personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama)) - }, - date_of_death: personal_informations.dig(:durum_bilgisi, :olum_tarih) && build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) + } } place_of_registry_informations = { @@ -158,16 +158,16 @@ class IdentitiesSerializer < Serializer code: integer(personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod)), description: string(personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama)) }, - place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)), - date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)) + date_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_tarih) && build_date(*personal_informations.dig(:temel_bilgisi, :dogum_tarih).values_at(:yil, :ay, :gun)), + place_of_birth: string(personal_informations.dig(:temel_bilgisi, :dogum_yer)) } personal_informations = personal_informations[:hata_bilgisi].present? ? nil : { id_number: integer(personal_informations[:tc_kimlik_no]), - old_id_number: integer(personal_informations[:es_tc_kimlik_no]), fathers_id_number: integer(personal_informations[:baba_tc_kimlik_no]), mothers_id_number: integer(personal_informations[:anne_tc_kimlik_no]), code_of_place_of_birth: integer(personal_informations[:dogum_yer_kod]), + old_id_number: integer(personal_informations[:es_tc_kimlik_no]), basic_informations: basic_informations, status_informations: status_informations, place_of_registry: place_of_registry_informations @@ -180,26 +180,26 @@ class IdentitiesSerializer < Serializer last_name: string(old_identity_card_informations[:soyad]), fathers_name: string(old_identity_card_informations[:baba_ad]), mothers_name: string(old_identity_card_informations[:anne_ad]), - place_of_birth: string(old_identity_card_informations[:dogum_yer]), date_of_birth: old_identity_card_informations[:dogum_tarih] && build_date(*old_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), - number: integer(old_identity_card_informations[:no]), - registration_number: integer(old_identity_card_informations[:cuzdan_kayit_no]), - serial_number: string(old_identity_card_informations[:seri], titleize_turkish: false), issuing_date: old_identity_card_informations[:verilme_tarih] && build_date(*old_identity_card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)), - issuing_reason: { - code: integer(old_identity_card_informations.dig(:cuzdan_verilme_neden, :kod)), - description: string(old_identity_card_informations.dig(:cuzdan_verilme_neden, :aciklama)) - }, + number: integer(old_identity_card_informations[:no]), + place_of_birth: string(old_identity_card_informations[:dogum_yer]), + registry_number: integer(old_identity_card_informations[:cuzdan_kayit_no]), + serial_number: string(old_identity_card_informations[:seri], case_conversion: false), issuing_district: { code: integer(old_identity_card_informations.dig(:verildigi_ilce, :kod)), description: string(old_identity_card_informations.dig(:verildigi_ilce, :aciklama)) + }, + issuing_reason: { + code: integer(old_identity_card_informations.dig(:cuzdan_verilme_neden, :kod)), + description: string(old_identity_card_informations.dig(:cuzdan_verilme_neden, :aciklama)) } } new_identity_card_photograph_informations = informations[:tckk_fotograf_bilgisi] new_identity_card_photograph_informations = new_identity_card_photograph_informations[:hata_bilgisi].present? ? nil : { id_number: integer(new_identity_card_photograph_informations[:tc_kimlik_no]), - photograph: string(new_identity_card_photograph_informations[:fotograf], titleize_turkish: false), + photograph: string(new_identity_card_photograph_informations[:fotograf], case_conversion: false), } new_identity_card_informations = informations[:tckk_bilgisi] @@ -213,17 +213,17 @@ class IdentitiesSerializer < Serializer code: integer(new_identity_card_informations.dig(:cinsiyet, :kod)), description: string(new_identity_card_informations.dig(:cinsiyet, :aciklama)) }, - place_of_birth: string(new_identity_card_informations[:dogum_yer]), date_of_birth: new_identity_card_informations[:dogum_tarih] && build_date(*new_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + expire_date: new_identity_card_informations[:son_gecerlilik_tarih] && build_date(*new_identity_card_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)), + place_of_birth: string(new_identity_card_informations[:dogum_yer]), registry_number: integer(new_identity_card_informations[:kayit_no]), serial_number: integer(new_identity_card_informations[:seri_no]), - date_of_expiration: new_identity_card_informations[:son_gecerlilik_tarih] && build_date(*new_identity_card_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)), admission_reason: new_identity_card_informations[:basvuru_neden] && { code: integer(new_identity_card_informations.dig(:basvuru_neden, :kod)), description: string(new_identity_card_informations.dig(:basvuru_neden, :aciklama)), }, - deliverer_unit: string(new_identity_card_informations[:teslim_eden_birim]), date_of_delivery: new_identity_card_informations[:teslim_tarih] && build_date(*new_identity_card_informations[:teslim_tarih].values_at(:yil, :ay, :gun)), + deliverer_unit: string(new_identity_card_informations[:teslim_eden_birim]), issuing_authority: string(new_identity_card_informations[:veren_makam]), photograph: new_identity_card_photograph_informations } @@ -249,15 +249,15 @@ class IdentitiesSerializer < Serializer basic_informations = foreigner[:temel_bilgisi] basic_informations = basic_informations[:hata_bilgisi].present? ? nil : { - first_name: string(basic_informations[:ad], ->(p) { p.titleize }, titleize_turkish: false), - last_name: string(basic_informations[:soyad], ->(p) { p.titleize }, titleize_turkish: false), - fathers_name: string(basic_informations[:baba_ad], ->(p) { p.titleize }, titleize_turkish: false), - mothers_name: string(basic_informations[:anne_ad], ->(p) { p.titleize }, titleize_turkish: false), + first_name: string(basic_informations[:ad], ->(p) { p.titleize }, case_conversion: false), + last_name: string(basic_informations[:soyad], ->(p) { p.titleize }, case_conversion: false), + fathers_name: string(basic_informations[:baba_ad], ->(p) { p.titleize }, case_conversion: false), + mothers_name: string(basic_informations[:anne_ad], ->(p) { p.titleize }, case_conversion: false), gender: { code: integer(basic_informations.dig(:cinsiyet, :kod)), description: string(basic_informations.dig(:cinsiyet, :aciklama)) }, - place_of_birth: string(basic_informations[:dogum_yer], ->(p) { p.titleize }, titleize_turkish: false) + place_of_birth: string(basic_informations[:dogum_yer], ->(p) { p.titleize }, case_conversion: false) } status_informations = foreigner[:durum_bilgisi] @@ -280,17 +280,17 @@ class IdentitiesSerializer < Serializer id_number: integer(foreigner[:kimlik_no]), mothers_id_number: integer(foreigner[:anne_kimlik_no]), fathers_id_number: integer(foreigner[:baba_kimlik_no]), - old_id_number: integer(foreigner[:es_tc_kimlik_no]), - new_id_number: integer(foreigner[:kazanilan_tc_kimlik_no]), - real_person_id_number: integer(foreigner[:gercek_kisi_kimlik_no]), code_of_place_of_birth: integer(foreigner[:dogum_yer_kod]), date_of_birth: foreigner[:dogum_tarih] && build_date(*foreigner[:dogum_tarih].values_at(:yil, :ay, :gun)), date_of_death: foreigner[:olum_tarih] && build_date(*foreigner[:olum_tarih].values_at(:yil, :ay, :gun)), + new_id_number: integer(foreigner[:kazanilan_tc_kimlik_no]), + old_id_number: integer(foreigner[:es_tc_kimlik_no]), + real_person_id_number: integer(foreigner[:gercek_kisi_kimlik_no]), + admittance: admittance_informations, nationality: { code: integer(foreigner.dig(:uyruk, :kod)), description: string(foreigner.dig(:uyruk, :aciklama)) }, - admittance: admittance_informations, source_unit: { code: integer(foreigner.dig(:kaynak_birim, :kod)), description: string(foreigner.dig(:kaynak_birim, :aciklama)) diff --git a/app/serializers/osym/examination/result_informations_serializer.rb b/app/serializers/osym/examination/result_informations_serializer.rb index 7a485d18..051ecebc 100644 --- a/app/serializers/osym/examination/result_informations_serializer.rb +++ b/app/serializers/osym/examination/result_informations_serializer.rb @@ -3,9 +3,9 @@ module Osym module Examination class ResultInformationsSerializer < ActiveModel::Serializer - attribute(:id) { integer object[:id] } - attribute(:name) { string object[:ad] } - attribute(:date_of_release) { parse_date object[:aciklama_tarihi] } + attribute(:id) { integer object[:id] } + attribute(:name) { string object[:ad] } + attribute(:release_date) { parse_date object[:aciklama_tarihi] } end end end diff --git a/app/serializers/yoksis/graduates/informations_serializer.rb b/app/serializers/yoksis/graduates/informations_serializer.rb index bf500eef..fd835af8 100644 --- a/app/serializers/yoksis/graduates/informations_serializer.rb +++ b/app/serializers/yoksis/graduates/informations_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Graduates class InformationsSerializer < Serializer - attribute(:id_number) { integer object[:tckno] } + attribute(:diploma_grade) { float object[:diploma_notu] } + attribute(:diploma_grading_system) { integer object[:diploma_not_sistemi] } + attribute(:diploma_no) { string object[:diploma_no], ->(p) { p.upcase :turkic } } + attribute(:faculty) { string object[:fak_myo_yo_ens] } + attribute(:fathers_name) { string object[:baba_adi] } attribute(:first_name) { string object[:adi] } + attribute(:id_number) { integer object[:tckno] } attribute(:last_name) { string object[:soyadi] } - attribute(:fathers_name) { string object[:baba_adi] } attribute(:mothers_name) { string object[:anne_adi] } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:universite_adi] } - attribute(:faculty) { string object[:fak_myo_yo_ens] } attribute(:program) { string object[:program_adi] } attribute(:unit_id) { integer object[:birim_id] } - attribute(:diploma_grading_system) { integer object[:diploma_not_sistemi] } - attribute(:diploma_grade) { float object[:diploma_notu] } - attribute(:diploma_no) { string object[:diploma_no], ->(p) { p.upcase :turkic } } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite_adi] } attribute :date_of_birth do next unless object[:dogum_tarihi] diff --git a/app/serializers/yoksis/meb/students_serializer.rb b/app/serializers/yoksis/meb/students_serializer.rb index b5ee7c49..11704264 100644 --- a/app/serializers/yoksis/meb/students_serializer.rb +++ b/app/serializers/yoksis/meb/students_serializer.rb @@ -3,24 +3,24 @@ module Yoksis module Meb class StudentsSerializer < Serializer - attribute(:id_number) { integer object[:tckimlikno] } - attribute(:first_name) { string object[:adi] } - attribute(:last_name) { string object[:soyadi] } - attribute(:city_name) { string object[:okuliladi] } attribute(:city_code) { integer object[:okulilkodu] } - attribute(:district_name) { string object[:okulilceadi] } + attribute(:city_name) { string object[:okuliladi] } attribute(:district_code) { integer object[:okulilcekodu] } - attribute(:school_id) { integer object[:okulkodu] } - attribute(:school_name) { string object[:okuladi] } - attribute(:school_field_code) { integer object[:okulalankodu] } - attribute(:school_field_name) { string object[:okulalanadi] } - attribute(:school_branch_code) { integer object[:okuldalkodu] } - attribute(:school_branch_name) { string object[:okuldaladi] } - attribute(:instruction_type) { string object[:ogrenimturu] } + attribute(:district_name) { string object[:okulilceadi] } + attribute(:first_name) { string object[:adi] } attribute(:grad_status_code) { integer object[:mezundurumukodu] } attribute(:grad_status_name) { string object[:mezundurumu] } - attribute(:graduation_date) { parse_date object[:mezuniyettarih] } attribute(:grading_system) { integer object[:notsistemi] } + attribute(:graduation_date) { parse_date object[:mezuniyettarih] } + attribute(:id_number) { integer object[:tckimlikno] } + attribute(:instruction_type) { string object[:ogrenimturu] } + attribute(:last_name) { string object[:soyadi] } + attribute(:school_branch_code) { integer object[:okuldalkodu] } + attribute(:school_branch_name) { string object[:okuldaladi] } + attribute(:school_field_code) { integer object[:okulalankodu] } + attribute(:school_field_name) { string object[:okulalanadi] } + attribute(:school_id) { integer object[:okulkodu] } + attribute(:school_name) { string object[:okuladi] } attribute :top_scoring_student do object[:okulbirincisi] && !object[:okulbirincisi].to_i.zero? diff --git a/app/serializers/yoksis/references/administrative_units_serializer.rb b/app/serializers/yoksis/references/administrative_units_serializer.rb index f9b02405..eb9d9841 100644 --- a/app/serializers/yoksis/references/administrative_units_serializer.rb +++ b/app/serializers/yoksis/references/administrative_units_serializer.rb @@ -3,8 +3,8 @@ module Yoksis module References class AdministrativeUnitsSerializer < Serializer - attribute(:unit_name) { string object[:birim_adi], ->(p) { p.upcase :turkic } } attribute(:unit_id) { integer object[:birim_id] } + attribute(:unit_name) { string object[:birim_adi], ->(p) { p.upcase :turkic } } attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } end end diff --git a/app/serializers/yoksis/resumes/academic_duties_serializer.rb b/app/serializers/yoksis/resumes/academic_duties_serializer.rb index 757c47be..9f39972f 100644 --- a/app/serializers/yoksis/resumes/academic_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_duties_serializer.rb @@ -3,30 +3,30 @@ module Yoksis module Resumes class AcademicDutiesSerializer < Serializer - attribute(:duty_id) { integer object[:gorev_id] } - attribute(:place_name) { string object[:yer_ad] } - attribute(:place_id) { integer object[:yer_id] } - attribute(:country_name) { string object[:ulke_ad] } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:university_name) { string object[:univ_birim_adi] } - attribute(:university_id) { integer object[:univ_id] } - attribute(:faculty) { string object[:fakultebilgisi] } - attribute(:department) { string object[:bolumbilgisi] } - attribute(:unit_id) { integer object[:birim_id] } - attribute(:title_name) { string object[:kadro_unvan_adi] } - attribute(:title_id) { integer object[:kadro_unvan_id] } - attribute(:year_of_start) { integer object[:bastar1] } - attribute(:year_of_end) { integer object[:bittar1] } - attribute(:field) { string object[:alanbilgisi] } - attribute(:field_of_specialization_id) { integer object[:uzmanlik_alani] } - attribute(:field_of_specialization_name) { string object[:uzmanlik_alani_ad] } - attribute(:scientific_field_name) { string object[:bilimalan_adi] } - attribute(:academic_status_id) { integer object[:akademik_durum] } - attribute(:academic_status_name) { string object[:akademik_durum_adi] } - attribute(:academic_unit_name) { string object[:akademik_birim_adi], ->(p) { p.gsub(/\/*$/, '') } } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:academic_status_id) { integer object[:akademik_durum] } + attribute(:academic_status_name) { string object[:akademik_durum_adi] } + attribute(:academic_unit_name) { string object[:akademik_birim_adi], ->(p) { p.gsub(/\/*$/, '') } } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:discipline) { string object[:alanbilgisi] } + attribute(:end_date) { integer object[:bittar1] } + attribute(:faculty) { string object[:fakultebilgisi] } + attribute(:id) { integer object[:gorev_id] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location_id) { integer object[:yer_id] } + attribute(:location_name) { string object[:yer_ad] } + attribute(:profession_id) { integer object[:uzmanlik_alani] } + attribute(:profession_name) { string object[:uzmanlik_alani_ad] } + attribute(:scientific_field_name) { string object[:bilimalan_adi] } + attribute(:start_date) { integer object[:bastar1] } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:title_name) { string object[:kadro_unvan_adi] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:univ_birim_adi] } end end end diff --git a/app/serializers/yoksis/resumes/academic_links_serializer.rb b/app/serializers/yoksis/resumes/academic_links_serializer.rb index bc9d9864..4d8ea6db 100644 --- a/app/serializers/yoksis/resumes/academic_links_serializer.rb +++ b/app/serializers/yoksis/resumes/academic_links_serializer.rb @@ -3,13 +3,13 @@ module Yoksis module Resumes class AcademicLinksSerializer < Serializer - attribute(:researcher_id) { integer object[:arastirmaci_id] } - attribute(:staff_first_name) { string object[:personel_adi] } - attribute(:staff_last_name) { string object[:personel_soyadi] } - attribute(:staff_title) { string object[:kadro_unvan_adi] } - attribute(:staff_workplace) { string object[:kadro_yeri] } - attribute(:yok_link) { string object[:yokakademik_link], titleize_turkish: false } - attribute(:photograph_link) { string object[:resim_link] } + attribute(:photograph_link) { string object[:resim_link], case_conversion: false } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:staff_first_name) { string object[:personel_adi] } + attribute(:staff_last_name) { string object[:personel_soyadi] } + attribute(:staff_location) { string object[:kadro_yeri] } + attribute(:staff_title) { string object[:kadro_unvan_adi] } + attribute(:yok_link) { string object[:yokakademik_link], case_conversion: false } end end end diff --git a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb index 353801c0..99325a96 100644 --- a/app/serializers/yoksis/resumes/administrative_duties_serializer.rb +++ b/app/serializers/yoksis/resumes/administrative_duties_serializer.rb @@ -3,23 +3,23 @@ module Yoksis module Resumes class AdministrativeDutiesSerializer < Serializer - attribute(:registry_id) { integer object[:idgor_id] } - attribute(:id) { integer object[:gorev_id] } - attribute(:name) { string object[:gorev_adi] } - attribute(:place_id) { integer object[:yer_id] } - attribute(:place_name) { string object[:yer_ad] } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:year_of_start) { integer object[:bas_tar] } - attribute(:year_of_end) { integer object[:bit_tar] } - attribute(:university_id) { integer object[:unv_id] } - attribute(:university_name) { string object[:unv_birim_adi] } - attribute(:major) { string object[:abd] } - attribute(:faculty) { string object[:fakultemyoenst] } - attribute(:department) { string object[:bolumbilgisi] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:end_date) { integer object[:bit_tar] } + attribute(:faculty) { string object[:fakultemyoenst] } + attribute(:id) { integer object[:gorev_id] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location_id) { integer object[:yer_id] } + attribute(:location_name) { string object[:yer_ad] } + attribute(:major) { string object[:abd] } + attribute(:name) { string object[:gorev_adi] } + attribute(:start_date) { integer object[:bas_tar] } + attribute(:university_id) { integer object[:unv_id] } + attribute(:university_name) { string object[:unv_birim_adi] } + attribute(:yoksis_id) { integer object[:idgor_id] } end end end diff --git a/app/serializers/yoksis/resumes/articles_serializer.rb b/app/serializers/yoksis/resumes/articles_serializer.rb index e67ef99c..7927542c 100644 --- a/app/serializers/yoksis/resumes/articles_serializer.rb +++ b/app/serializers/yoksis/resumes/articles_serializer.rb @@ -3,45 +3,45 @@ module Yoksis module Resumes class ArticlesSerializer < Serializer - attribute(:publishing_id) { integer object[:yayin_id] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi] } - attribute(:name) { string object[:makale_adi] } - attribute(:type_id) { integer object[:makale_turu_id] } - attribute(:type_name) { string object[:makale_turu_ad] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:referee_type_id) { integer object[:hakem_tur] } - attribute(:referee_type_name) { string object[:hakem_tur_ad] } - attribute(:index_id) { integer object[:endeks_id] } - attribute(:index) { string object[:endeks] } - attribute(:author_id) { integer object[:yazar_id] } - attribute(:authors) { split_string object[:yazar_adi] } - attribute(:number_of_author) { integer object[:yazar_sayisi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:city) { string object[:sehir] } - attribute(:journal_name) { string object[:dergi_adi] } - attribute(:month) { integer object[:ay] } - attribute(:year) { integer object[:yil] } - attribute(:volume) { integer object[:cilt] } - attribute(:issue) { integer object[:sayi] } - attribute(:first_page) { integer object[:ilk_sayfa] } - attribute(:last_page) { integer object[:son_sayfa] } - attribute(:doi) { integer object[:doi] } - attribute(:issn) { integer object[:issn] } - attribute(:access_type_id) { integer object[:erisim_turu] } - attribute(:access_type_name) { string object[:erisim_turu_ad] } - attribute(:access_link) { string object[:erisim_linki], titleize_turkish: false } - attribute(:number_of_citation) { integer object[:atif_sayisi] } - attribute(:field) { string object[:alan_bilgisi] } - attribute(:keywords) { split_string object[:anahtar_kelime] } - attribute(:special_edition_id) { integer object[:ozel_sayi] } - attribute(:special_edition_name) { string object[:ozel_sayi_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:access_link) { string object[:erisim_linki], case_conversion: false } + attribute(:access_type_id) { integer object[:erisim_turu] } + attribute(:access_type_name) { string object[:erisim_turu_ad] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:discipline) { string object[:alan_bilgisi] } + attribute(:doi) { integer object[:doi] } + attribute(:first_page) { integer object[:ilk_sayfa] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:index) { string object[:endeks] } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:issn) { integer object[:issn] } + attribute(:issue) { integer object[:sayi] } + attribute(:journal_name) { string object[:dergi_adi] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:last_page) { integer object[:son_sayfa] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:month) { integer object[:ay] } + attribute(:name) { string object[:makale_adi] } + attribute(:number_of_author) { integer object[:yazar_sayisi] } + attribute(:number_of_citations) { integer object[:atif_sayisi] } + attribute(:publication_id) { integer object[:yayin_id] } + attribute(:publication_language_id) { integer object[:yayin_dili] } + attribute(:publication_language_name) { string object[:yayin_dili_adi] } + attribute(:reviewer_id) { integer object[:hakem_tur] } + attribute(:reviewer_name) { string object[:hakem_tur_ad] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:special_issue_id) { integer object[:ozel_sayi] } + attribute(:special_issue_name) { string object[:ozel_sayi_ad] } + attribute(:type_id) { integer object[:makale_turu_id] } + attribute(:type_name) { string object[:makale_turu_ad] } + attribute(:volume) { integer object[:cilt] } + attribute(:year) { integer object[:yil] } end end end diff --git a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb index 1d4f9ca5..c79cd1fb 100644 --- a/app/serializers/yoksis/resumes/artistic_activities_serializer.rb +++ b/app/serializers/yoksis/resumes/artistic_activities_serializer.rb @@ -3,34 +3,34 @@ module Yoksis module Resumes class ArtisticActivitiesSerializer < Serializer - attribute(:registry_id) { integer object[:s_id] } - attribute(:name) { string object[:etkinlik_adi] } - attribute(:place) { string object[:etkinlik_yeri] } - attribute(:type_id) { integer object[:etkinlik_turu] } - attribute(:type_name) { string object[:etkinlik_turu_ad] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } attribute(:duration) { integer object[:etkinlik_suresi] } - attribute(:scope_id) { integer object[:kapsam] } - attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:end_date) { parse_date object[:bit_tarih] } + attribute(:incentive_point) { float object[:tesv_puan] } attribute(:language_id) { integer object[:etkinlik_dili] } attribute(:language_name) { string object[:dil_adi] } - attribute(:date_of_start) { parse_date object[:bas_tarih] } - attribute(:date_of_end) { parse_date object[:bit_tarih] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location) { string object[:etkinlik_yeri] } + attribute(:main_type) { integer object[:ana_tur] } + attribute(:name) { string object[:etkinlik_adi] } + attribute(:number_of_participants) { integer object[:kisi_sayisi] } attribute(:organizers) { split_string object[:duzenleyenler] } - attribute(:number_of_person) { integer object[:kisi_sayisi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:city) { string object[:sehir] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:start_date) { parse_date object[:bas_tarih] } attribute(:title_id) { integer object[:unvan_id] } attribute(:title_name) { string object[:unvan_ad] } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad] } + attribute(:type_id) { integer object[:etkinlik_turu] } + attribute(:type_name) { string object[:etkinlik_turu_ad] } + attribute(:unit_id) { integer object[:kurum_id] } + attribute(:unit_name) { string object[:kurum_ad] } attribute(:work_type_id) { integer object[:tip] } attribute(:work_type_name) { string object[:tip_adi] } - attribute(:main_type_id) { integer object[:ana_tur] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:yoksis_id) { integer object[:s_id] } end end end diff --git a/app/serializers/yoksis/resumes/authors_serializer.rb b/app/serializers/yoksis/resumes/authors_serializer.rb index d5e3b3e8..a56e0eb9 100644 --- a/app/serializers/yoksis/resumes/authors_serializer.rb +++ b/app/serializers/yoksis/resumes/authors_serializer.rb @@ -3,21 +3,21 @@ module Yoksis module Resumes class AuthorsSerializer < Serializer - attribute(:registry_id) { integer object[:y_id] } - attribute(:id_number) { integer object[:tc_kimlik_no] } - attribute(:first_name) { string object[:yazarad] } - attribute(:last_name) { string object[:yazarsoyad] } - attribute(:researcher_id) { integer object[:arastirmaci_id] } - attribute(:title_id) { integer object[:kadro_unvan_id] } - attribute(:title_name) { string object[:kadro_unvan_adi] } - attribute(:type_id) { integer object[:yazar_tur] } - attribute(:type_name) { string object[:yazar_tur_ad] } - attribute(:form_id) { integer object[:yazar_form_id] } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:universite] } - attribute(:users_ars_id) { integer object[:kullanicinin_ars_id] } - attribute(:orc_id) { integer object[:yazar_orcid] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:ars_id) { integer object[:kullanicinin_ars_id] } + attribute(:first_name) { string object[:yazarad] } + attribute(:form_id) { integer object[:yazar_form_id] } + attribute(:id_number) { integer object[:tc_kimlik_no] } + attribute(:last_name) { string object[:yazarsoyad] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:orc_id) { integer object[:yazar_orcid] } + attribute(:researcher_id) { integer object[:arastirmaci_id] } + attribute(:title_id) { integer object[:kadro_unvan_id] } + attribute(:title_name) { string object[:kadro_unvan_adi] } + attribute(:type_id) { integer object[:yazar_tur] } + attribute(:type_name) { string object[:yazar_tur_ad] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite] } + attribute(:yoksis_id) { integer object[:y_id] } end end end diff --git a/app/serializers/yoksis/resumes/awards_serializer.rb b/app/serializers/yoksis/resumes/awards_serializer.rb index 5a2dc0e9..a95e6a72 100644 --- a/app/serializers/yoksis/resumes/awards_serializer.rb +++ b/app/serializers/yoksis/resumes/awards_serializer.rb @@ -3,17 +3,19 @@ module Yoksis module Resumes class AwardsSerializer < Serializer - attribute(:id) { integer object[:odul_id] } - attribute(:name) { string object[:odul_adi] } - attribute(:description) { string object[:odul_aciklama] } - attribute(:year) { integer object[:odul_tarih] } - attribute(:activity_detail_id) { integer object[:faal_detay_id] } - attribute(:activity_detail_name) { string object[:faal_detay_adi] } - attribute(:type_id) { integer object[:odul_tur_id] } - attribute(:type_name) { string object[:odul_turu] } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_ad] } - attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:activity_detail_id) { integer object[:faal_detay_id] } + attribute(:activity_detail_name) { string object[:faal_detay_adi] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:description) { string object[:odul_aciklama] } + attribute(:id) { integer object[:odul_id] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:odul_adi] } + attribute(:number_of_participants) { integer object[:kisi_sayisi] } + attribute(:type_id) { integer object[:odul_tur_id] } + attribute(:type_name) { string object[:odul_turu] } + attribute(:year) { integer object[:odul_tarih] } attribute :awarder do { @@ -31,9 +33,6 @@ class AwardsSerializer < Serializer institution_name: string(object[:p_kurum_ad]) } end - - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } end end end diff --git a/app/serializers/yoksis/resumes/books_serializer.rb b/app/serializers/yoksis/resumes/books_serializer.rb index 2d7f1c5a..26b9140a 100644 --- a/app/serializers/yoksis/resumes/books_serializer.rb +++ b/app/serializers/yoksis/resumes/books_serializer.rb @@ -3,41 +3,41 @@ module Yoksis module Resumes class BooksSerializer < Serializer - attribute(:registry_id) { integer object[:y_id] } - attribute(:publishing_house) { string object[:yayin_evi] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi] } - attribute(:name) { integer object[:kitap_adi] } - attribute(:type_id) { integer object[:kitap_tur_id] } - attribute(:type_name) { string object[:kitap_tur] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:contribution_rate_id) { integer object[:katki_duzeyi] } - attribute(:contribution_rate_name) { string object[:katki_duzeyi_ad] } - attribute(:chapter_name) { string object[:bolum_adi] } - attribute(:number_of_author) { integer object[:yazar_sayisi] } - attribute(:authors) { split_string object[:yazar_adi] } - attribute(:editor_name) { string object[:editor_adi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:city) { string object[:sehir] } - attribute(:year) { integer object[:yil] } - attribute(:isbn) { string object[:isbn] } - attribute(:number_of_copy) { integer object[:kacinci_basim] } - attribute(:number_of_page) { integer object[:sayfa_sayisi] } - attribute(:chapter_first_page) { integer object[:bolum_ilk_sayfa] } - attribute(:chapter_last_page) { integer object[:bolum_son_sayfa] } - attribute(:releasing_type_id) { integer object[:basim_turu] } - attribute(:releasing_type_name) { string object[:basim_turu_ad] } - attribute(:access_link) { string object[:erisim_linki] } - attribute(:field) { string object[:alan_bilgisi] } - attribute(:keywords) { split_string object[:anahtar_kelime] } - attribute(:author_id) { integer object[:yazar_id] } - attribute(:number_of_citation) { integer object[:atif_sayisi] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:access_link) { string object[:erisim_linki], case_conversion: false } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:chapter_first_page) { integer object[:bolum_ilk_sayfa] } + attribute(:chapter_last_page) { integer object[:bolum_son_sayfa] } + attribute(:chapter_name) { string object[:bolum_adi] } + attribute(:city) { string object[:sehir] } + attribute(:contribution_rate_id) { integer object[:katki_duzeyi] } + attribute(:contribution_rate_name) { string object[:katki_duzeyi_ad] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:discipline) { string object[:alan_bilgisi] } + attribute(:editor_name) { string object[:editor_adi] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:isbn) { string object[:isbn] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { integer object[:kitap_adi] } + attribute(:number_of_authors) { integer object[:yazar_sayisi] } + attribute(:number_of_citations) { integer object[:atif_sayisi] } + attribute(:number_of_copy) { integer object[:kacinci_basim] } + attribute(:number_of_page) { integer object[:sayfa_sayisi] } + attribute(:publication_language_id) { integer object[:yayin_dili] } + attribute(:publication_language_name) { string object[:yayin_dili_adi] } + attribute(:publisher) { string object[:yayin_evi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:type_id) { integer object[:kitap_tur_id] } + attribute(:type_name) { string object[:kitap_tur] } + attribute(:type_of_release_id) { integer object[:basim_turu] } + attribute(:type_of_release_name) { string object[:basim_turu_ad] } + attribute(:year) { integer object[:yil] } + attribute(:yoksis_id) { integer object[:y_id] } end end end diff --git a/app/serializers/yoksis/resumes/certifications_serializer.rb b/app/serializers/yoksis/resumes/certifications_serializer.rb index 77c93aa9..319a271b 100644 --- a/app/serializers/yoksis/resumes/certifications_serializer.rb +++ b/app/serializers/yoksis/resumes/certifications_serializer.rb @@ -3,34 +3,34 @@ module Yoksis module Resumes class CertificationsSerializer < Serializer - attribute(:registry_id) { integer object[:s_id] } - attribute(:name) { string object[:adi] } - attribute(:content) { string object[:icerik] } - attribute(:type_id) { integer object[:tur_id] } - attribute(:type_name) { string object[:tur_adi] } - attribute(:place) { string object[:yer] } - attribute(:scope_id) { integer object[:kapsam] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:stint) { integer object[:sure] } - attribute(:title_id) { integer object[:unvan_id] } - attribute(:title_name) { string object[:unvan_ad] } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad] } - attribute(:number_of_person) { integer object[:kisi_sayisi] } - attribute(:country) { string object[:ulke_sehir] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:content) { string object[:icerik] } + attribute(:country) { string object[:ulke_sehir] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location) { string object[:yer] } + attribute(:name) { string object[:adi] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:stint) { integer object[:sure] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:type_id) { integer object[:tur_id] } + attribute(:type_name) { string object[:tur_adi] } + attribute(:unit_id) { integer object[:kurum_id] } + attribute(:unit_name) { string object[:kurum_ad] } + attribute(:yoksis_id) { integer object[:s_id] } - attribute :date_of_start do + attribute :start_date do next unless object[:bastar] year, month, day = object[:bastar].split('.').reverse build_date year, month, day end - attribute :date_of_end do + attribute :end_date do next unless object[:bittar] year, month, day = object[:bittar].split('.').reverse diff --git a/app/serializers/yoksis/resumes/citations_serializer.rb b/app/serializers/yoksis/resumes/citations_serializer.rb index 796ab15a..ca489ffa 100644 --- a/app/serializers/yoksis/resumes/citations_serializer.rb +++ b/app/serializers/yoksis/resumes/citations_serializer.rb @@ -3,21 +3,21 @@ module Yoksis module Resumes class CitationsSerializer < Serializer - attribute(:registry_id) { integer object[:a_id] } - attribute(:term) { integer object[:donem] } - attribute(:type_id) { integer object[:tur] } - attribute(:type_name) { string object[:tur_ad] } - attribute(:work_type) { string object[:eser_turu] } - attribute(:work_id) { integer object[:eser_id] } - attribute(:international_book_citation) { integer object[:uluslar_kit_atf] } - attribute(:national_book_citation) { integer object[:ulusal_kit_atf] } - attribute(:ssci_index) { integer object[:ssci_indeks_atf] } - attribute(:scope_index) { integer object[:alan_indeks_atf] } - attribute(:other_citations) { string object[:diger_atif], titleize_turkish: false } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:esci) { integer object[:esci] } - attribute(:composer_work) { string object[:besteci_eser], titleize_turkish: false } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:composer_work) { string object[:besteci_eser], case_conversion: false } + attribute(:esci) { integer object[:esci] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:international_book_citation) { integer object[:uluslar_kit_atf] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:national_book_citation) { integer object[:ulusal_kit_atf] } + attribute(:other_citations) { string object[:diger_atif], case_conversion: false } + attribute(:scope_index) { integer object[:alan_indeks_atf] } + attribute(:ssci_index) { integer object[:ssci_indeks_atf] } + attribute(:term) { integer object[:donem] } + attribute(:type_id) { integer object[:tur] } + attribute(:type_name) { string object[:tur_ad] } + attribute(:work_id) { integer object[:eser_id] } + attribute(:work_type) { string object[:eser_turu] } + attribute(:yoksis_id) { integer object[:a_id] } end end end diff --git a/app/serializers/yoksis/resumes/designs_serializer.rb b/app/serializers/yoksis/resumes/designs_serializer.rb index 997860f9..3ede9f99 100644 --- a/app/serializers/yoksis/resumes/designs_serializer.rb +++ b/app/serializers/yoksis/resumes/designs_serializer.rb @@ -3,27 +3,27 @@ module Yoksis module Resumes class DesignsSerializer < Serializer - attribute(:registry_id) { integer object[:p_tasarim_id] } - attribute(:name) { string object[:tasarim_adi] } - attribute(:summary) { string object[:tasarim_ozeti] } - attribute(:type_id) { integer object[:tasarim_turu] } - attribute(:type_name) { string object[:tasarim_turu_adi] } - attribute(:type_detail_id) { integer object[:tasarim_turu_detay] } - attribute(:type_detail_name) { string object[:tasarim_turu_detay_ad] } - attribute(:date_of_start) { parse_date object[:bas_tarihi] } - attribute(:date_of_end) { parse_date object[:bitis_tarih] } - attribute(:scope_id) { integer object[:kapsam] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:owners) { split_string object[:tasarim_sahipleri] } - attribute(:title_id) { integer object[:unvan_id] } - attribute(:title_name) { string object[:unvan_ad] } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad] } - attribute(:number_of_person) { integer object[:kisi_sayisi] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:end_date) { parse_date object[:bitis_tarih] } + attribute(:id) { integer object[:p_tasarim_id] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:tasarim_adi] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:owners) { split_string object[:tasarim_sahipleri] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:start_date) { parse_date object[:bas_tarihi] } + attribute(:summary) { string object[:tasarim_ozeti] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:type_detail_id) { integer object[:tasarim_turu_detay] } + attribute(:type_detail_name) { string object[:tasarim_turu_detay_ad] } + attribute(:type_id) { integer object[:tasarim_turu] } + attribute(:type_name) { string object[:tasarim_turu_adi] } + attribute(:unit_id) { integer object[:kurum_id] } + attribute(:unit_name) { string object[:kurum_ad] } end end end diff --git a/app/serializers/yoksis/resumes/editorships_serializer.rb b/app/serializers/yoksis/resumes/editorships_serializer.rb index 9e3d884b..947d1d76 100644 --- a/app/serializers/yoksis/resumes/editorships_serializer.rb +++ b/app/serializers/yoksis/resumes/editorships_serializer.rb @@ -3,40 +3,40 @@ module Yoksis module Resumes class EditorshipsSerializer < Serializer - attribute(:publishing_id) { integer object[:yayin_id] } - attribute(:publishing_name) { string object[:yayin_adi] } - attribute(:publishing_house) { string object[:yayin_evi] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi] } - attribute(:type_id) { integer object[:editorluk_tur] } - attribute(:type_name) { string object[:editorluk_tur_ad] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:editor_duty_id) { integer object[:editor_gorev] } - attribute(:editor_duty_name) { string object[:editor_gorev_ad] } - attribute(:authors) { split_string object[:yazar_adi] } - attribute(:number_of_author) { integer object[:yazar_sayisi] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:city) { string object[:sehir] } - attribute(:index_id) { integer object[:endeks_id] } - attribute(:index) { string object[:endeks] } - attribute(:year) { integer object[:yil] } - attribute(:date_of_start) { parse_date object[:bas_tarih] } - attribute(:date_of_end) { parse_date object[:bit_tarih] } - attribute(:doi) { integer object[:doi] } - attribute(:issn) { integer object[:issn] } - attribute(:access_type_id) { integer object[:erisim_turu] } - attribute(:access_type_name) { string object[:erisim_turu_ad] } - attribute(:access_link) { string object[:erisim_linki], titleize_turkish: false } - attribute(:citations_number) { integer object[:atif_sayisi] } - attribute(:field) { string object[:alan_bilgisi] } - attribute(:keywords) { string object[:anahtar_kelime] } - attribute(:author_id) { integer object[:yazar_id] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:access_link) { string object[:erisim_linki], case_conversion: false } + attribute(:access_type_id) { integer object[:erisim_turu] } + attribute(:access_type_name) { string object[:erisim_turu_ad] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:discipline) { string object[:alan_bilgisi] } + attribute(:doi) { integer object[:doi] } + attribute(:editor_duty_id) { integer object[:editor_gorev] } + attribute(:editor_duty_name) { string object[:editor_gorev_ad] } + attribute(:end_date) { parse_date object[:bit_tarih] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:index_name) { string object[:endeks] } + attribute(:issn) { integer object[:issn] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:number_of_authors) { integer object[:yazar_sayisi] } + attribute(:number_of_citations) { integer object[:atif_sayisi] } + attribute(:publication_id) { integer object[:yayin_id] } + attribute(:publication_language_id) { integer object[:yayin_dili] } + attribute(:publication_language_name) { string object[:yayin_dili_adi] } + attribute(:publication_name) { string object[:yayin_adi] } + attribute(:publisher) { string object[:yayin_evi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:start_date) { parse_date object[:bas_tarih] } + attribute(:type_id) { integer object[:editorluk_tur] } + attribute(:type_name) { string object[:editorluk_tur_ad] } + attribute(:year) { integer object[:yil] } end end end diff --git a/app/serializers/yoksis/resumes/education_informations_serializer.rb b/app/serializers/yoksis/resumes/education_informations_serializer.rb index 7296a41e..ddf49173 100644 --- a/app/serializers/yoksis/resumes/education_informations_serializer.rb +++ b/app/serializers/yoksis/resumes/education_informations_serializer.rb @@ -3,39 +3,39 @@ module Yoksis module Resumes class EducationInformationsSerializer < Serializer - attribute(:registry_id) { integer object[:id] } - attribute(:place_id) { integer object[:yer_id] } - attribute(:place_name) { string object[:yer_ad] } - attribute(:year_of_start) { integer object[:bastar1] } - attribute(:year_of_end) { integer object[:bittar1] } - attribute(:country_id) { integer object[:ulke_id] } - attribute(:country_name) { string object[:ulke_ad] } - attribute(:other_field) { string object[:diger_alan] } - attribute(:yok_unit_id) { integer object[:birim_yok] } - attribute(:program_id) { integer object[:program_id] } - attribute(:program_name) { string object[:program_adi] } - attribute(:other_university) { string object[:diger_universite] } - attribute(:thesis_name) { string object[:tez_adi] } - attribute(:thesis_step_id) { integer object[:tez_asamasi] } - attribute(:thesis_step_name) { string object[:tez_asamasi_ad] } - attribute(:start_date_of_thesis) { integer object[:tez_bas_tar] } - attribute(:end_date_of_thesis) { integer object[:tez_bit_tar] } - attribute(:university_id) { integer object[:univ_id] } - attribute(:university_name) { string object[:unv_birim_adi] } - attribute(:academic_unit_id) { integer object[:akademik_birim_id] } - attribute(:academic_unit_name) { string object[:akademik_birim_adi] } - attribute(:faculty) { string object[:fakultebilgisi] } - attribute(:department) { string object[:bolumbilgisi] } - attribute(:field) { string object[:alanbilgisi] } - attribute(:diploma_no) { integer object[:diploma_no] } - attribute(:number_of_diploma_equivalency) { integer object[:diplomadenklik_tarih_sayi] } - attribute(:advisors_id_number) { integer object[:danisman_tc] } - attribute(:advisor) { string object[:danisman_ad_soyad] } - attribute(:c_unit_id) { integer object[:c_birim_id] } - attribute(:c_unit_name) { integer object[:c_birim_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:academic_unit_id) { integer object[:akademik_birim_id] } + attribute(:academic_unit_name) { string object[:akademik_birim_adi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:advisor) { string object[:danisman_ad_soyad] } + attribute(:advisors_id_number) { integer object[:danisman_tc] } + attribute(:c_unit_id) { integer object[:c_birim_id] } + attribute(:c_unit_name) { integer object[:c_birim_ad] } + attribute(:country_id) { integer object[:ulke_id] } + attribute(:country_name) { string object[:ulke_ad] } + attribute(:department) { string object[:bolumbilgisi] } + attribute(:diploma_equivalency) { integer object[:diplomadenklik_tarih_sayi] } + attribute(:diploma_no) { integer object[:diploma_no] } + attribute(:discipline) { string object[:alanbilgisi] } + attribute(:end_date) { integer object[:bittar1] } + attribute(:end_date_of_thesis) { integer object[:tez_bit_tar] } + attribute(:faculty) { string object[:fakultebilgisi] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location_id) { integer object[:yer_id] } + attribute(:location_name) { string object[:yer_ad] } + attribute(:other_discipline) { string object[:diger_alan] } + attribute(:other_university) { string object[:diger_universite] } + attribute(:program_id) { integer object[:program_id] } + attribute(:program_name) { string object[:program_adi] } + attribute(:start_date) { integer object[:bastar1] } + attribute(:start_date_of_thesis) { integer object[:tez_bas_tar] } + attribute(:thesis_name) { string object[:tez_adi] } + attribute(:thesis_step_id) { integer object[:tez_asamasi] } + attribute(:thesis_step_name) { string object[:tez_asamasi_ad] } + attribute(:unit_id) { integer object[:birim_yok] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:unv_birim_adi] } + attribute(:yoksis_id) { integer object[:id] } end end end diff --git a/app/serializers/yoksis/resumes/fields_serializer.rb b/app/serializers/yoksis/resumes/fields_serializer.rb index 108ca12a..a1f24209 100644 --- a/app/serializers/yoksis/resumes/fields_serializer.rb +++ b/app/serializers/yoksis/resumes/fields_serializer.rb @@ -2,15 +2,15 @@ module Yoksis module Resumes - class FieldsSerializer < Serializer - attribute(:registry_id) { integer object[:t_uak_id] } - attribute(:field_id) { integer object[:temel_alan_id] } - attribute(:field_name) { string object[:temel_alan_ad] } - attribute(:scientific_field_id) { integer object[:bilim_alan_id] } - attribute(:scientific_field_name) { string object[:bilim_alan_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + class DisciplinesSerializer < Serializer + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:id) { integer object[:temel_alan_id] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:temel_alan_ad] } + attribute(:scientific_field_id) { integer object[:bilim_alan_id] } + attribute(:scientific_field_name) { string object[:bilim_alan_ad] } + attribute(:yoksis_id) { integer object[:t_uak_id] } attribute :keywords do [ diff --git a/app/serializers/yoksis/resumes/foreign_languages_serializer.rb b/app/serializers/yoksis/resumes/foreign_languages_serializer.rb index dd0ef800..90090bf3 100644 --- a/app/serializers/yoksis/resumes/foreign_languages_serializer.rb +++ b/app/serializers/yoksis/resumes/foreign_languages_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class ForeignLanguagesSerializer < Serializer - attribute(:registry_id) { integer object[:y_id] } - attribute(:language_id) { integer object[:dil_id] } - attribute(:language_name) { string object[:dil_ad] } - attribute(:language_testing_id) { integer object[:dil_sinav_id] } - attribute(:language_testing_name) { string object[:dil_sinav_ad], ->(p) { p.upcase :turkic } } - attribute(:language_testing_point) { integer object[:puan] } - attribute(:equivalent_point) { integer object[:esdegerpuan] } - attribute(:year) { integer object[:yil] } - attribute(:term_id) { integer object[:donem_id] } - attribute(:term_name) { string object[:donem_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:equivalent_point) { integer object[:esdegerpuan] } + attribute(:language_exam_id) { integer object[:dil_sinav_id] } + attribute(:language_exam_name) { string object[:dil_sinav_ad], ->(p) { p.upcase :turkic } } + attribute(:language_id) { integer object[:dil_id] } + attribute(:language_name) { string object[:dil_ad] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:point) { integer object[:puan] } + attribute(:term_id) { integer object[:donem_id] } + attribute(:term_name) { string object[:donem_ad] } + attribute(:year) { integer object[:yil] } + attribute(:yoksis_id) { integer object[:y_id] } end end end diff --git a/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb b/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb index 658dcf01..6bf17985 100644 --- a/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb +++ b/app/serializers/yoksis/resumes/incentive_activity_declarations_serializer.rb @@ -3,13 +3,13 @@ module Yoksis module Resumes class IncentiveActivityDeclarationsSerializer < Serializer - attribute(:registry_id) { integer object[:fb_id] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } attribute(:type_id) { integer object[:tur] } attribute(:type_name) { string object[:tur_ad] } attribute(:work_id) { integer object[:eser_id] } attribute(:work_type_id) { integer object[:eser_tur] } attribute(:work_type_name) { string object[:eser_tur_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:yoksis_id) { integer object[:fb_id] } end end end diff --git a/app/serializers/yoksis/resumes/incentive_applications_serializer.rb b/app/serializers/yoksis/resumes/incentive_applications_serializer.rb index 3b02955e..9f229e96 100644 --- a/app/serializers/yoksis/resumes/incentive_applications_serializer.rb +++ b/app/serializers/yoksis/resumes/incentive_applications_serializer.rb @@ -3,11 +3,11 @@ module Yoksis module Resumes class IncentiveApplicationsSerializer < Serializer - attribute(:application_id) { integer object[:basvuru_id] } - attribute(:term_id) { integer object[:donem_id] } - attribute(:term_name) { string object[:donem_ad] } - attribute(:date_of_application) { parse_date object[:basvuru_tarihi] } - attribute(:date_of_final_application) { parse_date object[:son_islem_tarihi] } + attribute(:date) { parse_date object[:basvuru_tarihi] } + attribute(:id) { integer object[:basvuru_id] } + attribute(:last_update) { parse_date object[:son_islem_tarihi] } + attribute(:term_id) { integer object[:donem_id] } + attribute(:term_name) { string object[:donem_ad] } end end end diff --git a/app/serializers/yoksis/resumes/lectures_serializer.rb b/app/serializers/yoksis/resumes/lectures_serializer.rb index 63e83749..0d77dcfe 100644 --- a/app/serializers/yoksis/resumes/lectures_serializer.rb +++ b/app/serializers/yoksis/resumes/lectures_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class LecturesSerializer < Serializer - attribute(:lecture_id) { integer object[:ders_id] } - attribute(:lecture_name) { string object[:ders_adi] } - attribute(:education_level_id) { integer object[:ogrenim_id] } - attribute(:education_level_name) { string object[:ogrenim_adi] } - attribute(:academic_term_id) { integer object[:akademik_yil_id] } - attribute(:academic_term) { integer object[:akademik_yil] } - attribute(:language_id) { integer object[:dil_id] } - attribute(:language_name) { string object[:dil_adi] } - attribute(:weekly_course_hours) { integer object[:ders_saati] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } - attribute(:date_of_insert) { parse_datetime object[:ekleme_tarihi] } + attribute(:academic_term) { integer object[:akademik_yil] } + attribute(:academic_term_id) { integer object[:akademik_yil_id] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:education_level_id) { integer object[:ogrenim_id] } + attribute(:education_level_name) { string object[:ogrenim_adi] } + attribute(:id) { integer object[:ders_id] } + attribute(:insert_date) { parse_datetime object[:ekleme_tarihi] } + attribute(:language_id) { integer object[:dil_id] } + attribute(:language_name) { string object[:dil_adi] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:ders_adi] } + attribute(:weekly_course_hours) { integer object[:ders_saati] } end end end diff --git a/app/serializers/yoksis/resumes/memberships_serializer.rb b/app/serializers/yoksis/resumes/memberships_serializer.rb index 65468578..f8a9fe98 100644 --- a/app/serializers/yoksis/resumes/memberships_serializer.rb +++ b/app/serializers/yoksis/resumes/memberships_serializer.rb @@ -3,17 +3,17 @@ module Yoksis module Resumes class MembershipsSerializer < Serializer - attribute(:membership_id) { integer object[:uyelik_id] } - attribute(:membership_status_id) { integer object[:uyelik_durumu] } - attribute(:membership_status_name) { string object[:uyelik_durumu_ad] } - attribute(:institution_name) { string object[:kurulus_adi] } - attribute(:institution_type_id) { integer object[:kurulus_turu] } - attribute(:institution_type_name) { string object[:kurulus_turu_ad] } - attribute(:year_of_start) { integer object[:bas_tar] } - attribute(:year_of_end) { integer object[:bit_tar] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:end_date) { integer object[:bit_tar] } + attribute(:id) { integer object[:uyelik_id] } + attribute(:start_date) { integer object[:bas_tar] } + attribute(:status_id) { integer object[:uyelik_durumu] } + attribute(:status_name) { string object[:uyelik_durumu_ad] } + attribute(:unit_name) { string object[:kurulus_adi] } + attribute(:unit_type_id) { integer object[:kurulus_turu] } + attribute(:unit_type_name) { string object[:kurulus_turu_ad] } end end end diff --git a/app/serializers/yoksis/resumes/other_experiences_serializer.rb b/app/serializers/yoksis/resumes/other_experiences_serializer.rb index 34459d5f..f73ff724 100644 --- a/app/serializers/yoksis/resumes/other_experiences_serializer.rb +++ b/app/serializers/yoksis/resumes/other_experiences_serializer.rb @@ -3,19 +3,19 @@ module Yoksis module Resumes class OtherExperiencesSerializer < Serializer - attribute(:experience_id) { string object[:deneyim_id] } - attribute(:university_id) { integer object[:kurulus_id] } - attribute(:university_name) { string object[:kurulus_adi] } - attribute(:duty_name) { string object[:gorev_adi] } - attribute(:year_of_start) { integer object[:bas_tar] } - attribute(:year_of_end) { integer object[:bit_tar] } - attribute(:job_description) { string object[:is_tanimi] } - attribute(:workplace_type_id) { integer object[:isyeri_tur_id] } - attribute(:workplace_type_name) { string object[:isyeri_tur_ad] } - attribute(:position_type) { string object[:calisma_durumu] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:duty_name) { string object[:gorev_adi] } + attribute(:end_date) { integer object[:bit_tar] } + attribute(:id) { string object[:deneyim_id] } + attribute(:job_description) { string object[:is_tanimi] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:position_type) { string object[:calisma_durumu] } + attribute(:start_date) { integer object[:bas_tar] } + attribute(:unit_id) { integer object[:kurulus_id] } + attribute(:unit_name) { string object[:kurulus_adi] } + attribute(:workplace_type_id) { integer object[:isyeri_tur_id] } + attribute(:workplace_type_name) { string object[:isyeri_tur_ad] } end end end diff --git a/app/serializers/yoksis/resumes/papers_serializer.rb b/app/serializers/yoksis/resumes/papers_serializer.rb index 3110d7d7..4f4ab807 100644 --- a/app/serializers/yoksis/resumes/papers_serializer.rb +++ b/app/serializers/yoksis/resumes/papers_serializer.rb @@ -3,44 +3,44 @@ module Yoksis module Resumes class PapersSerializer < Serializer - attribute(:publishing_id) { integer object[:yayin_id] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi] } - attribute(:publishing_status_id) { integer object[:yayin_durumu] } - attribute(:publishing_status_name) { string object[:yayin_durumu_ad] } - attribute(:presentation_type_id) { integer object[:bildiri_sunum_turu] } - attribute(:presentation_type_name) { string object[:bildiri_sunum_turu_ad] } - attribute(:name) { string object[:bildiri_adi] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:type_id) { integer object[:bildiri_tur_id] } - attribute(:type_name) { string object[:bildiri_tur] } - attribute(:author_id) { integer object[:yazar_id] } - attribute(:number_of_author) { integer object[:yazar_sayisi] } - attribute(:authors) { split_string object[:yazar_adi] } - attribute(:city) { string object[:sehir] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:date_of_release) { parse_date object[:basim_tarihi] } - attribute(:release_type_id) { integer object[:basim_turu] } - attribute(:release_type_name) { string object[:basim_turu_ad] } - attribute(:volume) { integer object[:cilt] } - attribute(:issue) { integer object[:sayi] } - attribute(:first_page) { integer object[:ilk_sayfa] } - attribute(:last_page) { integer object[:son_sayfa] } - attribute(:doi) { integer object[:doi] } - attribute(:issn) { integer object[:issn] } - attribute(:print_isbn) { integer object[:print_isbn] } - attribute(:access_link) { string object[:access_link], titleize_turkish: false } - attribute(:number_of_citation) { integer object[:atif_sayisi] } - attribute(:field) { string object[:alan_bilgisi] } - attribute(:keywords) { string object[:anahtar_kelime] } - attribute(:special_edition_id) { integer object[:ozel_sayi] } - attribute(:special_edition_name) { string object[:ozel_sayi_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:access_link) { string object[:access_link], case_conversion: false } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:author_id) { integer object[:yazar_id] } + attribute(:authors) { split_string object[:yazar_adi] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:discipline) { string object[:alan_bilgisi] } + attribute(:doi) { integer object[:doi] } + attribute(:first_page) { integer object[:ilk_sayfa] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:issn) { integer object[:issn] } + attribute(:issue) { integer object[:sayi] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:last_page) { integer object[:son_sayfa] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:bildiri_adi] } + attribute(:number_of_authors) { integer object[:yazar_sayisi] } + attribute(:number_of_citations) { integer object[:atif_sayisi] } + attribute(:presentation_type_id) { integer object[:bildiri_sunum_turu] } + attribute(:presentation_type_name) { string object[:bildiri_sunum_turu_ad] } + attribute(:print_isbn) { integer object[:print_isbn] } + attribute(:publication_id) { integer object[:yayin_id] } + attribute(:publication_language_id) { integer object[:yayin_dili] } + attribute(:publication_language_name) { string object[:yayin_dili_adi] } + attribute(:publication_status_id) { integer object[:yayin_durumu] } + attribute(:publication_status_name) { string object[:yayin_durumu_ad] } + attribute(:release_date) { parse_date object[:basim_tarihi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:special_issue_id) { integer object[:ozel_sayi] } + attribute(:special_issue_name) { string object[:ozel_sayi_ad] } + attribute(:type_id) { integer object[:bildiri_tur_id] } + attribute(:type_name) { string object[:bildiri_tur] } + attribute(:type_of_release_id) { integer object[:basim_turu] } + attribute(:type_of_release_name) { string object[:basim_turu_ad] } + attribute(:volume) { integer object[:cilt] } end end end diff --git a/app/serializers/yoksis/resumes/patents_serializer.rb b/app/serializers/yoksis/resumes/patents_serializer.rb index 920485ae..5d8e98fb 100644 --- a/app/serializers/yoksis/resumes/patents_serializer.rb +++ b/app/serializers/yoksis/resumes/patents_serializer.rb @@ -3,28 +3,28 @@ module Yoksis module Resumes class PatentsSerializer < Serializer - attribute(:patent_id) { integer object[:patent_id] } - attribute(:name) { string object[:patent_adi] } - attribute(:no) { integer object[:patent_no] } - attribute(:class) { string object[:patent_sinif], ->(p) { p.upcase :turkic } } - attribute(:year) { integer object[:patent_tarihi] } - attribute(:applicants) { split_string object[:basvuru_sahipleri] } - attribute(:inventors) { split_string object[:bulus_sahipleri] } - attribute(:number_of_person) { integer object[:kisi_sayisi] } - attribute(:category_id) { integer object[:kategori_id] } - attribute(:category_name) { string object[:kategori] } - attribute(:file_type_id) { integer object[:dosya_tipi_id] } - attribute(:file_type_name) { string object[:dosya_tipi] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam] } - attribute(:title_id) { integer object[:unvan_id] } - attribute(:title_name) { string object[:unvan_ad] } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:applicants) { split_string object[:basvuru_sahipleri] } + attribute(:category_id) { integer object[:kategori_id] } + attribute(:category_name) { string object[:kategori] } + attribute(:class) { string object[:patent_sinif], ->(p) { p.upcase :turkic } } + attribute(:date) { integer object[:patent_tarihi] } + attribute(:file_type_id) { integer object[:dosya_tipi_id] } + attribute(:file_type_name) { string object[:dosya_tipi] } + attribute(:id) { integer object[:patent_id] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:inventors) { split_string object[:bulus_sahipleri] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:name) { string object[:patent_adi] } + attribute(:no) { integer object[:patent_no] } + attribute(:number_of_person) { integer object[:kisi_sayisi] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:unit_id) { integer object[:kurum_id] } + attribute(:unit_name) { string object[:kurum_ad] } end end end diff --git a/app/serializers/yoksis/resumes/projects_serializer.rb b/app/serializers/yoksis/resumes/projects_serializer.rb index 03210f8e..e4dc9cf3 100644 --- a/app/serializers/yoksis/resumes/projects_serializer.rb +++ b/app/serializers/yoksis/resumes/projects_serializer.rb @@ -3,30 +3,30 @@ module Yoksis module Resumes class ProjectsSerializer < Serializer - attribute(:project_id) { integer object[:proje_id] } - attribute(:name) { string object[:proje_ad] } - attribute(:subject) { string object[:proje_konusu] } - attribute(:status_id) { integer object[:proje_durumu_id] } - attribute(:status_name) { string object[:proje_durumu_ad] } - attribute(:budget) { integer object[:butce] } - attribute(:location_id) { integer object[:proje_konumu_id] } - attribute(:location_name) { string object[:proje_konumu_ad] } - attribute(:type_id) { integer object[:proje_turu_id] } - attribute(:type_name) { string object[:proje_turu_ad] } - attribute(:currency_id) { integer object[:para_birimi_id] } - attribute(:currency_name) { string object[:para_birimi_ad] } - attribute(:scope_id) { integer object[:kapsam] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:title_id) { integer object[:unvan_id] } - attribute(:title_name) { string object[:unvan_ad] } - attribute(:institution_id) { integer object[:kurum_id] } - attribute(:institution_name) { string object[:kurum_ad] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:budget) { integer object[:butce] } + attribute(:currency_id) { integer object[:para_birimi_id] } + attribute(:currency_name) { string object[:para_birimi_ad] } + attribute(:id) { integer object[:proje_id] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location_id) { integer object[:proje_konumu_id] } + attribute(:location_name) { string object[:proje_konumu_ad] } + attribute(:name) { string object[:proje_ad] } + attribute(:scope_id) { integer object[:kapsam] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:status_id) { integer object[:proje_durumu_id] } + attribute(:status_name) { string object[:proje_durumu_ad] } + attribute(:subject) { string object[:proje_konusu] } + attribute(:title_id) { integer object[:unvan_id] } + attribute(:title_name) { string object[:unvan_ad] } + attribute(:type_id) { integer object[:proje_turu_id] } + attribute(:type_name) { string object[:proje_turu_ad] } + attribute(:unit_id) { integer object[:kurum_id] } + attribute(:unit_name) { string object[:kurum_ad] } - attribute :date_of_start do + attribute :start_date do next unless object[:bas_tar] year, month, day = object[:bas_tar].split('.').reverse @@ -34,7 +34,7 @@ class ProjectsSerializer < Serializer end - attribute :date_of_end do + attribute :end_date do next unless object[:bit_tar] year, month, day = object[:bit_tar].split('.').reverse diff --git a/app/serializers/yoksis/resumes/refereeing_serializer.rb b/app/serializers/yoksis/resumes/refereeing_serializer.rb index 49f30b52..a0a32eab 100644 --- a/app/serializers/yoksis/resumes/refereeing_serializer.rb +++ b/app/serializers/yoksis/resumes/refereeing_serializer.rb @@ -3,27 +3,27 @@ module Yoksis module Resumes class RefereeingSerializer < Serializer - attribute(:publishing_id) { integer object[:yayin_id] } - attribute(:publishing_place) { string object[:yayin_yeri] } - attribute(:publishing_language_id) { integer object[:yayin_dili] } - attribute(:publishing_language_name) { string object[:yayin_dili_adi] } - attribute(:type_id) { integer object[:hakemlik_turu] } - attribute(:type_name) { string object[:hakemlik_turu_ad] } - attribute(:number_of_refereeing) { integer object[:hakemlik_sayisi] } - attribute(:scope_id) { integer object[:kapsam_id] } - attribute(:scope_name) { string object[:kapsam_ad] } - attribute(:country_id) { integer object[:ulke] } - attribute(:country_name) { string object[:ulke_adi] } - attribute(:city) { string object[:sehir] } - attribute(:index_id) { integer object[:endeks_id] } - attribute(:index) { string object[:endeks], titleize_turkish: false } - attribute(:year) { integer object[:yil] } - attribute(:field) { string object[:alan_bilgisi] } - attribute(:keywords) { string object[:anahtar_kelime] } - attribute(:active_or_passive_id) { integer object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:incentive_points) { float object[:tesv_puan] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { integer object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:city) { string object[:sehir] } + attribute(:country_id) { integer object[:ulke] } + attribute(:country_name) { string object[:ulke_adi] } + attribute(:discipline) { string object[:alan_bilgisi] } + attribute(:incentive_point) { float object[:tesv_puan] } + attribute(:index) { string object[:endeks], case_conversion: false } + attribute(:index_id) { integer object[:endeks_id] } + attribute(:keywords) { split_string object[:anahtar_kelime] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:number_of_refereeing) { integer object[:hakemlik_sayisi] } + attribute(:publication_id) { integer object[:yayin_id] } + attribute(:publication_language_id) { integer object[:yayin_dili] } + attribute(:publication_language_name) { string object[:yayin_dili_adi] } + attribute(:publication_place) { string object[:yayin_yeri] } + attribute(:scope_id) { integer object[:kapsam_id] } + attribute(:scope_name) { string object[:kapsam_ad] } + attribute(:type_id) { integer object[:hakemlik_turu] } + attribute(:type_name) { string object[:hakemlik_turu_ad] } + attribute(:year) { integer object[:yil] } end end end diff --git a/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb b/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb index f7b94363..d4bb1327 100644 --- a/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb +++ b/app/serializers/yoksis/resumes/thesis_advisors_serializer.rb @@ -3,23 +3,23 @@ module Yoksis module Resumes class ThesisAdvisorsSerializer < Serializer - attribute(:data_source) { string object[:verikaynak] } - attribute(:name) { string object[:tez_adi] } - attribute(:type_id) { integer object[:tur_id] } - attribute(:type_name) { string object[:tur_adi] } - attribute(:place_id) { integer object[:yer_id] } - attribute(:place_name) { string object[:yer_adi] } - attribute(:country) { string object[:ulke] } - attribute(:year) { integer object[:yil] } - attribute(:registry_id) { integer object[:kayit_id] } - attribute(:status) { string object[:durum_adi] } - attribute(:author) { string "#{object[:yazar_adi]} #{object[:yazar_soyadi]}" } - attribute(:university) { string object[:universite_ad] } - attribute(:major) { string object[:abd_ad] } - attribute(:institution) { string object[:enstitu_ad] } - attribute(:active_or_passive_id) { float object[:aktif_pasif] } - attribute(:active_or_passive_name) { string object[:aktif_pasif_ad] } - attribute(:date_of_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:activity_id) { float object[:aktif_pasif] } + attribute(:activity_name) { string object[:aktif_pasif_ad] } + attribute(:author) { string "#{object[:yazar_adi]} #{object[:yazar_soyadi]}" } + attribute(:country) { string object[:ulke] } + attribute(:data_source) { string object[:verikaynak] } + attribute(:last_update) { parse_datetime object[:guncelleme_tarihi] } + attribute(:location_id) { integer object[:yer_id] } + attribute(:location_name) { string object[:yer_adi] } + attribute(:major) { string object[:abd_ad] } + attribute(:name) { string object[:tez_adi] } + attribute(:status) { string object[:durum_adi] } + attribute(:type_id) { integer object[:tur_id] } + attribute(:type_name) { string object[:tur_adi] } + attribute(:unit_name) { string object[:enstitu_ad] } + attribute(:university_name) { string object[:universite_ad] } + attribute(:year) { integer object[:yil] } + attribute(:yoksis_id) { integer object[:kayit_id] } end end end diff --git a/app/serializers/yoksis/students/informations_serializer.rb b/app/serializers/yoksis/students/informations_serializer.rb index 7abd3a6a..7960e72b 100644 --- a/app/serializers/yoksis/students/informations_serializer.rb +++ b/app/serializers/yoksis/students/informations_serializer.rb @@ -14,13 +14,13 @@ class InformationsSerializer < Serializer fathers_name: string(informations[:baba_adi]), mothers_name: string(informations[:anne_adi]), date_of_birth: build_date(*informations[:dogum_tarihi].values_at(:yil, :ay, :gun)), - nationality: { - code: integer(informations.dig(:uyrugu, :kod)), - name: string(informations.dig(:uyrugu, :ad)) - }, gender: { code: integer(informations.dig(:cinsiyeti, :kod)), name: string(informations.dig(:cinsiyeti, :ad)) + }, + nationality: { + code: integer(informations.dig(:uyrugu, :kod)), + name: string(informations.dig(:uyrugu, :ad)) } } end @@ -30,16 +30,28 @@ class InformationsSerializer < Serializer next unless informations[:kayit_tarihi] { - student_number: integer(informations[:ogrenci_no]), - entrance_point: float(informations[:giris_puani]), current_term: integer(informations[:aktif_donem_no]), ects: float(informations[:akts]), + entrance_point: float(informations[:giris_puani]), prep_term: integer(informations[:kac_donem_hazirlik]), registration_date: build_datetime(*informations[:kayit_tarihi].values_at(:yil, :ay, :gun, :saat, :dakika, :saniye)), - prep_class: { - code: integer(informations.dig(:hazirlik_sinifi, :kod)), - name: string(informations.dig(:hazirlik_sinifi, :ad)) + student_number: integer(informations[:ogrenci_no]), + disability_rate: integer(informations[:engel_orani]), + disability_type: { + code: integer(informations.dig(:engel_turu, :kod)), + name: string(informations.dig(:engel_turu, :ad)) }, + diploma: { + gpa: float(informations.dig(:diploma, :notu)), + grading_system: float(informations.dig(:diploma, :not_sistemi)), + no: integer(informations.dig(:diploma, :no)) + }, + dropout_date: build_date(*informations[:ayrilma_tarihi].values_at(:yil, :ay, :gun)), + dropout_type: { + code: integer(informations.dig(:ayrilma_nedeni, :kod)), + name: string(informations.dig(:ayrilma_nedeni, :ad)) + }, + end_date_of_studentship_right: build_date(*informations[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun)), entrance_point_type: { code: integer(informations.dig(:giris_puan_turu, :kod)), name: string(informations.dig(:giris_puan_turu, :ad), ->(p) { p.upcase :turkic }) @@ -48,34 +60,22 @@ class InformationsSerializer < Serializer code: integer(informations.dig(:giris_turu, :kod)), name: string(informations.dig(:giris_turu, :ad), ->(p) { p.upcase :turkic }) }, + martyrs_relative: { + code: integer(informations.dig(:gazi_sehit_yakini, :kod)), + name: string(informations.dig(:gazi_sehit_yakini, :ad)) + }, + prep_class: { + code: integer(informations.dig(:hazirlik_sinifi, :kod)), + name: string(informations.dig(:hazirlik_sinifi, :ad)) + }, rights: { code: integer(informations.dig(:ogrencilik_hakki_varmi, :kod)), name: string(informations.dig(:ogrencilik_hakki_varmi, :ad)) }, - end_date_of_studentship_right: build_date(*informations[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun)), status: { code: integer(informations.dig(:ogrencilik_statusu, :kod)), name: string(informations.dig(:ogrencilik_statusu, :ad)) }, - disability_type: { - code: integer(informations.dig(:engel_turu, :kod)), - name: string(informations.dig(:engel_turu, :ad)) - }, - disability_rate: integer(informations[:engel_orani]), - dropout_type: { - code: integer(informations.dig(:ayrilma_nedeni, :kod)), - name: string(informations.dig(:ayrilma_nedeni, :ad)) - }, - dropout_date: build_date(*informations[:ayrilma_tarihi].values_at(:yil, :ay, :gun)), - martyrs_relative: { - code: integer(informations.dig(:gazi_sehit_yakini, :kod)), - name: string(informations.dig(:gazi_sehit_yakini, :ad)) - }, - diploma: { - gpa: float(informations.dig(:diploma, :notu)), - grading_system: float(informations.dig(:diploma, :not_sistemi)), - no: integer(informations.dig(:diploma, :no)) - } } end @@ -84,35 +84,23 @@ class InformationsSerializer < Serializer next unless informations.dig(:birim, :kod) { + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false), long_name: string(informations[:birim_uzun_adi]), - english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false), + osym_id: integer(informations[:kilavuz_kodu]), parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), period_of_study: integer(informations[:ogrenim_suresi]), - osym_id: integer(informations[:kilavuz_kodu]), - university: { - code: integer(informations.dig(:universite, :kod)), - name: string(informations.dig(:universite, :ad)) - }, - university_type: { - code: integer(informations.dig(:universite_turu, :kod)), - name: string(informations.dig(:universite_turu, :ad)) - }, - unit: { - code: integer(informations.dig(:birim, :kod)), - name: string(informations.dig(:birim, :ad)) + city: { + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) }, - unit_type: { - code: integer(informations.dig(:birim_turu, :kod)), - name: string(informations.dig(:birim_turu, :ad)) + district: { + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) }, faculty: { code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), name: string(informations.dig(:fakulte_yo_myo_enstitu, :ad)) }, - status: { - code: integer(informations.dig(:aktiflik, :kod)), - name: string(informations.dig(:aktiflik, :ad)) - }, instruction_language: { code: integer(informations.dig(:ogrenim_dili, :kod)), name: string(informations.dig(:ogrenim_dili, :ad)) @@ -121,13 +109,25 @@ class InformationsSerializer < Serializer code: integer(informations.dig(:ogrenim_turu, :kod)), name: string(informations.dig(:ogrenim_turu, :ad)) }, - city: { - code: integer(informations.dig(:il, :kod)), - name: string(informations.dig(:il, :ad)) + unit: { + code: integer(informations.dig(:birim, :kod)), + name: string(informations.dig(:birim, :ad)) }, - district: { - code: integer(informations.dig(:ilce, :kod)), - name: string(informations.dig(:ilce, :ad)) + unit_type: { + code: integer(informations.dig(:birim_turu, :kod)), + name: string(informations.dig(:birim_turu, :ad)) + }, + university: { + code: integer(informations.dig(:universite, :kod)), + name: string(informations.dig(:universite, :ad)) + }, + university_type: { + code: integer(informations.dig(:universite_turu, :kod)), + name: string(informations.dig(:universite_turu, :ad)) + }, + status: { + code: integer(informations.dig(:aktiflik, :kod)), + name: string(informations.dig(:aktiflik, :ad)) } } end @@ -137,11 +137,31 @@ class InformationsSerializer < Serializer next unless informations.dig(:universite, :kod) { + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false), long_name: string(informations[:birim_uzun_adi]), - english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false), + osym_id: integer(informations[:kilavuz_kodu]), parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), period_of_study: integer(informations[:ogrenim_suresi]), - osym_id: integer(informations[:kilavuz_kodu]), + city: { + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) + }, + district: { + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) + }, + faculty: { + code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(informations.dig(:fakulte_yo_myo_enstitu, :ad)) + }, + instruction_language: { + code: integer(informations.dig(:ogrenim_dili, :kod)), + name: string(informations.dig(:ogrenim_dili, :ad)) + }, + instruction_type: { + code: integer(informations.dig(:ogrenim_turu, :kod)), + name: string(informations.dig(:ogrenim_turu, :ad)) + }, university: { code: integer(informations.dig(:universite, :kod)), name: string(informations.dig(:universite, :ad)) @@ -158,29 +178,9 @@ class InformationsSerializer < Serializer code: integer(informations.dig(:birim_turu, :kod)), name: string(informations.dig(:birim_turu, :ad)) }, - faculty: { - code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), - name: string(informations.dig(:fakulte_yo_myo_enstitu, :ad)) - }, status: { code: integer(informations.dig(:aktiflik, :kod)), name: string(informations.dig(:aktiflik, :ad)) - }, - instruction_language: { - code: integer(informations.dig(:ogrenim_dili, :kod)), - name: string(informations.dig(:ogrenim_dili, :ad)) - }, - instruction_type: { - code: integer(informations.dig(:ogrenim_turu, :kod)), - name: string(informations.dig(:ogrenim_turu, :ad)) - }, - city: { - code: integer(informations.dig(:il, :kod)), - name: string(informations.dig(:il, :ad)) - }, - district: { - code: integer(informations.dig(:ilce, :kod)), - name: string(informations.dig(:ilce, :ad)) } } end diff --git a/app/serializers/yoksis/units/changes_serializer.rb b/app/serializers/yoksis/units/changes_serializer.rb index d4adfbca..6bfe7dd4 100644 --- a/app/serializers/yoksis/units/changes_serializer.rb +++ b/app/serializers/yoksis/units/changes_serializer.rb @@ -3,10 +3,17 @@ module Yoksis module Units class ChangesSerializer < Serializer + attribute(:parent_unit_id) { string object[:bagli_oldugu_birim_id] } attribute(:unit_id) { integer object[:birim_id] } attribute(:unit_name) { string object[:birim_adi] } - attribute(:parent_unit_id) { string object[:bagli_oldugu_birim_id] } - attribute(:date_of_update) { parse_datetime object[:degisiklik_tarihi] } + attribute(:update_date) { parse_datetime object[:degisiklik_tarihi] } + + attribute :change_type do + { + code: integer(object.dig(:degisiklik_turu, :kod)), + name: string(object.dig(:degisiklik_turu, :ad)) + } + end attribute :unit_type do { @@ -21,13 +28,6 @@ class ChangesSerializer < Serializer name: string(object.dig(:aktiflik, :ad)) } end - - attribute :change_type do - { - code: integer(object.dig(:degisiklik_turu, :kod)), - name: string(object.dig(:degisiklik_turu, :ad)) - } - end end end end diff --git a/app/serializers/yoksis/units/units_serializer.rb b/app/serializers/yoksis/units/units_serializer.rb index ab64f15a..394c37cc 100644 --- a/app/serializers/yoksis/units/units_serializer.rb +++ b/app/serializers/yoksis/units/units_serializer.rb @@ -3,44 +3,44 @@ module Yoksis module Units class UnitsSerializer < Serializer - attribute(:long_name) { string object[:birim_uzun_adi] } - attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false } - attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } - attribute(:period_of_study) { integer object[:ogrenim_suresi] } - attribute(:osym_id) { integer object[:kilavuz_kodu] } + attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false } + attribute(:long_name) { string object[:birim_uzun_adi] } + attribute(:osym_id) { integer object[:kilavuz_kodu] } + attribute(:parent_unit_id) { integer object[:bagli_oldugu_birim_id] } + attribute(:period_of_study) { integer object[:ogrenim_suresi] } - attribute :university do + attribute :city do { - code: integer(object.dig(:universite, :kod)), - name: string(object.dig(:universite, :ad)) + code: integer(object.dig(:il, :kod)), + name: string(object.dig(:il, :ad)) } end - attribute :university_type do + attribute :district do { - code: integer(object.dig(:universite_turu, :kod)), - name: string(object.dig(:universite_turu, :ad)) + code: integer(object.dig(:ilce, :kod)), + name: string(object.dig(:ilce, :ad)) } end - attribute :unit do + attribute :faculty do { - code: integer(object.dig(:birim, :kod)), - name: string(object.dig(:birim, :ad)) + code: integer(object.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(object.dig(:fakulte_yo_myo_enstitu, :ad)) } end - attribute :unit_type do + attribute :instruction_language do { - code: integer(object.dig(:birim_turu, :kod)), - name: string(object.dig(:birim_turu, :ad)) + code: integer(object.dig(:ogrenim_dili, :kod)), + name: string(object.dig(:ogrenim_dili, :ad)) } end - attribute :faculty do + attribute :instruction_type do { - code: integer(object.dig(:fakulte_yo_myo_enstitu, :kod)), - name: string(object.dig(:fakulte_yo_myo_enstitu, :ad)) + code: integer(object.dig(:ogrenim_turu, :kod)), + name: string(object.dig(:ogrenim_turu, :ad)) } end @@ -51,31 +51,31 @@ class UnitsSerializer < Serializer } end - attribute :instruction_language do + attribute :unit do { - code: integer(object.dig(:ogrenim_dili, :kod)), - name: string(object.dig(:ogrenim_dili, :ad)) + code: integer(object.dig(:birim, :kod)), + name: string(object.dig(:birim, :ad)) } end - attribute :instruction_type do + attribute :unit_type do { - code: integer(object.dig(:ogrenim_turu, :kod)), - name: string(object.dig(:ogrenim_turu, :ad)) + code: integer(object.dig(:birim_turu, :kod)), + name: string(object.dig(:birim_turu, :ad)) } end - attribute :city do + attribute :university do { - code: integer(object.dig(:il, :kod)), - name: string(object.dig(:il, :ad)) + code: integer(object.dig(:universite, :kod)), + name: string(object.dig(:universite, :ad)) } end - attribute :district do + attribute :university_type do { - code: integer(object.dig(:ilce, :kod)), - name: string(object.dig(:ilce, :ad)) + code: integer(object.dig(:universite_turu, :kod)), + name: string(object.dig(:universite_turu, :ad)) } end end diff --git a/app/serializers/yoksis/units/universities_serializer.rb b/app/serializers/yoksis/units/universities_serializer.rb index 8dd550a6..a21a85c5 100644 --- a/app/serializers/yoksis/units/universities_serializer.rb +++ b/app/serializers/yoksis/units/universities_serializer.rb @@ -3,26 +3,19 @@ module Yoksis module Units class UniversitiesSerializer < Serializer - attribute(:unit_id) { integer object[:birim_id] } - attribute(:name) { string object[:birim_adi] } - attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, titleize_turkish: false } - attribute(:phone) { string object[:telefon] } - attribute(:fax) { string object[:faks] } - attribute(:address) { string object[:adres] } - attribute(:website) { string object[:web] } - attribute(:email) { string object[:eposta] } + attribute(:address) { string object[:adres] } + attribute(:email) { string object[:eposta] } + attribute(:english_name) { string object[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false } + attribute(:fax) { string object[:faks] } + attribute(:name) { string object[:birim_adi] } + attribute(:phone) { string object[:telefon] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:website) { string object[:web] } - attribute :university_type do - { - code: integer(object.dig(:universite_turu, :kod)), - name: string(object.dig(:universite_turu, :ad)) - } - end - - attribute :status do + attribute :big_city do { - code: integer(object.dig(:aktiflik, :kod)), - name: string(object.dig(:aktiflik, :ad)) + code: integer(object.dig(:buyuksehir, :kod)), + name: string(object.dig(:buyuksehir, :ad)) } end @@ -40,17 +33,24 @@ class UniversitiesSerializer < Serializer } end - attribute :big_city do + attribute :seaside do { - code: integer(object.dig(:buyuksehir, :kod)), - name: string(object.dig(:buyuksehir, :ad)) + code: integer(object.dig(:deniz_kiyisi, :kod)), + name: string(object.dig(:deniz_kiyisi, :ad)) } end - attribute :seaside do + attribute :status do { - code: integer(object.dig(:deniz_kiyisi, :kod)), - name: string(object.dig(:deniz_kiyisi, :ad)) + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) + } + end + + attribute :university_type do + { + code: integer(object.dig(:universite_turu, :kod)), + name: string(object.dig(:universite_turu, :ad)) } end end From f1c0387acce59135407b64b7f9a4448ae28dbb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Wed, 17 Oct 2018 12:37:51 +0300 Subject: [PATCH 12/13] Update outdated gems --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2165f4a8..af7df124 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,7 +91,7 @@ GEM httpi (2.4.4) rack socksify - i18n (1.1.0) + i18n (1.1.1) concurrent-ruby (~> 1.0) ice_nine (0.11.2) jaro_winkler (1.5.1) @@ -104,7 +104,7 @@ GEM loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.0) + mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) @@ -116,7 +116,7 @@ GEM msgpack (1.2.4) multi_json (1.13.1) nio4r (2.3.1) - nokogiri (1.8.4) + nokogiri (1.8.5) mini_portile2 (~> 2.3.0) nori (2.6.0) parallel (1.12.1) @@ -163,14 +163,14 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - reek (5.0.2) + reek (5.2.0) codeclimate-engine-rb (~> 0.4.0) kwalify (~> 0.7.0) parser (>= 2.5.0.0, < 2.6, != 2.5.1.1) rainbow (>= 2.0, < 4.0) - rollbar (2.17.0) + rollbar (2.18.0) multi_json - rubocop (0.59.1) + rubocop (0.59.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) From dee4e0edecbc014c2b9b3460cc38a261ffc50393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Tekinaslan?= Date: Wed, 17 Oct 2018 13:44:29 +0300 Subject: [PATCH 13/13] Minor fixes --- app/serializers/kps/queries/addresses_serializer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/serializers/kps/queries/addresses_serializer.rb b/app/serializers/kps/queries/addresses_serializer.rb index edb10458..1a7c39ce 100644 --- a/app/serializers/kps/queries/addresses_serializer.rb +++ b/app/serializers/kps/queries/addresses_serializer.rb @@ -71,7 +71,7 @@ class AddressesSerializer < Serializer declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), municipality_address: string(address[:belde_adresi]), reason_of_relocation: string(address[:tasinma_neden]), - registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)), relocation_date: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), village_address: string(address[:koy_adresi]), } @@ -96,7 +96,7 @@ class AddressesSerializer < Serializer daclaration_date: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), municipality_address: string(address[:belde_adresi]), reason_of_relocation: string(address[:tasinma_neden]), - registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)) + registration_date: build_date(*address[:tescil_tarihi].values_at(:yil, :ay, :gun)), relocation_date: build_date(*address[:tasinma_tarihi].values_at(:yil, :ay, :gun)), village_address: string(address[:koy_adresi]), }