dscf-core 0.1.6 → 0.1.7
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 +4 -4
- data/app/controllers/dscf/core/addresses_controller.rb +52 -0
- data/config/routes.rb +2 -0
- data/lib/dscf/core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921baabb605b4c33c9d64f8e0839d0aebb9558e6980553f03fc35acf12286a84
|
4
|
+
data.tar.gz: 762b3316a670197ab8b24baff0140658550869a25b12424953795d0d28f972ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6505e11aafa30ca100d6e371997f68407930c2f6759be12db6d63f8fc5cc6f9fb7050c206e93ba06d877bc56670ecbcb3077c5e02309a4f86bdaf600d7686cb
|
7
|
+
data.tar.gz: b2e5f301c038fed2e084d3a4aa7592a902d6c97fcbc8de51fd4a47baf8be25dbf512bd281a2584186b86fd433af89db18f3592042453d4848edc41ebff3d3c58
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Dscf
|
2
|
+
module Core
|
3
|
+
class AddressesController < ApplicationController
|
4
|
+
include Common
|
5
|
+
|
6
|
+
def index
|
7
|
+
super do
|
8
|
+
current_user.addresses
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
super do
|
14
|
+
current_user.addresses.new(model_params)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Enable authentication for this controller
|
21
|
+
def authentication_required?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def model_params
|
26
|
+
params.require(:address).permit(
|
27
|
+
:address_type, :country, :city, :sub_city,
|
28
|
+
:woreda, :kebele, :house_numbers, :po_box, :latitude, :longitude
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def eager_loaded_associations
|
33
|
+
[:user]
|
34
|
+
end
|
35
|
+
|
36
|
+
# Override set_object to scope to current_user for show/update
|
37
|
+
def set_object
|
38
|
+
return unless current_user
|
39
|
+
|
40
|
+
begin
|
41
|
+
@obj = if eager_loaded_associations.present?
|
42
|
+
current_user.addresses.includes(eager_loaded_associations).find(params[:id])
|
43
|
+
else
|
44
|
+
current_user.addresses.find(params[:id])
|
45
|
+
end
|
46
|
+
rescue ActiveRecord::RecordNotFound
|
47
|
+
render_error("Address not found", status: :not_found)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/dscf/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dscf-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asrat
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -431,6 +431,7 @@ files:
|
|
431
431
|
- app/controllers/concerns/dscf/core/json_response.rb
|
432
432
|
- app/controllers/concerns/dscf/core/pagination.rb
|
433
433
|
- app/controllers/concerns/dscf/core/token_authenticatable.rb
|
434
|
+
- app/controllers/dscf/core/addresses_controller.rb
|
434
435
|
- app/controllers/dscf/core/application_controller.rb
|
435
436
|
- app/controllers/dscf/core/auth_controller.rb
|
436
437
|
- app/errors/dscf/core/authentication_error.rb
|