thecore_api 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/base_controller.rb +11 -11
- data/lib/thecore_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b0182daacbd83f547c605d97132c47a51c88891563d962a9ff2cad9d62ffa06
|
4
|
+
data.tar.gz: 472775a07973cc618d1c5806884b9f5cf42e9852fcd19b27e7253f7da641baab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5713ce668a8bc8431cd3e54a7874811c24eb24bd55844df19400abccddab210b10436afe5d260a6195cf178fd7ebd893f58a37daea06a29cc0d45a87b6d379cd
|
7
|
+
data.tar.gz: 9f1cc1e044d6831827cea4eabccb27a891429c3311c3ebf4fd01989df95d6d0655b634444f75122d599619f6982980cd4c5b3a6e86339d13d26c3251f3c9023b
|
@@ -49,7 +49,7 @@ class Api::V1::BaseController < ActionController::API
|
|
49
49
|
# So, if it's not an activerecord, the find model makes no sense at all
|
50
50
|
# Thus must return 404
|
51
51
|
path = params[:path].split("/")
|
52
|
-
puts "CHECK"
|
52
|
+
# puts "CHECK"
|
53
53
|
return not_found! if (!path.first.classify.constantize.new.is_a? ActiveRecord::Base rescue false)
|
54
54
|
find_model path.first
|
55
55
|
if request.get?
|
@@ -63,7 +63,7 @@ class Api::V1::BaseController < ActionController::API
|
|
63
63
|
elsif path.second.to_i.zero?
|
64
64
|
# String, so it's a custom action I must find in the @model (as a singleton method)
|
65
65
|
# GET :controller/:custom_action
|
66
|
-
puts "SECOND ZERO?"
|
66
|
+
# puts "SECOND ZERO?"
|
67
67
|
return not_found! unless @model.respond_to?(path.second)
|
68
68
|
return render json: MultiJson.dump(@model.send(path.second, params)), status: 200
|
69
69
|
elsif !path.second.to_i.zero? && path.third.blank?
|
@@ -75,7 +75,7 @@ class Api::V1::BaseController < ActionController::API
|
|
75
75
|
show
|
76
76
|
elsif !path.second.to_i.zero? && !path.third.blank?
|
77
77
|
# GET :controller/:id/:custom_action
|
78
|
-
puts "SECOND AND THIRD"
|
78
|
+
# puts "SECOND AND THIRD"
|
79
79
|
return not_found! unless @model.respond_to?(path.third)
|
80
80
|
return render json: MultiJson.dump(@model.send(path.third, path.second.to_i, params)), status: 200
|
81
81
|
end
|
@@ -85,7 +85,7 @@ class Api::V1::BaseController < ActionController::API
|
|
85
85
|
create
|
86
86
|
elsif path.second.to_i.zero?
|
87
87
|
# POST :controller/:custom_action
|
88
|
-
puts "NO SECOND"
|
88
|
+
# puts "NO SECOND"
|
89
89
|
return not_found! unless @model.respond_to?(path.second)
|
90
90
|
return render json: MultiJson.dump(@model.send(path.second, params)), status: 200
|
91
91
|
end
|
@@ -99,7 +99,7 @@ class Api::V1::BaseController < ActionController::API
|
|
99
99
|
update
|
100
100
|
elsif !path.second.to_i.zero? && !path.third.blank?
|
101
101
|
# PUT :controller/:id/:custom_action
|
102
|
-
puts "ANOTHER SECOND AND THIRD"
|
102
|
+
# puts "ANOTHER SECOND AND THIRD"
|
103
103
|
return not_found! unless @model.respond_to?(path.third)
|
104
104
|
return render json: MultiJson.dump(@model.send(path.third, path.second.to_i, params)), status: 200
|
105
105
|
end
|
@@ -136,16 +136,16 @@ class Api::V1::BaseController < ActionController::API
|
|
136
136
|
current_page_number: @records.current_page
|
137
137
|
}) if !pages_info.blank?
|
138
138
|
|
139
|
-
puts "ALL RECORDS FOUND: #{@records_all.inspect}"
|
139
|
+
# puts "ALL RECORDS FOUND: #{@records_all.inspect}"
|
140
140
|
status = @records_all.blank? ? 404 : 200
|
141
|
-
puts "If it's asked for page number, then paginate"
|
141
|
+
# puts "If it's asked for page number, then paginate"
|
142
142
|
return render json: MultiJson.dump(@records, json_attrs), status: status if !page.blank? # (@json_attrs || {})
|
143
|
-
puts "if you ask for count, then return a json object with just the number of objects"
|
143
|
+
#puts "if you ask for count, then return a json object with just the number of objects"
|
144
144
|
return render json: MultiJson.dump({count: @records_all.count}) if !count.blank?
|
145
|
-
puts "Default"
|
145
|
+
#puts "Default"
|
146
146
|
json_out = MultiJson.dump(@records_all, json_attrs)
|
147
|
-
puts "JSON ATTRS: #{json_attrs}"
|
148
|
-
puts "JSON OUT: #{json_out}"
|
147
|
+
#puts "JSON ATTRS: #{json_attrs}"
|
148
|
+
#puts "JSON OUT: #{json_out}"
|
149
149
|
render json: json_out, status: status #(@json_attrs || {})
|
150
150
|
end
|
151
151
|
|
data/lib/thecore_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
|
-
rubygems_version: 3.0.
|
164
|
+
rubygems_version: 3.0.1
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
167
|
summary: Taris API.
|