multi_client_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8851e7862078a17d9f95bc6ad495229e8b59fdaa
4
+ data.tar.gz: 33fb645c98d071b5c06ce7656c1fb241d06e4ea9
5
+ SHA512:
6
+ metadata.gz: cef09481eae1ac033737522e36215373037f0ac1fc735d5f0ee185a6b79298844caf112949149cbda0da1c9d4d12ca2eb82f26cc81f947f1d2aef869b601de69
7
+ data.tar.gz: 0a8191aa529bd909182aa30b315e15fec7fc7416c51aa311f53b8a1c3b7b3698a333cbd476cd1db1d970e2e20994d605f9d64426e3bc5e5a246c65e36d3d1daf
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Roberto Vasquez Angel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = MultiClient::Api
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'MultiClient::Api'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationApiController < ActionController::API
2
+ include ActionController::Serialization
3
+ end
@@ -0,0 +1,17 @@
1
+ module MultiClient
2
+ module Api
3
+ module V1
4
+ class ClientsController < ::Api::ResourcesController
5
+ def self.resource_class
6
+ MultiClient::Client
7
+ end
8
+
9
+ private
10
+
11
+ def permitted_params
12
+ params.require(:client).permit(:identifier, :subdomain, :enabled)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ module MultiClient
2
+ module Api
3
+ module V1
4
+ class CurrentClientController < MultiClient::Api::Configuration.current_client_base_controller.constantize
5
+ include MultiClient::ControllerWithClient
6
+
7
+ def show
8
+ @resource = load_resource
9
+ head(:no_content) and return if @resource.nil?
10
+ respond_with @resource, include: :client_setting
11
+ end
12
+
13
+ private
14
+
15
+ def load_resource
16
+ current_client
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationSerializer < ActiveModel::Serializer
2
+ end
@@ -0,0 +1,6 @@
1
+ module MultiClient
2
+ module V1
3
+ class ClientSerializer < ApplicationSerializer
4
+ end
5
+ end
6
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,12 @@
1
+ MultiClient::Api::Engine.routes.draw do
2
+ constraints format: 'json' do
3
+ namespace :v1 do
4
+ constraints MultiClient::MasterSubdomain do
5
+ resources :clients
6
+ end
7
+ constraints MultiClient::Subdomain do
8
+ resource :current_client, only: [:show], controller: 'current_client'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module MultiClient
2
+ module Api
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Generates the initializer'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_intializer
10
+ copy_file 'initializer.rb', 'config/initializers/multi_client_api.rb'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ MultiClient::Api.configure do |config|
2
+ # Set the base controller for the current client controller
3
+ #
4
+ # Default: config.current_client_base_controller = 'ApiController'
5
+ #
6
+ config.current_client_base_controller = 'ApiController'
7
+ end
@@ -0,0 +1,11 @@
1
+ module MultiClient
2
+ module Api
3
+ module Configuration
4
+ def configure
5
+ yield self
6
+ end
7
+
8
+ mattr_accessor(:current_client_base_controller) { 'ApiController' }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module MultiClient
2
+ module Api
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace MultiClient::Api
5
+ end
6
+ end
7
+ end
8
+
9
+
10
+
@@ -0,0 +1,5 @@
1
+ module MultiClient
2
+ module Api
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require 'multi_client/api/engine'
2
+ require 'multi_client/api/configuration'
3
+
4
+ module MultiClient
5
+ module Api
6
+ extend Configuration
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'multi_client'
2
+ require 'active_model_serializers'
3
+
4
+ require 'multi_client/api'
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: multi_client_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roberto Vasquez Angel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: multi_client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: active_model_serializers
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: MultiClient::Api Module.
56
+ email:
57
+ - roberto@vasquez-angel.de
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE
63
+ - README.rdoc
64
+ - Rakefile
65
+ - app/controllers/application_api_controller.rb
66
+ - app/controllers/multi_client/api/v1/clients_controller.rb
67
+ - app/controllers/multi_client/api/v1/current_client_controller.rb
68
+ - app/serializers/application_serializer.rb
69
+ - app/serializers/multi_client/v1/client_serializer.rb
70
+ - config/routes.rb
71
+ - lib/generators/multi_client/api/install/install_generator.rb
72
+ - lib/generators/multi_client/api/install/templates/initializer.rb
73
+ - lib/multi_client/api.rb
74
+ - lib/multi_client/api/configuration.rb
75
+ - lib/multi_client/api/engine.rb
76
+ - lib/multi_client/api/version.rb
77
+ - lib/multi_client_api.rb
78
+ homepage: https://github.com/robotex82/multi_client_api
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.8
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: MultiClient::Api.
102
+ test_files: []
103
+ has_rdoc: