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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2bee426ae4a23da2add15e79d02eeb7c4c0cc0a
4
- data.tar.gz: f68631c3b3ce233431fa1e0691abce208c946e22
3
+ metadata.gz: 274fbf1cecbca4f5bedc1b02ae49fea9eb077492
4
+ data.tar.gz: 58e4777bf47d36144b57be6fa139c9d166422fff
5
5
  SHA512:
6
- metadata.gz: 96ed4b9255544b9333a26498e0bfe5065056b53cff908637e6b7d662d59dce04b7bf2e9f4dae72cf4a786d9ed1ed821114afe6fc726b01fb843e0f2079cabd4a
7
- data.tar.gz: 508c2670a7be016519b23039a89ee842ebd5faa16c5dec65e99e5ba2f944efe6e058aed768421aa3d163c9b4a0df724485fae375b22daf5da60a34571edf0491
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 table_name do |t|
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 table_name do |t|
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 table_name do |t|
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
- restpack_table_name :applications
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 Domain < Base
3
- restpack_table_name :domains
2
+ class Domain < ActiveRecord::Base
3
+ self.table_name = :restpack_domains
4
4
  attr_accessible :identifier, :host
5
5
 
6
6
  validates_presence_of :identifier
@@ -1,6 +1,6 @@
1
1
  module RestPack::Core::Service::Models
2
- class Host < Base
3
- restpack_table_name :hosts
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
- status :forbidden if !application
14
+ if application
15
+ { id: application.id }
16
+ else
17
+ status :forbidden
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -33,7 +33,7 @@ namespace :restpack do
33
33
  task :configuration do
34
34
  p "RestPack::Core::Service Configuration"
35
35
  p "--------------------------------"
36
- p "db_table_prefix: #{RestPack::Core::Service.config.db_table_prefix}"
36
+ p "TODO"
37
37
  end
38
38
  end
39
39
  end
@@ -1,7 +1,7 @@
1
1
  module RestPack
2
2
  module Core
3
3
  module Service
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
6
6
  end
7
7
  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
- Models = RestPack::Core::Service::Models
16
- Commands = RestPack::Core::Service::Commands
17
- # Serializers = RestPack::Core::Service::Serializers
15
+ module Core
16
+ Models = RestPack::Core::Service::Models
17
+ Commands = RestPack::Core::Service::Commands
18
+ # Serializers = RestPack::Core::Service::Serializers
19
+ end
@@ -1,7 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RestPack::Core::Service::Configuration do
4
- it "has a default table prefix" do
5
- RestPack::Core::Service.config.db_table_prefix.should == "restpack_"
6
- end
4
+
7
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
- factory :application, :class => Models::Application do
2
+ factory :application, :class => Core::Models::Application do
3
3
  sequence(:name) {|n| "Application ##{n}" }
4
4
  sequence(:account_id)
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
- factory :domain, :class => Models::Domain do
2
+ factory :domain, :class => Core::Models::Domain do
3
3
  sequence(:identifier) {|n| "subdomain_#{n}.domain.com" }
4
4
  host
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
- factory :host, :class => Models::Host do
2
+ factory :host, :class => Core::Models::Host do
3
3
  sequence(:name) {|n| "Host ##{n}" }
4
4
  application
5
5
  end
@@ -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.5
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
@@ -1,9 +0,0 @@
1
- module RestPack::Core::Service::Models
2
- class Base < ActiveRecord::Base
3
- self.abstract_class = true
4
-
5
- def self.restpack_table_name(name)
6
- self.table_name = RestPack::Core::Service.config.prefix_db_table(name)
7
- end
8
- end
9
- end