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) diff --git a/app/serializers/kps/queries/addresses_serializer.rb b/app/serializers/kps/queries/addresses_serializer.rb index 45f58fec..1a7c39ce 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 - }, - 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 - }, 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), - 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 - }, + block: string(address.dig(:il_ilce_merkez_adresi, :bina_ada)), + 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)), 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)) + }, + 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: 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)) + }, + 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: 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)) + }, + 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: 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)) + abroad_address: string(address[:yurt_disi_adresi]), + daclaration_date: build_date(*address[:beyan_tarihi].values_at(:yil, :ay, :gun)), + 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)), + 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 << { - 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, + address_no: integer(address[:adres_no]), + declarant_id_number: integer(address[:beyanda_bulunan_kimlik_no]), + full_address: string(address[:acik_adres]), 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)) + 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]), + 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 b779b7a9..9c2061d6 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,78 +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)) + 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 = { 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: { - code: personal_informations.dig(:ulke, :kod).safe_to_i, - description: personal_informations.dig(:ulke, :aciklama).titleize_tr + id_number: integer(personal_informations[: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] 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: { - code: card_informations.dig(:uyruk, :kod).safe_to_i, - description: card_informations.dig(:uyruk, :aciklama).titleize_tr + nationality: card_informations[:uyruk] && { + code: integer(card_informations.dig(:uyruk, :kod)), + description: string(card_informations.dig(:uyruk, :aciklama)) }, 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: 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: { - code: card_informations.dig(:verilis_neden, :kod).safe_to_i, - description: card_informations.dig(:verilis_neden, :aciklama).titleize_tr - }, - issuing_date: build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)) + 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]), + 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)) + } } next unless [personal_informations, card_informations].any? @@ -100,74 +100,74 @@ 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, + 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_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 = { - religion: personal_informations.dig(:durum_bilgisi, :din).titleize_tr, + 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: 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 - }, - date_of_death: build_date(*personal_informations.dig(:durum_bilgisi, :olum_tarih).values_at(:yil, :ay, :gun)) + code: integer(personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod)), + description: string(personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama)) + } } 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)) + 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: 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]), + 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 @@ -175,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)), - 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 - }, + 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]), + date_of_birth: old_identity_card_informations[:dogum_tarih] && build_date(*old_identity_card_informations[:dogum_tarih].values_at(:yil, :ay, :gun)), + issuing_date: old_identity_card_informations[:verilme_tarih] && build_date(*old_identity_card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)), + 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: 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)) + }, + 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: 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], case_conversion: 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, - date_of_expiration: new_identity_card_informations[:son_gecerlilik_tarih] && build_date(*new_identity_card_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)), + 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]), 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, 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, + 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,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 }, 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: 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 }, case_conversion: 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]), + 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: 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..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) { 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(:release_date) { parse_date object[:aciklama_tarihi] } end end end diff --git a/app/serializers/serializer.rb b/app/serializers/serializer.rb index 60a51cb6..acbefaff 100644 --- a/app/serializers/serializer.rb +++ b/app/serializers/serializer.rb @@ -1,13 +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: ',', case_conversion: true) + return unless object + raise TypeError, "#{object} is not a String" unless object.is_a?(String) + + splitted = object.split(separator) + splitted.map!(&:titleize_turkish) if case_conversion + + block ? splitted.try(&block) : splitted + end + + def string(object, block = nil, case_conversion: 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 = case_conversion ? str.titleize_turkish : str + block ? str.try(&block) : str + end + def build_date(*args) - return if nil.in?(args) - Date.new(*args.collect(&:safe_to_i)) + return unless args.all? + + args.map! do |arg| + case arg + when Nori::StringWithAttributes, String + arg.to_i + end + end + + Date.new(*args) + 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) end - def build_time(*args) - return if nil.in?(args) - Time.utc(*args.collect(&:safe_to_i)) + def parse_date(object) + return unless object + + Date.parse object.to_s + end + + def parse_datetime(object) + return unless object + + DateTime.parse object.to_s end end diff --git a/app/serializers/yoksis/graduates/informations_serializer.rb b/app/serializers/yoksis/graduates/informations_serializer.rb index 77c8e3c0..fd835af8 100644 --- a/app/serializers/yoksis/graduates/informations_serializer.rb +++ b/app/serializers/yoksis/graduates/informations_serializer.rb @@ -3,29 +3,33 @@ 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(: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(:mothers_name) { string object[:anne_adi] } + attribute(:program) { string object[:program_adi] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:university_id) { integer object[:univ_id] } + attribute(:university_name) { string object[:universite_adi] } attribute :date_of_birth do next unless object[:dogum_tarihi] - build_date(*object[:dogum_tarihi].values_at(:yil, :ay, :gun)) + + year, month, day = object[:dogum_tarihi].values_at :yil, :ay, :gun + build_date year, month, day end attribute :date_of_graduation do next unless object[:mezuniyet_tarihi] - build_date(*object[:mezuniyet_tarihi].values_at(:yil, :ay, :gun)) + + 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 ba4ebd26..11704264 100644 --- a/app/serializers/yoksis/meb/students_serializer.rb +++ b/app/serializers/yoksis/meb/students_serializer.rb @@ -3,28 +3,27 @@ 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(:city_code) { integer object[:okulilkodu] } + attribute(:city_name) { string object[:okuliladi] } + attribute(:district_code) { integer object[:okulilcekodu] } + 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(: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].safe_to_i.zero? + object[:okulbirincisi] && !object[:okulbirincisi].to_i.zero? end end end diff --git a/app/serializers/yoksis/military/informations_serializer.rb b/app/serializers/yoksis/military/informations_serializer.rb index 5dd810df..2f4627cb 100644 --- a/app/serializers/yoksis/military/informations_serializer.rb +++ b/app/serializers/yoksis/military/informations_serializer.rb @@ -3,23 +3,10 @@ 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 :status do - { - code: object[:askerlikDurumKod].safe_to_i, - description: object[:askerlikDurumAciklama].titleize_tr - } - end - - attribute :operation do - { - code: object[:islemKod], - description: object[:islemAciklama] - } - 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 378103b5..eb9d9841 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], ->(p) { p.upcase :turkic } } + 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..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) { 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/resumes/academic_duties_serializer.rb b/app/serializers/yoksis/resumes/academic_duties_serializer.rb index 3b35d7c1..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) { 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(: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 faca2095..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) { 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(: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 fdf95f75..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) { 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(: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 b188ea43..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) { 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(: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 d9852f12..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) { 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(: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(: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(: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(: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(: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(: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 6d6814df..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) { 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(: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 16eba4d9..a95e6a72 100644 --- a/app/serializers/yoksis/resumes/awards_serializer.rb +++ b/app/serializers/yoksis/resumes/awards_serializer.rb @@ -3,37 +3,36 @@ 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(: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 { - 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]), + workplace_type_id: integer(object[:isyeri_turu_id]), + workplace_type_name: string(object[:isyeri_turu_adi]) } 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]), + institution_id: integer(object[:p_kurum_id]), + institution_name: string(object[:p_kurum_ad]) } end - - attribute(:date_of_update) { object[:guncelleme_tarihi] && Time.zone.parse(object[:guncelleme_tarihi]) } - attribute(:incentive_points) { object[:tesv_puan].safe_to_f } end end end diff --git a/app/serializers/yoksis/resumes/books_serializer.rb b/app/serializers/yoksis/resumes/books_serializer.rb index 7118812d..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) { 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(: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 148db7a1..319a271b 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(: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] - 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 + attribute :end_date 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..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) { 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(: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 c0c51270..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) { 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(: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 e769c148..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) { 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(: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 029b59d6..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) { 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(: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 71924246..a1f24209 100644 --- a/app/serializers/yoksis/resumes/fields_serializer.rb +++ b/app/serializers/yoksis/resumes/fields_serializer.rb @@ -2,21 +2,21 @@ 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]) } + 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 [ - { 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..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) { 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(: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 fb07a3e0..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) { 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(: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(: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 4c412244..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) { 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(: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 c3d31b1a..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) { 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(: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 abca7ebb..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) { 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(: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 88493541..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) { 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(: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 585e7fe3..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) { 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(: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 6ca3daef..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) { 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(: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 727ffb52..e4dc9cf3 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(: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] - 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 + attribute :end_date 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..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) { 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(: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 dc158f75..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) { 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(: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/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..7960e72b 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)), - nationality: { - code: informations.dig(:uyrugu, :kod).safe_to_i, - name: informations.dig(:uyrugu, :ad).titleize_tr - }, + 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)), 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)) + }, + nationality: { + code: integer(informations.dig(:uyrugu, :kod)), + name: string(informations.dig(:uyrugu, :ad)) } } end @@ -30,52 +30,52 @@ 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)), - prep_class: { - code: informations.dig(:hazirlik_sinifi, :kod).safe_to_i, - name: informations.dig(:hazirlik_sinifi, :ad).titleize_tr + 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)), + 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: 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 - }, - rights: { - code: informations.dig(:ogrencilik_hakki_varmi, :kod).safe_to_i, - name: informations.dig(:ogrencilik_hakki_varmi, :ad).titleize_tr + code: integer(informations.dig(:giris_turu, :kod)), + name: string(informations.dig(:giris_turu, :ad), ->(p) { p.upcase :turkic }) }, - end_date_of_studentship_right: informations[:ogrencilik_hakki_bitti_tarih] && 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 + martyrs_relative: { + code: integer(informations.dig(:gazi_sehit_yakini, :kod)), + name: string(informations.dig(:gazi_sehit_yakini, :ad)) }, - disability_type: { - code: informations.dig(:engel_turu, :kod).safe_to_i, - name: informations.dig(:engel_turu, :ad).titleize_tr + prep_class: { + code: integer(informations.dig(:hazirlik_sinifi, :kod)), + name: string(informations.dig(:hazirlik_sinifi, :ad)) }, - disability_rate: informations[:engel_orani].safe_to_i, - dropout_type: { - code: informations.dig(:ayrilma_nedeni, :kod).safe_to_i, - name: informations.dig(:ayrilma_nedeni, :ad).titleize_tr + rights: { + code: integer(informations.dig(:ogrencilik_hakki_varmi, :kod)), + name: string(informations.dig(:ogrencilik_hakki_varmi, :ad)) }, - dropout_date: informations[:ayrilma_tarihi] && 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 + status: { + code: integer(informations.dig(:ogrencilik_statusu, :kod)), + name: string(informations.dig(:ogrencilik_statusu, :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 - } } 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, - university: { - code: informations.dig(:universite, :kod).safe_to_i, - name: informations.dig(:universite, :ad).titleize_tr - }, - university_type: { - code: informations.dig(:universite_turu, :kod).safe_to_i, - name: informations.dig(:universite_turu, :ad).titleize_tr - }, - unit: { - code: informations.dig(:birim, :kod).safe_to_i, - name: informations.dig(:birim, :ad).titleize_tr + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false), + long_name: string(informations[:birim_uzun_adi]), + osym_id: integer(informations[:kilavuz_kodu]), + parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), + period_of_study: integer(informations[:ogrenim_suresi]), + city: { + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) }, - unit_type: { - code: informations.dig(:birim_turu, :kod).safe_to_i, - name: informations.dig(:birim_turu, :ad).titleize_tr + district: { + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) }, faculty: { - code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr - }, - status: { - code: informations.dig(:aktiflik, :kod).safe_to_i, - name: informations.dig(:aktiflik, :ad).titleize_tr + code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(informations.dig(:fakulte_yo_myo_enstitu, :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 + unit: { + code: integer(informations.dig(:birim, :kod)), + name: string(informations.dig(:birim, :ad)) }, - district: { - code: informations.dig(:ilce, :kod).safe_to_i, - name: informations.dig(:ilce, :ad).titleize_tr + 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,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, - university: { - code: informations.dig(:universite, :kod).safe_to_i, - name: informations.dig(:universite, :ad).titleize_tr - }, - university_type: { - code: informations.dig(:universite_turu, :kod).safe_to_i, - name: informations.dig(:universite_turu, :ad).titleize_tr - }, - unit: { - code: informations.dig(:birim, :kod).safe_to_i, - name: informations.dig(:birim, :ad).titleize_tr + english_name: string(informations[:birim_adi_ingilizce], ->(p) { p.titleize }, case_conversion: false), + long_name: string(informations[:birim_uzun_adi]), + osym_id: integer(informations[:kilavuz_kodu]), + parent_unit_id: integer(informations[:bagli_oldugu_birim_id]), + period_of_study: integer(informations[:ogrenim_suresi]), + city: { + code: integer(informations.dig(:il, :kod)), + name: string(informations.dig(:il, :ad)) }, - unit_type: { - code: informations.dig(:birim_turu, :kod).safe_to_i, - name: informations.dig(:birim_turu, :ad).titleize_tr + district: { + code: integer(informations.dig(:ilce, :kod)), + name: string(informations.dig(:ilce, :ad)) }, faculty: { - code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr - }, - status: { - code: informations.dig(:aktiflik, :kod).safe_to_i, - name: informations.dig(:aktiflik, :ad).titleize_tr + code: integer(informations.dig(:fakulte_yo_myo_enstitu, :kod)), + name: string(informations.dig(:fakulte_yo_myo_enstitu, :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 + university: { + code: integer(informations.dig(:universite, :kod)), + name: string(informations.dig(:universite, :ad)) }, - district: { - code: informations.dig(:ilce, :kod).safe_to_i, - name: informations.dig(:ilce, :ad).titleize_tr + 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)) + }, + unit_type: { + code: integer(informations.dig(:birim_turu, :kod)), + name: string(informations.dig(:birim_turu, :ad)) + }, + status: { + code: integer(informations.dig(:aktiflik, :kod)), + name: string(informations.dig(:aktiflik, :ad)) } } end diff --git a/app/serializers/yoksis/units/changes_serializer.rb b/app/serializers/yoksis/units/changes_serializer.rb index 452c3045..6bfe7dd4 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(:parent_unit_id) { string object[:bagli_oldugu_birim_id] } + attribute(:unit_id) { integer object[:birim_id] } + attribute(:unit_name) { string object[:birim_adi] } + attribute(:update_date) { parse_datetime object[:degisiklik_tarihi] } - attribute :unit_type do + attribute :change_type do { - code: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad).titleize_tr + code: integer(object.dig(:degisiklik_turu, :kod)), + name: string(object.dig(:degisiklik_turu, :ad)) } end - attribute :status do + attribute :unit_type do { - code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad).titleize_tr + code: integer(object.dig(:birim_turu, :kod)), + name: string(object.dig(:birim_turu, :ad)) } end - attribute :change_type do + attribute :status do { - code: object.dig(:degisiklik_turu, :kod).safe_to_i, - name: object.dig(:degisiklik_turu, :ad).titleize_tr + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) } end end diff --git a/app/serializers/yoksis/units/units_serializer.rb b/app/serializers/yoksis/units/units_serializer.rb index d5d558ff..394c37cc 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(: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: object.dig(:universite, :kod).safe_to_i, - name: object.dig(:universite, :ad).titleize_tr + code: integer(object.dig(:il, :kod)), + name: string(object.dig(:il, :ad)) } end - attribute :university_type do + attribute :district do { - code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad).titleize_tr + code: integer(object.dig(:ilce, :kod)), + name: string(object.dig(:ilce, :ad)) } end - attribute :unit do + attribute :faculty do { - code: object.dig(:birim, :kod).safe_to_i, - name: object.dig(:birim, :ad).titleize_tr + 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: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad).titleize_tr + code: integer(object.dig(:ogrenim_dili, :kod)), + name: string(object.dig(:ogrenim_dili, :ad)) } end - attribute :faculty do + attribute :instruction_type 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(:ogrenim_turu, :kod)), + name: string(object.dig(:ogrenim_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 :instruction_language do + attribute :unit do { - code: object.dig(:ogrenim_dili, :kod).safe_to_i, - name: object.dig(:ogrenim_dili, :ad).titleize_tr + code: integer(object.dig(:birim, :kod)), + name: string(object.dig(:birim, :ad)) } end - attribute :instruction_type do + attribute :unit_type do { - code: object.dig(:ogrenim_turu, :kod).safe_to_i, - name: object.dig(:ogrenim_turu, :ad).titleize_tr + code: integer(object.dig(:birim_turu, :kod)), + name: string(object.dig(:birim_turu, :ad)) } end - attribute :city do + attribute :university do { - code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad).titleize_tr + code: integer(object.dig(:universite, :kod)), + name: string(object.dig(:universite, :ad)) } end - attribute :district do + attribute :university_type do { - code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad).titleize_tr + 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 b7adca0a..a21a85c5 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(: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 + attribute :big_city do { - code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad).titleize_tr + code: integer(object.dig(:buyuksehir, :kod)), + name: string(object.dig(:buyuksehir, :ad)) } end - attribute :status do + attribute :city do { - code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad).titleize_tr + code: integer(object.dig(:il, :kod)), + name: string(object.dig(:il, :ad)) } end - attribute :city do + attribute :district do { - code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad).titleize_tr + code: integer(object.dig(:ilce, :kod)), + name: string(object.dig(:ilce, :ad)) } end - attribute :district do + attribute :seaside do { - code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad).titleize_tr + code: integer(object.dig(:deniz_kiyisi, :kod)), + name: string(object.dig(:deniz_kiyisi, :ad)) } end - attribute :big_city do + attribute :status do { - code: object.dig(:buyuksehir, :kod).safe_to_i, - name: object.dig(:buyuksehir, :ad).titleize_tr + code: integer(object.dig(:aktiflik, :kod)), + name: string(object.dig(:aktiflik, :ad)) } end - attribute :seaside do + attribute :university_type do { - code: object.dig(:deniz_kiyisi, :kod).safe_to_i, - name: object.dig(:deniz_kiyisi, :ad).titleize_tr + code: integer(object.dig(:universite_turu, :kod)), + name: string(object.dig(:universite_turu, :ad)) } end end 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 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(?