diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f2b72ea..40921cd8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,9 +61,19 @@ jobs: - run: name: Running security tasks command: bundle exec rake code:security:all + deploy: + machine: + enabled: true + steps: + - checkout + - run: + name: Deploy master branch to Dokku + command: | + git remote add beta dokku@app.omu.sh:xokul && + git push beta master workflows: version: 2 - build: + build-and-deploy: jobs: - checkout_code - bundle_dependencies: @@ -71,4 +81,10 @@ workflows: - checkout_code - karma: requires: - - bundle_dependencies \ No newline at end of file + - bundle_dependencies + - deploy: + requires: + - karma + filters: + branches: + only: master \ No newline at end of file diff --git a/app/serializers/kps/queries/addresses_serializer.rb b/app/serializers/kps/queries/addresses_serializer.rb index 1b1e1601..45f58fec 100644 --- a/app/serializers/kps/queries/addresses_serializer.rb +++ b/app/serializers/kps/queries/addresses_serializer.rb @@ -9,67 +9,67 @@ class AddressesSerializer < Serializer address = object[:yerlesim_yeri_adresi] { - full_address: address[:acik_adres], + full_address: address[:acik_adres].titleize_tr, no: address[:adres_no].safe_to_i, type: { code: address.dig(:adres_tip, :kod).safe_to_i, - description: address.dig(:adres_tip, :aciklama) + description: address.dig(:adres_tip, :aciklama).titleize_tr }, 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) + 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) + description: address.dig(:il_ilce_merkez_adresi, :bagimsiz_bolum_tipi, :aciklama).titleize_tr }, apartment: { - block: address.dig(:il_ilce_merkez_adresi, :bina_ada), - pilot: address.dig(:il_ilce_merkez_adresi, :bina_parsel), - layout: address.dig(:il_ilce_merkez_adresi, :bina_pafta), - block_name: address.dig(:il_ilce_merkez_adresi, :bina_blok_adi), + 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) + description: address.dig(:il_ilce_merkez_adresi, :bina_durum, :aciklama).titleize_tr }, 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) + description: address.dig(:il_ilce_merkez_adresi, :bina_numarataj_tipi, :aciklama).titleize_tr }, 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) + description: address.dig(:il_ilce_merkez_adresi, :bina_yapi_tipi, :aciklama).titleize_tr } }, - csbm: address.dig(:il_ilce_merkez_adresi, :csbm), + 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, city: { code: address.dig(:il_ilce_merkez_adresi, :il_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :il) + name: address.dig(:il_ilce_merkez_adresi, :il).titleize_tr }, district: { code: address.dig(:il_ilce_merkez_adresi, :ilce_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :ilce) + name: address.dig(:il_ilce_merkez_adresi, :ilce).titleize_tr }, neighborhood: { code: address.dig(:il_ilce_merkez_adresi, :mahalle_kodu).safe_to_i, - name: address.dig(:il_ilce_merkez_adresi, :mahalle) + name: address.dig(:il_ilce_merkez_adresi, :mahalle).titleize_tr }, 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) + name: address.dig(:il_ilce_merkez_adresi, :yapi_kullanim_amac, :aciklama).titleize_tr }, }, - village_address: address[:koy_adresi], - abroad_address: address[:yurt_disi_adresi], - reason_of_relocation: address[:tasinma_neden], - municipality_address: address[:belde_adresi], + 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)), @@ -85,17 +85,17 @@ class AddressesSerializer < Serializer object << { declarant_id_number: address[:beyanda_bulunan_kimlik_no].safe_to_i, - full_address: address[:acik_adres], + full_address: address[:acik_adres].titleize_tr, address_no: address[:adres_no].safe_to_i, address_type: { code: address.dig(:adres_tip, :kod), - description: address.dig(:adres_tip, :aciklama) + description: address.dig(:adres_tip, :aciklama).titleize_tr }, - village_address: address[:koy_adresi], - municipality_address: address[:belde_adresi], - city_address: address[:il_ilce_merkez_adresi], - abroad_address: address[:yurt_disi_adresi], - reason_of_relocation: address[:tasinma_neden], + 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)) diff --git a/app/serializers/kps/queries/identities_serializer.rb b/app/serializers/kps/queries/identities_serializer.rb index 86775c92..f9cf5483 100644 --- a/app/serializers/kps/queries/identities_serializer.rb +++ b/app/serializers/kps/queries/identities_serializer.rb @@ -12,26 +12,26 @@ class IdentitiesSerializer < Serializer personal_informations = informations[:kisi_bilgisi] basic_informations = { - first_name: personal_informations.dig(:temel_bilgisi, :ad), - last_name: personal_informations.dig(:temel_bilgisi, :soyad), - father_name: personal_informations.dig(:temel_bilgisi, :anne_ad), - mother_name: personal_informations.dig(:temel_bilgisi, :baba_ad), + first_name: personal_informations.dig(:temel_bilgisi, :ad).titleize_tr, + last_name: personal_informations.dig(:temel_bilgisi, :soyad).titleize_tr, + father_name: personal_informations.dig(:temel_bilgisi, :anne_ad).titleize_tr, + mother_name: personal_informations.dig(:temel_bilgisi, :baba_ad).titleize_tr, gender: { code: personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod).safe_to_i, - description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama) + description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama).titleize_tr }, - place_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_yer), + 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)) } status_informations = { status: { code: personal_informations.dig(:durum_bilgisi, :durum, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama) + description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama).titleize_tr }, marital_status: { code: personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama) + 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)) @@ -44,7 +44,7 @@ class IdentitiesSerializer < Serializer father_id_number: personal_informations[:baba_tc_kimlik_no].safe_to_i, mother_id_number: personal_informations[:anne_tc_kimlik_no].safe_to_i, real_person_id_number: personal_informations[:gercek_kisi_kimlik_no].safe_to_i, - country: personal_informations[:ulke], + country: personal_informations[:ulke].titleize_tr, status_informations: status_informations, basic_informations: basic_informations } @@ -52,28 +52,28 @@ class IdentitiesSerializer < Serializer 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], - last_name: card_informations[:soyad], - father_name: card_informations[:baba_ad], - mother_name: card_informations[:anne_ad], + first_name: card_informations[:ad].titleize_tr, + last_name: card_informations[:soyad].titleize_tr, + father_name: card_informations[:baba_ad].titleize_tr, + mother_name: card_informations[:anne_ad].titleize_tr, gender: { code: card_informations.dig(:cinsiyet, :kod).safe_to_i, - description: card_informations.dig(:cinsiyet, :aciklama) + description: card_informations.dig(:cinsiyet, :aciklama).titleize_tr }, - nationality: card_informations[:uyruk], + nationality: card_informations[:uyruk].titleize_tr, marital_status: { code: card_informations.dig(:medeni_hal, :kod).safe_to_i, - description: card_informations.dig(:medeni_hal, :aciklama) + description: card_informations.dig(:medeni_hal, :aciklama).titleize_tr }, - place_of_birth: card_informations[:dogum_yer], + 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], - unit: card_informations[:birim], + previous_last_name: card_informations[:onceki_soyad].titleize_tr, + unit: card_informations[:birim].titleize_tr, number: card_informations[:no].safe_to_i, registration_number: card_informations[:kayit_no].safe_to_i, serial_number: card_informations[:seri], - issuing_reason: card_informations[:verilis_neden], + issuing_reason: card_informations[:verilis_neden].titleize_tr, issuing_date: build_date(*card_informations[:verilme_tarih].values_at(:yil, :ay, :gun)) } @@ -92,18 +92,18 @@ 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], - last_name: temporary_identity_informations[:soyad], - father_name: temporary_identity_informations[:baba_ad], - mother_name: temporary_identity_informations[:anne_ad], + first_name: temporary_identity_informations[:ad].titleize_tr, + last_name: temporary_identity_informations[:soyad].titleize_tr, + father_name: temporary_identity_informations[:baba_ad].titleize_tr, + mother_name: temporary_identity_informations[:anne_ad].titleize_tr, gender: { code: temporary_identity_informations.dig(:cinsiyet, :kod).safe_to_i, - description: temporary_identity_informations.dig(:cinsiyet, :aciklama) + description: temporary_identity_informations.dig(:cinsiyet, :aciklama).titleize_tr }, 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], + 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], + issuing_district: temporary_identity_informations[:duzenleyen_ilce].titleize_tr, issuing_date: temporary_identity_informations[:duzenlenme_tarih] && build_date(*temporary_identity_informations[:duzenlenme_tarih].values_at(:yil, :ay, :gun)), date_of_expiration: temporary_identity_informations[:son_gecerlilik_tarih] && build_date(*temporary_identity_informations[:son_gecerlilik_tarih].values_at(:yil, :ay, :gun)) } @@ -111,14 +111,14 @@ class IdentitiesSerializer < Serializer personal_informations = informations[:kisi_bilgisi] status_informations = { - religion: personal_informations.dig(:durum_bilgisi, :din), + religion: personal_informations.dig(:durum_bilgisi, :din).titleize_tr, status: { code: personal_informations.dig(:durum_bilgisi, :durum, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama) + description: personal_informations.dig(:durum_bilgisi, :durum, :aciklama).titleize_tr }, marital_status: { code: personal_informations.dig(:durum_bilgisi, :medeni_hal, :kod).safe_to_i, - description: personal_informations.dig(:durum_bilgisi, :medeni_hal, :aciklama) + 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)) } @@ -128,28 +128,28 @@ class IdentitiesSerializer < Serializer individual_serial_number: personal_informations.dig(:kayit_yeri_bilgisi, :birey_sira_no).safe_to_i, volume: { code: personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :aciklama) + description: personal_informations.dig(:kayit_yeri_bilgisi, :cilt, :aciklama).titleize_tr }, city: { code: personal_informations.dig(:kayit_yeri_bilgisi, :il, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :il, :aciklama) + description: personal_informations.dig(:kayit_yeri_bilgisi, :il, :aciklama).titleize_tr }, district: { code: personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :kod).safe_to_i, - description: personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :aciklama) + description: personal_informations.dig(:kayit_yeri_bilgisi, :ilce, :aciklama).titleize_tr } } basic_informations = { - first_name: personal_informations.dig(:temel_bilgisi, :ad), - last_name: personal_informations.dig(:temel_bilgisi, :soyad), - father_name: personal_informations.dig(:temel_bilgisi, :anne_ad), - mother_name: personal_informations.dig(:temel_bilgisi, :baba_ad), + first_name: personal_informations.dig(:temel_bilgisi, :ad).titleize_tr, + last_name: personal_informations.dig(:temel_bilgisi, :soyad).titleize_tr, + father_name: personal_informations.dig(:temel_bilgisi, :anne_ad).titleize_tr, + mother_name: personal_informations.dig(:temel_bilgisi, :baba_ad).titleize_tr, gender: { code: personal_informations.dig(:temel_bilgisi, :cinsiyet, :kod).safe_to_i, - description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama) + description: personal_informations.dig(:temel_bilgisi, :cinsiyet, :aciklama).titleize_tr }, - place_of_birth: personal_informations.dig(:temel_bilgisi, :dogum_yer), + 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)) } @@ -167,11 +167,11 @@ 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], - last_name: old_identity_card_informations[:soyad], - father_name: old_identity_card_informations[:baba_ad], - mother_name: old_identity_card_informations[:anne_ad], - place_of_birth: old_identity_card_informations[:dogum_yer], + first_name: old_identity_card_informations[:ad].titleize_tr, + last_name: old_identity_card_informations[:soyad].titleize_tr, + father_name: old_identity_card_informations[:baba_ad].titleize_tr, + mother_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, @@ -179,11 +179,11 @@ class IdentitiesSerializer < Serializer 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) + description: old_identity_card_informations.dig(:cuzdan_verilme_neden, :aciklama).titleize_tr }, issuing_district: { code: old_identity_card_informations.dig(:verildigi_ilce, :kod).safe_to_i, - description: old_identity_card_informations.dig(:verildigi_ilce, :aciklama) + description: old_identity_card_informations.dig(:verildigi_ilce, :aciklama).titleize_tr } } @@ -196,23 +196,23 @@ class IdentitiesSerializer < Serializer 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], - last_name: new_identity_card_informations[:soyad], - father_name: new_identity_card_informations[:baba_ad], - mother_name: new_identity_card_informations[:anne_ad], + first_name: new_identity_card_informations[:ad].titleize_tr, + last_name: new_identity_card_informations[:soyad].titleize_tr, + father_name: new_identity_card_informations[:baba_ad].titleize_tr, + mother_name: new_identity_card_informations[:anne_ad].titleize_tr, gender: { code: new_identity_card_informations.dig(:cinsiyet, :kod).safe_to_i, - description: new_identity_card_informations.dig(:cinsiyet, :aciklama) + description: new_identity_card_informations.dig(:cinsiyet, :aciklama).titleize_tr }, - place_of_birth: new_identity_card_informations[:dogum_yer], + 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)), - admission_reason: new_identity_card_informations[:basvuru_neden], - deliverer_unit: new_identity_card_informations[:teslim_eden_birim], + admission_reason: new_identity_card_informations[:basvuru_neden].titleize_tr, + 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], + issuing_authority: new_identity_card_informations[:veren_makam].titleize_tr, photograph: new_identity_card_photograph_informations } @@ -237,21 +237,21 @@ class IdentitiesSerializer < Serializer basic_informations = foreigner[:temel_bilgisi] basic_informations = basic_informations[:hata_bilgisi].present? ? nil : { - first_name: basic_informations[:ad], - last_name: basic_informations[:soyad], - father_name: basic_informations[:anne_ad], - mother_name: basic_informations[:baba_ad], + first_name: basic_informations[:ad].titleize, + last_name: basic_informations[:soyad].titleize, + father_name: basic_informations[:anne_ad].titleize, + mother_name: basic_informations[:baba_ad].titleize, gender: { code: basic_informations.dig(:cinsiyet, :kod).safe_to_i, - description: basic_informations.dig(:cinsiyet, :aciklama) + description: basic_informations.dig(:cinsiyet, :aciklama).titleize_tr }, - place_of_birth: basic_informations[:dogum_yer] + place_of_birth: basic_informations[:dogum_yer].titleize } status_informations = foreigner[:durum_bilgisi] status_informations = status_informations[:hata_bilgisi].present? ? nil : { code: status_informations[:kod].safe_to_i, - description: status_informations[:aciklama] + description: status_informations[:aciklama].titleize_tr } admittance_informations = { @@ -260,7 +260,7 @@ class IdentitiesSerializer < Serializer date_of_end: foreigner[:izin_bitis_tarih], issuing_city: { code: foreigner.dig(:izin_duzenlenen_il, :kod).safe_to_i, - description: foreigner.dig(:izin_duzenlenen_il, :aciklama) + description: foreigner.dig(:izin_duzenlenen_il, :aciklama).titleize_tr } } @@ -276,12 +276,12 @@ class IdentitiesSerializer < Serializer date_of_death: build_date(*foreigner[:olum_tarih].values_at(:yil, :ay, :gun)), nationality: { code: foreigner.dig(:uyruk, :kod).safe_to_i, - description: foreigner.dig(:uyruk, :aciklama) + description: foreigner.dig(:uyruk, :aciklama).titleize_tr }, admittance: admittance_informations, source_unit: { code: foreigner.dig(:kaynak_birim, :kod).safe_to_i, - description: foreigner.dig(:kaynak_birim, :aciklama) + description: foreigner.dig(:kaynak_birim, :aciklama).titleize_tr }, 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 c183e0e0..a782e325 100644 --- a/app/serializers/osym/examination/groups_serializer.rb +++ b/app/serializers/osym/examination/groups_serializer.rb @@ -4,7 +4,7 @@ module Osym module Examination class GroupsSerializer < ActiveModel::Serializer attribute(:id) { object[:id].safe_to_i } - attribute(:name) { object[:ad] } + attribute(:name) { object[:ad].upcase_tr } end end end diff --git a/app/serializers/yoksis/graduates/informations_serializer.rb b/app/serializers/yoksis/graduates/informations_serializer.rb index 17078c00..fe5f8150 100644 --- a/app/serializers/yoksis/graduates/informations_serializer.rb +++ b/app/serializers/yoksis/graduates/informations_serializer.rb @@ -4,17 +4,17 @@ module Yoksis module Graduates class InformationsSerializer < Serializer attribute(:id_number) { object[:tckno].safe_to_i } - attribute(:first_name) { object[:adi] } - attribute(:last_name) { object[:soyadi] } - attribute(:father_name) { object[:baba_adi] } - attribute(:mother_name) { object[:anne_adi] } + attribute(:first_name) { object[:adi].titleize_tr } + attribute(:last_name) { object[:soyadi].titleize_tr } + attribute(:father_name) { object[:baba_adi].titleize_tr } + attribute(:mother_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] } - attribute(:faculty) { object[:fak_myo_yo_ens] } - attribute(:program_name) { object[:program_adi] } + 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 :date_of_birth do diff --git a/app/serializers/yoksis/meb/students_serializer.rb b/app/serializers/yoksis/meb/students_serializer.rb index 818176b3..ba4ebd26 100644 --- a/app/serializers/yoksis/meb/students_serializer.rb +++ b/app/serializers/yoksis/meb/students_serializer.rb @@ -4,21 +4,21 @@ module Yoksis module Meb class StudentsSerializer < Serializer attribute(:id_number) { object[:tckimlikno].safe_to_i } - attribute(:first_name) { object[:adi] } - attribute(:last_name) { object[:soyadi] } + 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] } + attribute(:school_name) { object[:okuladi].titleize_tr } attribute(:school_field_code) { object[:okulalankodu].safe_to_i } - attribute(:school_field_name) { object[:okulalanadi] } + attribute(:school_field_name) { object[:okulalanadi].titleize_tr } attribute(:school_branch_code) { object[:okuldalkodu].safe_to_i } - attribute(:school_branch_name) { object[:okuldaladi] } - attribute(:city_name) { object[:okuliladi] } + 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] } + attribute(:district_name) { object[:okulilceadi].titleize_tr } attribute(:district_code) { object[:okulilcekodu].safe_to_i } - attribute(:instruction_type) { object[:ogrenimturu] } + attribute(:instruction_type) { object[:ogrenimturu].titleize_tr } attribute(:grad_status_code) { object[:mezundurumukodu].safe_to_i } - attribute(:grad_status) { object[:mezundurumu] } + 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 } diff --git a/app/serializers/yoksis/military/informations_serializer.rb b/app/serializers/yoksis/military/informations_serializer.rb index bd3422c3..5dd810df 100644 --- a/app/serializers/yoksis/military/informations_serializer.rb +++ b/app/serializers/yoksis/military/informations_serializer.rb @@ -4,13 +4,13 @@ module Yoksis module Military class InformationsSerializer < Serializer attribute(:id_number) { object[:tcKimlikNo].safe_to_i } - attribute(:first_name) { object[:adi] } - attribute(:last_name) { object[:soyadi] } + 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] + description: object[:askerlikDurumAciklama].titleize_tr } end diff --git a/app/serializers/yoksis/references/administrative_units_serializer.rb b/app/serializers/yoksis/references/administrative_units_serializer.rb index 48ff35d1..378103b5 100644 --- a/app/serializers/yoksis/references/administrative_units_serializer.rb +++ b/app/serializers/yoksis/references/administrative_units_serializer.rb @@ -4,7 +4,7 @@ module Yoksis module References class AdministrativeUnitsSerializer < Serializer attribute(:id) { object[:birim_id].safe_to_i } - attribute(:name) { object[:birim_adi] } + attribute(:name) { object[:birim_adi].titleize_tr } attribute(:parent_unit_id) { object[:bagli_oldugu_birim_id].safe_to_i } end end diff --git a/app/serializers/yoksis/references/base_serializer.rb b/app/serializers/yoksis/references/base_serializer.rb index 10aec8e1..c2a8aec3 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].capitalize } + attribute(:code) { object[:kod].safe_to_i } + attribute(:name) { object[:ad].titleize_tr } end end end diff --git a/app/serializers/yoksis/resumes/articles_serializer.rb b/app/serializers/yoksis/resumes/articles_serializer.rb index 1d942111..1c3ea80d 100644 --- a/app/serializers/yoksis/resumes/articles_serializer.rb +++ b/app/serializers/yoksis/resumes/articles_serializer.rb @@ -4,24 +4,24 @@ module Yoksis module Resumes class ArticlesSerializer < Serializer attribute(:id) { object[:yayin_id].safe_to_i } - attribute(:name) { object[:makale_adi] } + attribute(:name) { object[:makale_adi].titleize_tr } attribute(:type_id) { object[:makale_turu_id].safe_to_i } - attribute(:type_name) { object[:makale_turu_ad] } + attribute(:type_name) { object[:makale_turu_ad].titleize_tr } attribute(:scope_id) { object[:kapsam_id].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad] } + 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] } + attribute(:referee_type_name) { object[:hakem_tur_ad].titleize_tr } attribute(:index_id) { object[:endeks_id].safe_to_i } - attribute(:index) { object[:endeks] } + attribute(:index) { object[:endeks].titleize_tr } attribute(:author_id) { object[:yazar_id].safe_to_i } - attribute(:author_name) { object[:yazar_adi] } + attribute(:author_name) { object[:yazar_adi].upcase_tr } attribute(:authors_number) { object[:yazar_sayisi].safe_to_i } attribute(:country_id) { object[:ulke].safe_to_i } - attribute(:country_name) { object[:ulke_adi] } - attribute(:city) { object[:sehir] } - attribute(:journal_name) { object[:dergi_adi] } + attribute(:country_name) { object[:ulke_adi].titleize_tr } + attribute(:city) { object[:sehir].titleize_tr } + attribute(:journal_name) { object[:dergi_adi].titleize_tr } attribute(:language_id) { object[:yayin_dili].safe_to_i } - attribute(:language_name) { object[:yayin_dili_adi] } + attribute(:language_name) { object[:yayin_dili_adi].titleize_tr } attribute(:month) { object[:ay].safe_to_i } attribute(:year) { object[:yil].safe_to_i } attribute(:volume) { object[:cilt].safe_to_i } @@ -34,13 +34,13 @@ class ArticlesSerializer < Serializer attribute(:access_type_name) { object[:erisim_turu_ad] } attribute(:access_link) { object[:erisim_linki] } attribute(:citation_number) { object[:atif_sayisi].safe_to_i } - attribute(:field) { object[:alan_bilgisi] } - attribute(:keyword) { object[:anahtar_kelime] } + attribute(:field) { object[:alan_bilgisi].titleize_tr } + attribute(:keyword) { object[:anahtar_kelime].titleize_tr } attribute(:special_number_id) { object[:ozel_sayi].safe_to_i } - attribute(:special_number_name) { object[:ozel_sayi_ad] } + attribute(:special_number_name) { object[:ozel_sayi_ad].titleize_tr } attribute(:date_of_update) { 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] } + attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } attribute(:incentive_point) { object[:tesv_puan].safe_to_f } end end diff --git a/app/serializers/yoksis/resumes/certifications_serializer.rb b/app/serializers/yoksis/resumes/certifications_serializer.rb index b2576281..eed895e8 100644 --- a/app/serializers/yoksis/resumes/certifications_serializer.rb +++ b/app/serializers/yoksis/resumes/certifications_serializer.rb @@ -3,26 +3,26 @@ module Yoksis module Resumes class CertificationsSerializer < Serializer - attribute(:id) { object[:s_id].safe_to_i } - attribute(:name) { object[:adi] } - attribute(:content) { object[:icerik] } - attribute(:type_id) { object[:tur_id].safe_to_i } - attribute(:type_name) { object[:tur_adi] } - attribute(:location) { object[:yer] } - attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad] } - attribute(:stint) { object[:sure].safe_to_i } - attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad] } - attribute(:university_id) { object[:kurum_id].safe_to_i } - attribute(:university_name) { object[:kurum_ad] } - attribute(:members_number) { object[:kisi_sayisi].safe_to_i } - attribute(:country) { object[:ulke_sehir] && object[:ulke_sehir].split('/').first } - attribute(:city) { object[:ulke_sehir] && object[:ulke_sehir].split('/').last } - attribute(:date_of_update) { 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] } - attribute(:incentive_point) { object[:tesv_puan].safe_to_f } + attribute(: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(:location) { 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(:university_id) { object[:kurum_id].safe_to_i } + attribute(:university_name) { object[:kurum_ad].titleize_tr } + attribute(:members_number) { 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) { 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_point) { object[:tesv_puan].safe_to_f } attribute :date_of_start do next unless object[:bastar] diff --git a/app/serializers/yoksis/resumes/projects_serializer.rb b/app/serializers/yoksis/resumes/projects_serializer.rb index eebdd348..6c1918a2 100644 --- a/app/serializers/yoksis/resumes/projects_serializer.rb +++ b/app/serializers/yoksis/resumes/projects_serializer.rb @@ -4,26 +4,26 @@ module Yoksis module Resumes class ProjectsSerializer < Serializer attribute(:id) { object[:proje_id].safe_to_i } - attribute(:name) { object[:proje_ad] } - attribute(:subject) { object[:proje_konusu] } + 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] } + attribute(:status_name) { object[:proje_durumu_ad].titleize_tr } attribute(:date_of_update) { Time.zone.parse object[:guncelleme_tarihi] || '' } attribute(:budget) { object[:butce].safe_to_i } attribute(:location_id) { object[:proje_konumu_id].safe_to_i } - attribute(:location_name) { object[:proje_konumu_ad] } + 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] } + 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] } + attribute(:currency_name) { object[:para_birimi_ad].titleize_tr } attribute(:active_or_passive_id) { object[:aktif_pasif].safe_to_i } - attribute(:active_or_passive_name) { object[:aktif_pasif_ad] } + attribute(:active_or_passive_name) { object[:aktif_pasif_ad].titleize_tr } attribute(:scope_id) { object[:kapsam].safe_to_i } - attribute(:scope_name) { object[:kapsam_ad] } + attribute(:scope_name) { object[:kapsam_ad].titleize_tr } attribute(:title_id) { object[:unvan_id].safe_to_i } - attribute(:title_name) { object[:unvan_ad] } + attribute(:title_name) { object[:unvan_ad].titleize_tr } attribute(:university_id) { object[:kurum_id].safe_to_i } - attribute(:university_name) { object[:kurum_ad] } + attribute(:university_name) { object[:kurum_ad].titleize_tr } attribute(:incentive_point) { object[:tesv_puan].safe_to_f } attribute :started_at do diff --git a/app/serializers/yoksis/staff/academicians_serializer.rb b/app/serializers/yoksis/staff/academicians_serializer.rb index 8f3fe2b9..bcdf17f5 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] } - attribute(:last_name) { object[:soyadi] } - attribute(:title) { object[:kadro_unvan] } - attribute(:unit_id) { object[:birim_id].safe_to_i } + 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 } end end end diff --git a/app/serializers/yoksis/staff/nationalities_serializer.rb b/app/serializers/yoksis/staff/nationalities_serializer.rb index c32d8997..b14b919a 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].capitalize } + attribute(:code) { object[:kod].safe_to_i } + attribute(:name) { object[:ad].titleize_tr } end end end diff --git a/app/serializers/yoksis/students/informations_serializer.rb b/app/serializers/yoksis/students/informations_serializer.rb index d9067b9e..44fec807 100644 --- a/app/serializers/yoksis/students/informations_serializer.rb +++ b/app/serializers/yoksis/students/informations_serializer.rb @@ -4,187 +4,183 @@ module Yoksis module Students class InformationsSerializer < Serializer attribute :personal_informations do - t = object[:kisisel_bilgiler] - next unless t[:tc_kimlik_no] + informations = object[:kisisel_bilgiler] + next unless informations[:tc_kimlik_no] + { - id_number: t[:tc_kimlik_no].safe_to_i, - first_name: t[:adi], - last_name: t[:soyadi], - father_name: t[:baba_adi], - mother_name: t[:anne_adi], - date_of_birth: t[:dogum_tarihi] && build_date( - *t[:dogum_tarihi].values_at(:yil, :ay, :gun) - ), + id_number: informations[:tc_kimlik_no].safe_to_i, + first_name: informations[:adi].titleize_tr, + last_name: informations[:soyadi].titleize_tr, + father_name: informations[:baba_adi].titleize_tr, + mother_name: informations[:anne_adi].titleize_tr, + date_of_birth: informations[:dogum_tarihi] && build_date(*informations[:dogum_tarihi].values_at(:yil, :ay, :gun)), nationality: { - code: t.dig(:uyrugu, :kod).safe_to_i, - name: t.dig(:uyrugu, :ad).capitalize + code: informations.dig(:uyrugu, :kod).safe_to_i, + name: informations.dig(:uyrugu, :ad).titleize_tr }, gender: { - code: t.dig(:cinsiyeti, :kod).safe_to_i, - name: t.dig(:cinsiyeti, :ad) + code: informations.dig(:cinsiyeti, :kod).safe_to_i, + name: informations.dig(:cinsiyeti, :ad).titleize_tr } } end attribute :studentship_informations do - t = object[:ogrencilik_bilgileri] - next unless t[:kayit_tarihi] + informations = object[:ogrencilik_bilgileri] + next unless informations[:kayit_tarihi] + { - student_number: t[:ogrenci_no].safe_to_i, - entrance_point: t[:giris_puani].safe_to_i, - current_term: t[:aktif_donem_no].safe_to_i, - ects: t[:akts].safe_to_f, - prep_term: t[:kac_donem_hazirlik].safe_to_i, - registration_date: t[:kayit_tarihi] && build_time( - *t[:kayit_tarihi].values_at(:yil, :ay, :gun, :saat, :dakika, :saniye) - ), + 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: t.dig(:hazirlik_sinifi, :kod).safe_to_i, - name: t.dig(:hazirlik_sinifi, :ad) + code: informations.dig(:hazirlik_sinifi, :kod).safe_to_i, + name: informations.dig(:hazirlik_sinifi, :ad).titleize_tr }, entrance_point_type: { - code: t.dig(:giris_puan_turu, :kod).safe_to_i, - name: t.dig(:giris_puan_turu, :ad) + code: informations.dig(:giris_puan_turu, :kod).safe_to_i, + name: informations.dig(:giris_puan_turu, :ad).capitalize_tr }, entrance_type: { - code: t.dig(:giris_turu, :kod).safe_to_i, - name: t.dig(:giris_turu, :ad) + code: informations.dig(:giris_turu, :kod).safe_to_i, + name: informations.dig(:giris_turu, :ad).upcase_tr }, rights: { - code: t.dig(:ogrencilik_hakki_varmi, :kod).safe_to_i, - name: t.dig(:ogrencilik_hakki_varmi, :ad) + code: informations.dig(:ogrencilik_hakki_varmi, :kod).safe_to_i, + name: informations.dig(:ogrencilik_hakki_varmi, :ad).titleize_tr }, - end_date_of_studentship_right: t[:ogrencilik_hakki_bitti_tarih] && build_date( - *t[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun) - ), + end_date_of_studentship_right: informations[:ogrencilik_hakki_bitti_tarih] && build_date(*informations[:ogrencilik_hakki_bitti_tarih].values_at(:yil, :ay, :gun)), status: { - code: t.dig(:ogrencilik_statusu, :kod).safe_to_i, - name: t.dig(:ogrencilik_statusu, :ad) + code: informations.dig(:ogrencilik_statusu, :kod).safe_to_i, + name: informations.dig(:ogrencilik_statusu, :ad).titleize_tr }, disability_type: { - code: t.dig(:engel_turu, :kod).safe_to_i, - name: t.dig(:engel_turu, :ad) + code: informations.dig(:engel_turu, :kod).safe_to_i, + name: informations.dig(:engel_turu, :ad).titleize_tr }, - disability_rate: t[:engel_orani].safe_to_i, + disability_rate: informations[:engel_orani].safe_to_i, dropout_type: { - code: t.dig(:ayrilma_nedeni, :kod).safe_to_i, - name: t.dig(:ayrilma_nedeni, :ad) + code: informations.dig(:ayrilma_nedeni, :kod).safe_to_i, + name: informations.dig(:ayrilma_nedeni, :ad).titleize_tr }, - dropout_date: t[:ayrilma_tarihi] && build_date( - *t[:ayrilma_tarihi].values_at(:yil, :ay, :gun) - ), + dropout_date: informations[:ayrilma_tarihi] && build_date(*informations[:ayrilma_tarihi].values_at(:yil, :ay, :gun)), martyrs_relative: { - code: t.dig(:gazi_sehit_yakini, :kod).safe_to_i, - name: t.dig(:gazi_sehit_yakini, :ad) + code: informations.dig(:gazi_sehit_yakini, :kod).safe_to_i, + name: informations.dig(:gazi_sehit_yakini, :ad).titleize_tr }, diploma: { - gpa: t.dig(:diploma, :notu).safe_to_f, - grading_system: t.dig(:diploma, :not_sistemi).safe_to_f, - no: t.dig(:diploma, :no).safe_to_i + 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 attribute :unit_informations do - t = object[:birim] - next unless t.dig(:birim, :kod) + informations = object[:birim] + next unless informations.dig(:birim, :kod) + { - long_name: t[:birim_uzun_adi], - english_name: t[:birim_adi_ingilizce], - parent_unit_id: t[:bagli_oldugu_birim_id].safe_to_i, - period_of_study: t[:ogrenim_suresi].safe_to_i, - osym_id: t[:kilavuz_kodu].safe_to_i, + 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: t.dig(:universite, :kod).safe_to_i, - name: t.dig(:universite, :ad) + code: informations.dig(:universite, :kod).safe_to_i, + name: informations.dig(:universite, :ad).titleize_tr }, university_type: { - code: t.dig(:universite_turu, :kod).safe_to_i, - name: t.dig(:universite_turu, :ad) + code: informations.dig(:universite_turu, :kod).safe_to_i, + name: informations.dig(:universite_turu, :ad).titleize_tr }, unit: { - code: t.dig(:birim, :kod).safe_to_i, - name: t.dig(:birim, :ad) + code: informations.dig(:birim, :kod).safe_to_i, + name: informations.dig(:birim, :ad).titleize_tr }, unit_type: { - code: t.dig(:birim_turu, :kod).safe_to_i, - name: t.dig(:birim_turu, :ad) + code: informations.dig(:birim_turu, :kod).safe_to_i, + name: informations.dig(:birim_turu, :ad).titleize_tr }, faculty: { - code: t.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: t.dig(:fakulte_yo_myo_enstitu, :ad) + code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, + name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr }, status: { - code: t.dig(:aktiflik, :kod).safe_to_i, - name: t.dig(:aktiflik, :ad) + code: informations.dig(:aktiflik, :kod).safe_to_i, + name: informations.dig(:aktiflik, :ad).titleize_tr }, instruction_language: { - code: t.dig(:ogrenim_dili, :kod).safe_to_i, - name: t.dig(:ogrenim_dili, :ad) + code: informations.dig(:ogrenim_dili, :kod).safe_to_i, + name: informations.dig(:ogrenim_dili, :ad).titleize_tr }, instruction_type: { - code: t.dig(:ogrenim_turu, :kod).safe_to_i, - name: t.dig(:ogrenim_turu, :ad) + code: informations.dig(:ogrenim_turu, :kod).safe_to_i, + name: informations.dig(:ogrenim_turu, :ad).titleize_tr }, city: { - code: t.dig(:il, :kod).safe_to_i, - name: t.dig(:il, :ad) + code: informations.dig(:il, :kod).safe_to_i, + name: informations.dig(:il, :ad).titleize_tr }, district: { - code: t.dig(:ilce, :kod).safe_to_i, - name: t.dig(:ilce, :ad) + code: informations.dig(:ilce, :kod).safe_to_i, + name: informations.dig(:ilce, :ad).titleize_tr } } end attribute :undergrad_transfer_informations do - t = object[:ygecis_birim_id] - next unless t.dig(:universite, :kod) + informations = object[:ygecis_birim_id] + next unless informations.dig(:universite, :kod) + { - long_name: t[:birim_uzun_adi], - english_name: t[:birim_adi_ingilizce], - parent_unit_id: t[:bagli_oldugu_birim_id].safe_to_i, - period_of_study: t[:ogrenim_suresi].safe_to_i, - osym_id: t[:kilavuz_kodu].safe_to_i, + 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: t.dig(:universite, :kod).safe_to_i, - name: t.dig(:universite, :ad) + code: informations.dig(:universite, :kod).safe_to_i, + name: informations.dig(:universite, :ad).titleize_tr }, university_type: { - code: t.dig(:universite_turu, :kod).safe_to_i, - name: t.dig(:universite_turu, :ad) + code: informations.dig(:universite_turu, :kod).safe_to_i, + name: informations.dig(:universite_turu, :ad).titleize_tr }, unit: { - code: t.dig(:birim, :kod).safe_to_i, - name: t.dig(:birim, :ad) + code: informations.dig(:birim, :kod).safe_to_i, + name: informations.dig(:birim, :ad).titleize_tr }, unit_type: { - code: t.dig(:birim_turu, :kod).safe_to_i, - name: t.dig(:birim_turu, :ad) + code: informations.dig(:birim_turu, :kod).safe_to_i, + name: informations.dig(:birim_turu, :ad).titleize_tr }, faculty: { - code: t.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: t.dig(:fakulte_yo_myo_enstitu, :ad) + code: informations.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, + name: informations.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr }, status: { - code: t.dig(:aktiflik, :kod).safe_to_i, - name: t.dig(:aktiflik, :ad) + code: informations.dig(:aktiflik, :kod).safe_to_i, + name: informations.dig(:aktiflik, :ad).titleize_tr }, instruction_language: { - code: t.dig(:ogrenim_dili, :kod).safe_to_i, - name: t.dig(:ogrenim_dili, :ad) + code: informations.dig(:ogrenim_dili, :kod).safe_to_i, + name: informations.dig(:ogrenim_dili, :ad).titleize_tr }, instruction_type: { - code: t.dig(:ogrenim_turu, :kod).safe_to_i, - name: t.dig(:ogrenim_turu, :ad) + code: informations.dig(:ogrenim_turu, :kod).safe_to_i, + name: informations.dig(:ogrenim_turu, :ad).titleize_tr }, city: { - code: t.dig(:il, :kod).safe_to_i, - name: t.dig(:il, :ad) + code: informations.dig(:il, :kod).safe_to_i, + name: informations.dig(:il, :ad).titleize_tr }, district: { - code: t.dig(:ilce, :kod).safe_to_i, - name: t.dig(:ilce, :ad) + code: informations.dig(:ilce, :kod).safe_to_i, + name: informations.dig(:ilce, :ad).titleize_tr } } end diff --git a/app/serializers/yoksis/units/changes_serializer.rb b/app/serializers/yoksis/units/changes_serializer.rb index cb84b917..452c3045 100644 --- a/app/serializers/yoksis/units/changes_serializer.rb +++ b/app/serializers/yoksis/units/changes_serializer.rb @@ -4,28 +4,28 @@ module Yoksis module Units class ChangesSerializer < Serializer attribute(:unit_id) { object[:birim_id].safe_to_i } - attribute(:unit_name) { object[:birim_adi] } + attribute(:unit_name) { object[:birim_adi].titleize_tr } attribute(:parent_unit_id) { object[:bagli_oldugu_birim_id].safe_to_i } attribute(:date_of_update) { object[:degisiklik_tarihi] } attribute :unit_type do { code: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad) + name: object.dig(:birim_turu, :ad).titleize_tr } end attribute :status do { code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad) + name: object.dig(:aktiflik, :ad).titleize_tr } end attribute :change_type do { code: object.dig(:degisiklik_turu, :kod).safe_to_i, - name: object.dig(:degisiklik_turu, :ad) + name: object.dig(:degisiklik_turu, :ad).titleize_tr } end end diff --git a/app/serializers/yoksis/units/units_serializer.rb b/app/serializers/yoksis/units/units_serializer.rb index 323f7129..d5d558ff 100644 --- a/app/serializers/yoksis/units/units_serializer.rb +++ b/app/serializers/yoksis/units/units_serializer.rb @@ -3,8 +3,8 @@ module Yoksis module Units class UnitsSerializer < Serializer - attribute(:long_name) { object.dig(:birim_uzun_adi) } - attribute(:english_name) { object.dig(:birim_adi_ingilizce) } + 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 } @@ -12,70 +12,70 @@ class UnitsSerializer < Serializer attribute :university do { code: object.dig(:universite, :kod).safe_to_i, - name: object.dig(:universite, :ad) + name: object.dig(:universite, :ad).titleize_tr } end attribute :university_type do { code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad) + name: object.dig(:universite_turu, :ad).titleize_tr } end attribute :unit do { code: object.dig(:birim, :kod).safe_to_i, - name: object.dig(:birim, :ad) + name: object.dig(:birim, :ad).titleize_tr } end attribute :unit_type do { code: object.dig(:birim_turu, :kod).safe_to_i, - name: object.dig(:birim_turu, :ad) + name: object.dig(:birim_turu, :ad).titleize_tr } end attribute :faculty do { code: object.dig(:fakulte_yo_myo_enstitu, :kod).safe_to_i, - name: object.dig(:fakulte_yo_myo_enstitu, :ad) + name: object.dig(:fakulte_yo_myo_enstitu, :ad).titleize_tr } end attribute :status do { code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad) + name: object.dig(:aktiflik, :ad).titleize_tr } end attribute :instruction_language do { code: object.dig(:ogrenim_dili, :kod).safe_to_i, - name: object.dig(:ogrenim_dili, :ad) + name: object.dig(:ogrenim_dili, :ad).titleize_tr } end attribute :instruction_type do { code: object.dig(:ogrenim_turu, :kod).safe_to_i, - name: object.dig(:ogrenim_turu, :ad) + name: object.dig(:ogrenim_turu, :ad).titleize_tr } end attribute :city do { code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad) + name: object.dig(:il, :ad).titleize_tr } end attribute :district do { code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad) + name: object.dig(:ilce, :ad).titleize_tr } end end diff --git a/app/serializers/yoksis/units/universities_serializer.rb b/app/serializers/yoksis/units/universities_serializer.rb index 11d36589..b7adca0a 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] } - attribute(:english_name) { object[:birim_adi_ingilizce] } - attribute(:phone) { object[:telefon] } - attribute(:fax) { object[:faks] } - attribute(:address) { object[:adres] } - attribute(:website) { object[:web] } - attribute(:email) { object[:eposta] } + 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 :university_type do { code: object.dig(:universite_turu, :kod).safe_to_i, - name: object.dig(:universite_turu, :ad) + name: object.dig(:universite_turu, :ad).titleize_tr } end attribute :status do { code: object.dig(:aktiflik, :kod).safe_to_i, - name: object.dig(:aktiflik, :ad) + name: object.dig(:aktiflik, :ad).titleize_tr } end attribute :city do { code: object.dig(:il, :kod).safe_to_i, - name: object.dig(:il, :ad) + name: object.dig(:il, :ad).titleize_tr } end attribute :district do { code: object.dig(:ilce, :kod).safe_to_i, - name: object.dig(:ilce, :ad) + name: object.dig(:ilce, :ad).titleize_tr } end attribute :big_city do { code: object.dig(:buyuksehir, :kod).safe_to_i, - name: object.dig(:buyuksehir, :ad) + name: object.dig(:buyuksehir, :ad).titleize_tr } end attribute :seaside do { code: object.dig(:deniz_kiyisi, :kod).safe_to_i, - name: object.dig(:deniz_kiyisi, :ad) + name: object.dig(:deniz_kiyisi, :ad).titleize_tr } end end diff --git a/doc/development/helpers.md b/doc/development/helpers.md index d4e5d69f..a9abcd9d 100644 --- a/doc/development/helpers.md +++ b/doc/development/helpers.md @@ -71,29 +71,77 @@ Code base'in çeşitli yerlerinde kullanılan yardımcıları içerir. Tüm ger #### `safe_to_i` -String, Integer ve Nil sınıfları için gerçeklendi. Serializer katmanında tipe bağlı hataları absorbe etmek için yazıldı. +String, Integer ve Nil nesneleri için kullanılabilir. Serializer katmanında tipe bağlı hataları absorbe etmek için ihtiyaç duyuldu. -- String sınıfında `to_i` metoduyla aynı işi yapar -- Nil sınıfında `nil` döndürür -- Integer sınıfında `to_i` metoduyla aynı işi yapar +- String nesnelerinde `to_i` metoduyla aynı işi yapar +- Nil nesnelerinde yine `nil` döndürür +- Integer nesnelerinde `to_i` metoduyla aynı işi yapar #### `safe_to_f` -Nil ve String sınıfları için gerçeklendi. +Nil ve String nesneleri için kullanılabilir. -- String sınıfında `float` sayı eğer virgülle yazılmış ise noktayla değiştirerek `Float` sayı nesnesi döndürür +- String nesnelerinde nesne virgülle yazılmış ise noktayla değiştirerek `Float` sayı döndürür ```ruby puts '1,3'.safe_to_f # 1.3 puts '1.3'.safe_to_f # 1.3 ``` -- Nil sınıfında ise yine `nil` döndürür +- Nil nesnelerinde ise yine `nil` döndürür #### `camelize` -Yalnızca Symbol nesneleri için geçerlidir. Symbol nesnesini `camelize` eder. +Yalnızca Symbol nesneleri için kullanılabilir. Symbol nesnesini `camelize` eder. ```ruby puts :foo_bar.camelize # FooBar -``` \ No newline at end of file +``` + +#### `titleize_tr` + +Nil ve String nesneleri için kullanılabilir. + +- String nesnelerinde "Turkish Special Chars" baz alarak `titleize` yapar + + ```ruby + puts 'örnek'.titleize_tr # Örnek + ``` + +- Nil nesnelerinde yine `nil` döndürür + +#### `downcase_tr` + +Nil ve String nesneleri için kullanılabilir. + +- String nesnelerinde "Turkish Special Chars" baz alarak `downcase` yapar + + ```ruby + puts 'ÖRNEK'.downcase_tr # örnek + ``` + +- Nil nesnelerinde yine `nil` döndürür + +#### `upcase_tr` + +Nil ve String nesneleri için kullanılabilir. + +- String nesnelerinde "Turkish Special Chars" baz alarak `upcase` yapar + + ```ruby + puts 'örnek'.upcase_tr # ÖRNEK + ``` + +- Nil nesnelerinde yine `nil` döndürür + +#### `capitalize_tr` + +Nil ve String nesneleri için kullanılabilir. + +- String nesnelerinde "Turkish Special Chars" baz alarak `capitalize` yapar + + ```ruby + puts 'örnek bilgi'.capitalize_tr # Örnek bilgi + ``` + +- Nil nesnelerinde yine `nil` döndürür \ No newline at end of file diff --git a/lib/support/support/core_ext/nil.rb b/lib/support/support/core_ext/nil.rb index c17cf8cb..7f386b34 100644 --- a/lib/support/support/core_ext/nil.rb +++ b/lib/support/support/core_ext/nil.rb @@ -1,11 +1,15 @@ # frozen_string_literal: true class NilClass - def safe_to_i + def nil_object nil end - def safe_to_f - 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 1e33c1ca..f411c0a1 100644 --- a/lib/support/support/core_ext/string.rb +++ b/lib/support/support/core_ext/string.rb @@ -1,9 +1,25 @@ # frozen_string_literal: true class String - alias safe_to_i to_i + def capitalize_tr + capitalize :turkic + end + + def titleize_tr + downcase_tr.gsub(/\b(?