apress-api 1.22.0 → 1.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.drone.yml +72 -30
- data/Appraisals +9 -13
- data/CHANGELOG.md +24 -0
- data/Gemfile +1 -0
- data/README.md +2 -0
- data/Rakefile +1 -0
- data/app/controllers/apress/api/deprecated_versions_controller.rb +1 -0
- data/app/controllers/apress/api/v1/callbacks_controller.rb +1 -0
- data/app/controllers/apress/api/v1/tokens_controller.rb +1 -0
- data/app/docs/schema/api/v1/types/apress/api/link.rb +1 -0
- data/app/docs/schema/api/v1/types/apress/api/links.rb +1 -0
- data/app/docs/swagger/v1/controllers/apress/api/tokens_controller.rb +1 -0
- data/app/docs/swagger/v1/default_responses/bad_request.rb +1 -0
- data/app/docs/swagger/v1/default_responses/not_found.rb +1 -0
- data/app/docs/swagger/v1/default_responses/unauthenticated.rb +1 -0
- data/app/docs/swagger/v1/default_responses/unauthorized.rb +1 -0
- data/app/docs/swagger/v1/default_responses/unprocessable.rb +1 -0
- data/app/docs/swagger/v1/default_responses/updates_locked.rb +1 -0
- data/app/docs/swagger/v1/models/apress/api/client.rb +1 -0
- data/app/docs/swagger/v1/models/apress/api/simple_error.rb +1 -0
- data/app/docs/swagger/v1/models/apress/api/unproccesable_error.rb +1 -0
- data/app/docs/swagger/v1/models/apress/api/unprocessable_error.rb +1 -0
- data/app/docs/swagger/v1/root.rb +8 -6
- data/app/interactors/apress/api/callbacks/base_callback.rb +1 -0
- data/app/interactors/apress/api/delayed_fire_callback.rb +1 -0
- data/app/jobs/apress/api/event_handler_enqueueing_job.rb +1 -0
- data/app/jobs/apress/api/fire_callback_job.rb +1 -0
- data/app/models/apress/api/client.rb +1 -0
- data/app/policies/apress/api/callback_policy.rb +1 -0
- data/app/services/apress/api/auth_service.rb +1 -0
- data/app/views/apress/api/shared/_exception.json.jbuilder +1 -0
- data/app/views/apress/api/shared/error.json.jbuilder +1 -0
- data/app/views/apress/api/shared/parameter_missing_errors.json.jbuilder +1 -0
- data/app/views/apress/api/shared/unprocessable_errors.json.jbuilder +1 -0
- data/app/views/apress/api/v1/clients/_client.json.jbuilder +1 -0
- data/app/views/apress/api/v1/tokens/create.json.jbuilder +1 -0
- data/apress-api.gemspec +2 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20150716000000_create_api_clients.rb +1 -0
- data/dip.yml +4 -3
- data/lib/apress-api.rb +1 -0
- data/lib/apress/api.rb +1 -0
- data/lib/apress/api/api_controller/authentification.rb +2 -1
- data/lib/apress/api/api_controller/base.rb +1 -0
- data/lib/apress/api/api_controller/compatibility.rb +1 -0
- data/lib/apress/api/api_controller/pagination.rb +1 -0
- data/lib/apress/api/api_controller/pagination_helper.rb +1 -0
- data/lib/apress/api/api_controller/rescue.rb +5 -0
- data/lib/apress/api/api_controller/responds.rb +1 -0
- data/lib/apress/api/callbacks/config.rb +1 -0
- data/lib/apress/api/callbacks/fire_callback_error.rb +1 -0
- data/lib/apress/api/callbacks/integration.rb +1 -0
- data/lib/apress/api/callbacks/repeat_callback_error.rb +1 -0
- data/lib/apress/api/engine.rb +13 -6
- data/lib/apress/api/extensions/jbuilder/jbuilder_template.rb +1 -0
- data/lib/apress/api/rspec.rb +1 -0
- data/lib/apress/api/rspec/utils.rb +1 -0
- data/lib/apress/api/testing/json_matcher.rb +1 -0
- data/lib/apress/api/version.rb +2 -1
- data/lib/tasks/docs.rake +1 -0
- data/spec/controllers/api_controller/authentification_spec.rb +3 -2
- data/spec/controllers/api_controller/pagination_spec.rb +1 -0
- data/spec/controllers/api_controller/rescue_spec.rb +1 -0
- data/spec/controllers/deprecated_versions_controller_spec.rb +1 -0
- data/spec/controllers/v1/callbacks_controller_spec.rb +1 -0
- data/spec/controllers/v1/tokens_controller_spec.rb +1 -0
- data/spec/factories/client_factory.rb +1 -0
- data/spec/helpers/paginating_cache_spec.rb +2 -1
- data/spec/interactors/apress/api/delayed_fire_callback_spec.rb +1 -0
- data/spec/internal/app/integrations/error_client/fire_callback.rb +1 -0
- data/spec/internal/app/integrations/service_client/fire_callback.rb +1 -0
- data/spec/internal/app/jobs/handler_job.rb +1 -0
- data/spec/internal/app/jobs/second_handler_job.rb +1 -0
- data/spec/internal/app/models/dummy_model.rb +1 -0
- data/spec/internal/config/environments/test.rb +1 -0
- data/spec/internal/config/initializers/api.rb +1 -0
- data/spec/internal/config/routes.rb +1 -0
- data/spec/internal/db/schema.rb +1 -0
- data/spec/jobs/apress/api/event_handler_equeueing_job_spec.rb +1 -0
- data/spec/jobs/apress/api/fire_callback_job_spec.rb +1 -0
- data/spec/lib/apress/api/callbacks/integration_spec.rb +1 -0
- data/spec/models/client_spec.rb +1 -0
- data/spec/services/auth_service_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a15ba51274eacfc7eb5ed70f29a74b65d392a54
|
4
|
+
data.tar.gz: 29f78fba861651c173d7b17ad3c2f1a1764e6896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e6cefef7e7243fb8de4767d02f28f3d0069dc12e397cba8989ca4f86bbb50dc7fa833fbc86ec2dc6cb41efbbe4f20a3e898072d19bdd483b54a0882c309c511
|
7
|
+
data.tar.gz: 9ea70efe78bf9c39c1c12169721893bad755f6b28f34ac8788f29b731f733c1e6b8a378639d754e4cf9c439200f21dd197a0a3093ff179b93c36f60cc0a1ab1c
|
data/.drone.yml
CHANGED
@@ -1,30 +1,72 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
1
|
+
---
|
2
|
+
kind: pipeline
|
3
|
+
type: docker
|
4
|
+
name: build
|
5
|
+
|
6
|
+
volumes:
|
7
|
+
- name: rubygems
|
8
|
+
host:
|
9
|
+
path: /home/data/drone/rubygems
|
10
|
+
- name: bundle
|
11
|
+
host:
|
12
|
+
path: /home/data/drone/gems
|
13
|
+
|
14
|
+
spec_step_common: &spec_step_common
|
15
|
+
pull: if-not-exists
|
16
|
+
volumes:
|
17
|
+
- name: bundle
|
18
|
+
path: /bundle
|
19
|
+
commands:
|
20
|
+
- rm -fr Gemfile.lock gemfiles/
|
21
|
+
- bundle install -j 5
|
22
|
+
- bundle exec appraisal install
|
23
|
+
- bundle exec appraisal bundle exec rspec
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- name: postgres
|
27
|
+
image: abakpress/postgres-db:9.6-latest
|
28
|
+
pull: if-not-exists
|
29
|
+
environment:
|
30
|
+
POSTGRES_DB: docker
|
31
|
+
detach: true
|
32
|
+
|
33
|
+
- name: build on ruby2.2
|
34
|
+
image: abakpress/ruby-app:2.2-latest
|
35
|
+
environment:
|
36
|
+
TEST_DB_HOST: postgres
|
37
|
+
TEST_DB_NAME: docker
|
38
|
+
TEST_DB_USERNAME: postgres
|
39
|
+
BUNDLE_PATH: /bundle/2.2
|
40
|
+
<<: *spec_step_common
|
41
|
+
|
42
|
+
- name: build on ruby2.3
|
43
|
+
image: abakpress/ruby-app:2.3-latest
|
44
|
+
environment:
|
45
|
+
TEST_DB_HOST: postgres
|
46
|
+
TEST_DB_NAME: docker
|
47
|
+
TEST_DB_USERNAME: postgres
|
48
|
+
BUNDLE_PATH: /bundle/2.3
|
49
|
+
<<: *spec_step_common
|
50
|
+
|
51
|
+
- name: build on ruby2.4
|
52
|
+
image: abakpress/ruby-app:2.4-latest
|
53
|
+
environment:
|
54
|
+
TEST_DB_HOST: postgres
|
55
|
+
TEST_DB_NAME: docker
|
56
|
+
TEST_DB_USERNAME: postgres
|
57
|
+
BUNDLE_PATH: /bundle/2.4
|
58
|
+
<<: *spec_step_common
|
59
|
+
|
60
|
+
- name: release
|
61
|
+
image: abakpress/gem-publication:latest
|
62
|
+
pull: if-not-exists
|
63
|
+
when:
|
64
|
+
event: push
|
65
|
+
branch: master
|
66
|
+
status: success
|
67
|
+
volumes:
|
68
|
+
- name: rubygems
|
69
|
+
path: /root/.gem
|
70
|
+
commands:
|
71
|
+
- release-gem --public
|
72
|
+
|
data/Appraisals
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
if RUBY_VERSION < '2.4'
|
3
|
+
appraise "rails4.0" do
|
4
|
+
gem "rails", "~> 4.0.0", require: false
|
5
|
+
end
|
4
6
|
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
appraise "rails4.1" do
|
11
|
-
gem "rails", "~> 4.1.0", require: false
|
12
|
-
end
|
13
|
-
|
14
|
-
appraise "rails4.2" do
|
15
|
-
gem "rails", "~> 4.2.0", require: false
|
8
|
+
if RUBY_VERSION < '2.5'
|
9
|
+
appraise "rails4.2" do
|
10
|
+
gem "rails", "~> 4.2.0", require: false
|
11
|
+
end
|
16
12
|
end
|
17
13
|
|
18
14
|
appraise "rails5.0" do
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
# v1.24.2
|
2
|
+
|
3
|
+
* 2021-07-22 [79fba01](../../commit/79fba01) - __(Andrew N. Shalaev)__ fix: try to mount missed volume
|
4
|
+
* 2021-07-16 [37a8921](../../commit/37a8921) - __(Andrew N. Shalaev)__ Release v1.24.2
|
5
|
+
* 2021-07-16 [c261182](../../commit/c261182) - __(Andrew N. Shalaev)__ feature: freeze string literals
|
6
|
+
* 2021-07-16 [2e9f3f3](../../commit/2e9f3f3) - __(Andrew N. Shalaev)__ feature: add ruby2.4 support
|
7
|
+
https://jira.railsc.ru/browse/BPC-19154
|
8
|
+
|
9
|
+
* 2019-09-20 [f397049](../../commit/f397049) - __(Andrew N. Shalaev)__ Release v1.24.1
|
10
|
+
* 2019-09-20 [929480d](../../commit/929480d) - __(Andrew N. Shalaev)__ feature: add bage with version for link to rubygems.org
|
11
|
+
|
12
|
+
# v1.24.0
|
13
|
+
|
14
|
+
* 2019-09-19 [d2ec039](../../commit/d2ec039) - __(Andrew N. Shalaev)__ fix: send 401 Unathorized instead 403
|
15
|
+
https://jira.railsc.ru/browse/BPC-15268
|
16
|
+
|
17
|
+
# v1.23.0
|
18
|
+
|
19
|
+
* 2018-10-01 [d0e5a8e](../../commit/d0e5a8e) - __(Artem Napolskih)__ feat: adds ability to configure root page
|
20
|
+
|
21
|
+
# v1.22.1
|
22
|
+
|
23
|
+
* 2018-08-30 [1328469](../../commit/1328469) - __(Ilya Zhidkov)__ fix(gemspec): add min version for addressable
|
24
|
+
|
1
25
|
# v1.22.0
|
2
26
|
|
3
27
|
* 2018-08-22 [7bb90fa](../../commit/7bb90fa) - __(Artem Napolskih)__ chore: Add automatic publication
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/app/docs/swagger/v1/root.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Swagger
|
2
3
|
module V1
|
3
4
|
class Root < ::Apress::Documentation::Swagger::Schema
|
4
5
|
swagger_root do
|
5
6
|
key :swagger, '2.0'
|
6
7
|
info do
|
7
|
-
key :version,
|
8
|
-
key :title,
|
9
|
-
key :description,
|
10
|
-
key :termsOfService,
|
8
|
+
key :version, Rails.application.config.api[:version]
|
9
|
+
key :title, Rails.application.config.api[:title]
|
10
|
+
key :description, Rails.application.config.api[:description]
|
11
|
+
key :termsOfService, Rails.application.config.api[:terms_of_service]
|
12
|
+
|
11
13
|
contact do
|
12
|
-
key :name,
|
14
|
+
key :name, Rails.application.config.api[:contact_name]
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
|
-
key :basePath,
|
18
|
+
key :basePath, Rails.application.config.api[:base_path]
|
17
19
|
key :produces, ['application/json']
|
18
20
|
|
19
21
|
security_definition :APIAuth do
|
data/apress-api.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
lib = File.expand_path('../lib', __FILE__)
|
2
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
require 'apress/api/version'
|
@@ -26,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
26
27
|
spec.add_runtime_dependency 'swagger-core', '>= 0.3.0'
|
27
28
|
spec.add_runtime_dependency 'interactor'
|
28
29
|
spec.add_runtime_dependency 'pundit'
|
30
|
+
spec.add_runtime_dependency 'addressable', '>= 2.4.0'
|
29
31
|
|
30
32
|
spec.add_runtime_dependency 'resque-integration'
|
31
33
|
spec.add_runtime_dependency 'apress-documentation', '>= 0.2.0'
|
data/config/routes.rb
CHANGED
data/dip.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
version: '1'
|
2
2
|
|
3
3
|
environment:
|
4
|
-
DOCKER_RUBY_VERSION: 2.
|
5
|
-
RUBY_IMAGE_TAG: 2.
|
4
|
+
DOCKER_RUBY_VERSION: 2.3
|
5
|
+
RUBY_IMAGE_TAG: 2.3-latest
|
6
6
|
POSTGRES_IMAGE_TAG: 9.6-0.7.0
|
7
7
|
COMPOSE_FILE_EXT: development
|
8
8
|
RAILS_ENV: test
|
@@ -39,10 +39,11 @@ interaction:
|
|
39
39
|
|
40
40
|
clean:
|
41
41
|
service: app
|
42
|
-
command: rm -
|
42
|
+
command: rm -rf Gemfile.lock gemfiles/
|
43
43
|
|
44
44
|
provision:
|
45
45
|
- docker volume create --name bundler_data
|
46
|
+
- dip bundle config --local https://gems.railsc.ru/ ${APRESS_GEMS_CREDENTIALS}
|
46
47
|
- dip clean
|
47
48
|
- dip bundle install
|
48
49
|
- dip appraisal install
|
data/lib/apress-api.rb
CHANGED
data/lib/apress/api.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Apress
|
2
3
|
module Api
|
3
4
|
module ApiController
|
@@ -41,6 +42,10 @@ module Apress
|
|
41
42
|
render_error(400, exception)
|
42
43
|
end
|
43
44
|
|
45
|
+
def unauthorized(exception = nil)
|
46
|
+
render_error(401, exception)
|
47
|
+
end
|
48
|
+
|
44
49
|
def unprocessable(exception_or_errors)
|
45
50
|
@status = 422
|
46
51
|
|
data/lib/apress/api/engine.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rails/engine'
|
2
3
|
|
3
4
|
module Apress
|
@@ -8,15 +9,21 @@ module Apress
|
|
8
9
|
|
9
10
|
Apress::Documentation.add_load_path(config.root.join('app/docs'))
|
10
11
|
|
12
|
+
config.api = {
|
13
|
+
secret_token_ttl: 1.hour,
|
14
|
+
refresh_token_ttl: 1.week,
|
15
|
+
v1_doc_path: 'docs/swagger/v1.json',
|
16
|
+
version: '1.0.0',
|
17
|
+
title: 'Apress API',
|
18
|
+
description: 'Apress API',
|
19
|
+
terms_of_service: 'None',
|
20
|
+
contact_name: 'Abak-Press Team',
|
21
|
+
base_path: '/api/v1'
|
22
|
+
}
|
23
|
+
|
11
24
|
initializer "apress-api", before: :load_init_rb do |app|
|
12
25
|
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
13
26
|
|
14
|
-
app.config.api = {
|
15
|
-
secret_token_ttl: 1.hour,
|
16
|
-
refresh_token_ttl: 1.week,
|
17
|
-
v1_doc_path: 'docs/swagger/v1.json'
|
18
|
-
}
|
19
|
-
|
20
27
|
::MultiJson.use :oj
|
21
28
|
|
22
29
|
require 'jbuilder/jbuilder_template'
|
data/lib/apress/api/rspec.rb
CHANGED
data/lib/apress/api/version.rb
CHANGED
data/lib/tasks/docs.rake
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "spec_helper"
|
2
3
|
|
3
4
|
describe Apress::Api::ApiController::Base, type: :controller do
|
@@ -28,9 +29,9 @@ describe Apress::Api::ApiController::Base, type: :controller do
|
|
28
29
|
context "when auth failed" do
|
29
30
|
let(:auth_service) { double("auth_service", call: false, client: nil) }
|
30
31
|
|
31
|
-
it "returns
|
32
|
+
it "returns 401" do
|
32
33
|
get :index
|
33
|
-
expect(response.status).to eq
|
34
|
+
expect(response.status).to eq 401
|
34
35
|
expect(controller.current_api_client).to be nil
|
35
36
|
end
|
36
37
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
SIMPLE_TEST = <<-JBUILDER
|
3
4
|
json.paginating_cache! @collection, nil, skip_digest: true do
|
@@ -24,7 +25,7 @@ def jbuild(source_key, collection)
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def view_prefix
|
27
|
-
if Rails::VERSION::MAJOR
|
28
|
+
if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 2
|
28
29
|
'jbuilder/views'
|
29
30
|
else
|
30
31
|
'jbuilder'
|
data/spec/internal/db/schema.rb
CHANGED
data/spec/models/client_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apress-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.24.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- merkushin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -156,6 +156,20 @@ dependencies:
|
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: addressable
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 2.4.0
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 2.4.0
|
159
173
|
- !ruby/object:Gem::Dependency
|
160
174
|
name: resque-integration
|
161
175
|
requirement: !ruby/object:Gem::Requirement
|