dscf-banking 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af9cf7825df29b9ee3c8fd34d588ff6794d01da578a6d1edab25ed0d3f95109b
4
- data.tar.gz: 7e60e0b55cc74d933bfee965d7ba30e59058962a99ed739c59476cf112765c2a
3
+ metadata.gz: 033d842004e5e6c779e391bb9dca2e43925b3858212b50a94db2f3d8853a0dc1
4
+ data.tar.gz: eb48ab4b6287afbf75f93801f033c08327d284f127142e7199a7678ee74b3acc
5
5
  SHA512:
6
- metadata.gz: 8789c6b6649f347c0afa7a52e2b486578d9c9b823c9267891d835d70055bb08a5123cc52d35a6f8a291fa00c214d284ec1d1da81d2c6451a1c4bc310dcf0d452
7
- data.tar.gz: f05eaba3272cd1a0383cc5f1dc81bb2cf9b5a1fde77f73b548d742ecbfd837c168e89b8d9f8f96ae7be604cc2cae1715934bed6521e4e31f53824fef3612fa08
6
+ metadata.gz: f7bcc179bc00d1f81d16394e521b1d54188bd41efc89a0c0d1f9c076648eebc223a9642d3c21790bcb1270d649741b2692f54b74f7b6ec33cded00c44802d122
7
+ data.tar.gz: b915c7adccc0fcde6e40717023d0f9fe849c5e81298d1797371a4876d5c9dce9dec294b1b08065d23873dd3c210d61b54922d33024ea23fbaf6f3adefe5dad04
@@ -28,6 +28,22 @@ module Dscf::Banking
28
28
  }
29
29
  end
30
30
 
31
+ def full_name
32
+ account = Dscf::Banking::Account.find_by(account_number: params[:id])
33
+ if account && account.application && account.application.user
34
+ user = account.application.user
35
+ profile = user.respond_to?(:user_profile) ? user.user_profile : nil
36
+ if profile
37
+ full_name = [profile.first_name, profile.middle_name, profile.last_name].compact.join(" ")
38
+ render json: { success: true, data: { full_name: full_name } }
39
+ else
40
+ render json: { success: false, error: "User profile not found" }, status: :not_found
41
+ end
42
+ else
43
+ render json: { success: false, error: "Account not found" }, status: :not_found
44
+ end
45
+ end
46
+
31
47
  def show
32
48
  account = Dscf::Banking::Account.find(params[:id])
33
49
  render json: {
@@ -6,11 +6,11 @@ module Dscf::Banking
6
6
  return [] unless object.files.attached?
7
7
 
8
8
  if Rails.env.production?
9
- ActiveStorage::Current.set(url_options: { host: "dscf.bitscollege.edu.et", protocol: "https" }) do
9
+ ActiveStorage::Current.set(url_options: { host: "dscf.bitscollege.edu.et", protocol: "https", script_name: "/api" }) do
10
10
  object.files.map(&:url)
11
11
  end
12
12
  else
13
- ActiveStorage::Current.set(url_options: { host: "localhost:3000", protocol: "http" }) do
13
+ ActiveStorage::Current.set(url_options: { host: "localhost:3000", protocol: "http", script_name: "/api" }) do
14
14
  object.files.map(&:url)
15
15
  end
16
16
  end
data/config/routes.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  Dscf::Banking::Engine.routes.draw do
2
- resources :accounts do
2
+ resources :accounts do
3
+ get "full_name", to: "accounts#full_name", on: :member
3
4
  collection do
4
5
  get :me
5
6
  end
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Banking
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eyosiyas Mekbib