restpack_core_service 0.0.5 → 0.0.6
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/db/migrate/20130807103945_create_applications.rb +1 -5
- data/db/migrate/20130808135549_create_hosts.rb +1 -5
- data/db/migrate/20130808135613_create_domains.rb +1 -5
- data/lib/restpack_core_service/models/application.rb +2 -2
- data/lib/restpack_core_service/models/domain.rb +2 -2
- data/lib/restpack_core_service/models/host.rb +2 -2
- data/lib/restpack_core_service/services/application/verify_api_token.rb +6 -2
- data/lib/restpack_core_service/tasks/db.rake +1 -1
- data/lib/restpack_core_service/version.rb +1 -1
- data/lib/restpack_core_service.rb +6 -4
- data/spec/configuration_spec.rb +1 -3
- data/spec/factories/application_factory.rb +1 -1
- data/spec/factories/domain_factory.rb +1 -1
- data/spec/factories/host_factory.rb +1 -1
- data/spec/services/application/verify_api_token_spec.rb +2 -2
- metadata +1 -2
- data/lib/restpack_core_service/models/base.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 274fbf1cecbca4f5bedc1b02ae49fea9eb077492
|
4
|
+
data.tar.gz: 58e4777bf47d36144b57be6fa139c9d166422fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e71253fad5eb5ce4c381033945e594b04187e53cdc74d381a049e0f2c5af46a5317851e0c50912ded7e09483eeb4fd25a367ace6d46fc70bf531287a0424226
|
7
|
+
data.tar.gz: 5c2ffe4f2dce2fe189386b8b52d27dc5b0c8b9bc3c006fdcd3cda9c46d55abc3bc651a45f331b857f693eddf1d3220dce26593d1fd1533bcd706fddfa953fa88
|
@@ -1,10 +1,6 @@
|
|
1
1
|
class CreateApplications < ActiveRecord::Migration
|
2
|
-
def table_name
|
3
|
-
RestPack::Core::Service.config.prefix_db_table(:applications)
|
4
|
-
end
|
5
|
-
|
6
2
|
def change
|
7
|
-
create_table
|
3
|
+
create_table :restpack_applications do |t|
|
8
4
|
t.string :name, :null => false, :limit => 256
|
9
5
|
t.string :api_token, :null => false, :limit => 512
|
10
6
|
t.integer :account_id, :null => false
|
@@ -1,10 +1,6 @@
|
|
1
1
|
class CreateHosts < ActiveRecord::Migration
|
2
|
-
def table_name
|
3
|
-
RestPack::Core::Service.config.prefix_db_table(:hosts)
|
4
|
-
end
|
5
|
-
|
6
2
|
def change
|
7
|
-
create_table
|
3
|
+
create_table :restpack_hosts do |t|
|
8
4
|
t.string :name, :null => false, :limit => 256
|
9
5
|
t.integer :application_id, :null => false
|
10
6
|
t.string :session_secret, :null => false, :limit => 128
|
@@ -1,10 +1,6 @@
|
|
1
1
|
class CreateDomains < ActiveRecord::Migration
|
2
|
-
def table_name
|
3
|
-
RestPack::Core::Service.config.prefix_db_table(:domains)
|
4
|
-
end
|
5
|
-
|
6
2
|
def change
|
7
|
-
create_table
|
3
|
+
create_table :restpack_domains do |t|
|
8
4
|
t.string :identifier, :null => false, :limit => 512
|
9
5
|
t.integer :host_id, :null => false
|
10
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RestPack::Core::Service::Models
|
2
|
-
class Application < Base
|
3
|
-
|
2
|
+
class Application < ActiveRecord::Base
|
3
|
+
self.table_name = :restpack_applications
|
4
4
|
attr_accessible :name, :account_id
|
5
5
|
|
6
6
|
validates_presence_of :name, :account_id
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RestPack::Core::Service::Models
|
2
|
-
class Host < Base
|
3
|
-
|
2
|
+
class Host < ActiveRecord::Base
|
3
|
+
self.table_name = :restpack_hosts
|
4
4
|
attr_accessible :name, :application_id, :session_secret, :oauth_providers
|
5
5
|
|
6
6
|
validates_presence_of :name, :application_id
|
@@ -6,12 +6,16 @@ module RestPack::Core::Service::Commands::Application
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def execute
|
9
|
-
application = Models::Application.find_by_id_and_api_token(
|
9
|
+
application = Core::Models::Application.find_by_id_and_api_token(
|
10
10
|
inputs[:id],
|
11
11
|
inputs[:api_token]
|
12
12
|
)
|
13
13
|
|
14
|
-
|
14
|
+
if application
|
15
|
+
{ id: application.id }
|
16
|
+
else
|
17
|
+
status :forbidden
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
require "active_record"
|
1
2
|
require "restpack_service"
|
2
3
|
require "active_support/core_ext"
|
3
4
|
|
4
5
|
require "restpack_core_service/version"
|
5
6
|
require "restpack_core_service/configuration"
|
6
7
|
|
7
|
-
require "restpack_core_service/models/base"
|
8
8
|
require "restpack_core_service/models/application"
|
9
9
|
require "restpack_core_service/models/host"
|
10
10
|
require "restpack_core_service/models/domain"
|
@@ -12,6 +12,8 @@ require "restpack_core_service/models/domain"
|
|
12
12
|
require "restpack_core_service/services"
|
13
13
|
require "restpack_core_service/tasks"
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
module Core
|
16
|
+
Models = RestPack::Core::Service::Models
|
17
|
+
Commands = RestPack::Core::Service::Commands
|
18
|
+
# Serializers = RestPack::Core::Service::Serializers
|
19
|
+
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative '../../spec_helper'
|
2
2
|
|
3
|
-
describe Commands::Application::VerifyApiToken do
|
3
|
+
describe Core::Commands::Application::VerifyApiToken do
|
4
4
|
is_required :id, :api_token
|
5
5
|
|
6
6
|
let(:response) { subject.class.run(params) }
|
@@ -17,7 +17,7 @@ describe Commands::Application::VerifyApiToken do
|
|
17
17
|
|
18
18
|
it 'is valid' do
|
19
19
|
response.success?.should == true
|
20
|
-
response.result.should == {}
|
20
|
+
response.result.should == { id: @application.id }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restpack_core_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Joyce
|
@@ -198,7 +198,6 @@ files:
|
|
198
198
|
- lib/restpack_core_service.rb
|
199
199
|
- lib/restpack_core_service/configuration.rb
|
200
200
|
- lib/restpack_core_service/models/application.rb
|
201
|
-
- lib/restpack_core_service/models/base.rb
|
202
201
|
- lib/restpack_core_service/models/domain.rb
|
203
202
|
- lib/restpack_core_service/models/host.rb
|
204
203
|
- lib/restpack_core_service/serializers/user_serializer.rb
|