restpack_activity_service 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f941ceef7e63a3e1dde7778fdf190068af6f627f
4
- data.tar.gz: 84ee257e64578edc633098f4cdf961fccd922471
3
+ metadata.gz: 9f1c0a9d1afe7536bc41a7094a5403a15aa68d67
4
+ data.tar.gz: dfed5e4025f88cf0174c439f56c6341a3399b530
5
5
  SHA512:
6
- metadata.gz: 653043c127353e54b5bfaa31640860e2af066536706b1eb4c118728998814d5c51297be4d7d766d2cabb8cc5029276247d45ef0694b9471b6704df3326525b95
7
- data.tar.gz: d9611d2a47eb56eab3cca643324d260de8fb2622443988510f98a7b938a1ce083dade134ff30eea5503f87bc4cc64788c72379688fba11d6a0c9daab1f40ce77
6
+ metadata.gz: 47d68d0783d43340d351fefe90df707dff3881a1d504f47c208dc315982b1bd1ebd3850edd9cbf9bc77e7df56f7ae5a9e5287d2fa8082ee6586d860f2753d57b
7
+ data.tar.gz: 6d1ccc2c5e9fe1ab100ddc57a2abce348cbb1e5cc027aa564526cae8cdc3f44e8c1e69fa2e6182987d6b2a72c8aca4f0e4294133c641d0f386afa889cf7e6ace
@@ -11,4 +11,8 @@ require "restpack_activity_service/serializers/activity_serializer"
11
11
  require "restpack_activity_service/services"
12
12
  require "restpack_activity_service/tasks"
13
13
 
14
- require "restpack_activity_service/api/activity_api"
14
+ require "restpack_activity_service/api/activity"
15
+
16
+ Models = RestPack::Activity::Service::Models
17
+ Commands = RestPack::Activity::Service::Commands
18
+ Serializers = RestPack::Activity::Service::Serializers
@@ -1,25 +1,25 @@
1
1
  require 'sinatra'
2
2
 
3
- module RestPack
4
- class ActivityApi < Sinatra::Base
3
+ module RestPack::Activity::Service::Api
4
+ class Activity < Sinatra::Base
5
5
  get "/.json" do
6
- render RestPack::Services::Activity::List.run(params, application_params)
6
+ render Commands::Activity::List.run(params, application_params)
7
7
  end
8
8
 
9
9
  get "/:id.json" do
10
- render RestPack::Services::Activity::Get.run(params, application_params)
10
+ render Commands::Activity::Get.run(params, application_params)
11
11
  end
12
12
 
13
13
  post "/.json" do
14
- render RestPack::Services::Activity::Create.run(params, application_params)
14
+ render Commands::Activity::Create.run(params, application_params)
15
15
  end
16
16
 
17
17
  put "/:id.json" do
18
- render RestPack::Services::Activity::Update.run(params, application_params)
18
+ render Commands::Activity::Update.run(params, application_params)
19
19
  end
20
20
 
21
21
  delete "/:id.json" do
22
- render RestPack::Services::Activity::Destroy.run(params, application_params)
22
+ render Commands::Activity::Destroy.run(params, application_params)
23
23
  end
24
24
 
25
25
  private
@@ -1,4 +1,4 @@
1
- module RestPack::Services
1
+ module RestPack::Activity::Service::Commands
2
2
 
3
3
  end
4
4
 
@@ -1,4 +1,4 @@
1
- module RestPack::Services::Activity
1
+ module RestPack::Activity::Service::Commands::Activity
2
2
  class Create < RestPack::Service::Command
3
3
  required do
4
4
  integer :application_id
@@ -33,8 +33,8 @@ module RestPack::Services::Activity
33
33
  end
34
34
 
35
35
  def execute
36
- activity = RestPack::Activity::Service::Models::Activity.create(inputs)
37
- RestPack::Activity::Service::Serializers::ActivitySerializer.as_json(activity)
36
+ activity = Models::Activity.create(inputs)
37
+ Serializers::ActivitySerializer.as_json(activity)
38
38
  end
39
39
  end
40
40
  end
@@ -1,4 +1,4 @@
1
- module RestPack::Services::Activity
1
+ module RestPack::Activity::Service::Commands::Activity
2
2
  class Destroy < RestPack::Service::Command
3
3
  required do
4
4
  integer :id
@@ -6,7 +6,7 @@ module RestPack::Services::Activity
6
6
  end
7
7
 
8
8
  def execute
9
- activity = RestPack::Activity::Service::Models::Activity.find_by_id_and_application_id(
9
+ activity = Models::Activity.find_by_id_and_application_id(
10
10
  inputs[:id],
11
11
  inputs[:application_id]
12
12
  )
@@ -1,4 +1,4 @@
1
- module RestPack::Services::Activity
1
+ module RestPack::Activity::Service::Commands::Activity
2
2
  class Get < RestPack::Service::Command
3
3
  required do
4
4
  integer :id
@@ -6,13 +6,13 @@ module RestPack::Services::Activity
6
6
  end
7
7
 
8
8
  def execute
9
- activity = RestPack::Activity::Service::Models::Activity.find_by_id_and_application_id(
9
+ activity = Models::Activity.find_by_id_and_application_id(
10
10
  inputs[:id],
11
11
  inputs[:application_id]
12
12
  )
13
13
 
14
14
  if activity
15
- RestPack::Activity::Service::Serializers::ActivitySerializer.as_json(activity)
15
+ Serializers::ActivitySerializer.as_json(activity)
16
16
  else
17
17
  status :not_found
18
18
  end
@@ -1,4 +1,4 @@
1
- module RestPack::Services::Activity
1
+ module RestPack::Activity::Service::Commands::Activity
2
2
  class List < RestPack::Service::Command
3
3
  required do
4
4
  integer :application_id
@@ -14,7 +14,7 @@ module RestPack::Services::Activity
14
14
  end
15
15
 
16
16
  def execute
17
- scope = RestPack::Activity::Service::Models::Activity.all
17
+ scope = Models::Activity.all
18
18
  scope = scope.where(application_id: application_id)
19
19
 
20
20
  scope = scope.where(user_id: user_id) if user_id
@@ -22,7 +22,7 @@ module RestPack::Services::Activity
22
22
  scope = scope.any_tags_csv(access, :access) if access
23
23
  scope = scope.search(query) if query
24
24
 
25
- RestPack::Activity::Service::Serializers::ActivitySerializer.resource(inputs, scope)
25
+ Serializers::ActivitySerializer.resource(inputs, scope)
26
26
  end
27
27
  end
28
28
  end
@@ -1,4 +1,4 @@
1
- module RestPack::Services::Activity
1
+ module RestPack::Activity::Service::Commands::Activity
2
2
  class Update < RestPack::Service::Command
3
3
  required do
4
4
  integer :id
@@ -1,7 +1,7 @@
1
1
  module RestPack
2
2
  module Activity
3
3
  module Service
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.7"
5
5
  end
6
6
  end
7
7
  end
@@ -6,7 +6,7 @@ class ActivityFactory
6
6
  content: "This is the content ##{sequence}"
7
7
  })
8
8
 
9
- RestPack::Services::Activity::Create.run!(params)
9
+ RestPack::Activity::Service::Commands::Activity::Create.run!(params)
10
10
  end
11
11
 
12
12
  private
@@ -1,6 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe RestPack::Services::Activity::Create do
3
+ describe Commands::Activity::Create do
4
4
  is_required :application_id, :user_id, :content
5
5
  is_optional :title, :tags, :access, :latitude, :longitude
6
6
 
@@ -1,6 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe RestPack::Services::Activity::Destroy do
3
+ describe Commands::Activity::Destroy do
4
4
  is_required :id, :application_id
5
5
 
6
6
  let(:response) { subject.class.run(params) }
@@ -19,7 +19,7 @@ describe RestPack::Services::Activity::Destroy do
19
19
  it 'deletes the activity' do
20
20
  response.success?.should == true
21
21
  response.result.should == {}
22
- RestPack::Services::Activity::Get.run(params).status.should == :not_found
22
+ Commands::Activity::Get.run(params).status.should == :not_found
23
23
  end
24
24
  end
25
25
 
@@ -1,6 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe RestPack::Services::Activity::Get do
3
+ describe Commands::Activity::Get do
4
4
  is_required :id, :application_id
5
5
 
6
6
  let(:response) { subject.class.run(params) }
@@ -1,6 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe RestPack::Services::Activity::List do
3
+ describe Commands::Activity::List do
4
4
  is_required :application_id
5
5
  is_optional :user_id, :page, :page_size, :tags, :access, :query
6
6
 
@@ -46,7 +46,7 @@ describe RestPack::Services::Activity::List do
46
46
  context 'valid' do
47
47
  let(:params) { { application_id: 100 } }
48
48
  it 'retuns activities' do
49
- response.result[:meta][:activities][:count].should == RestPack::Activity::Service::Models::Activity.count
49
+ response.result[:meta][:activities][:count].should == Models::Activity.count
50
50
  end
51
51
  end
52
52
 
@@ -63,7 +63,7 @@ describe RestPack::Services::Activity::List do
63
63
  let(:params) { { application_id: 100, user_id: 200 }}
64
64
 
65
65
  it 'returns activities' do
66
- response.result[:meta][:activities][:count].should == RestPack::Activity::Service::Models::Activity.count
66
+ response.result[:meta][:activities][:count].should == Models::Activity.count
67
67
  end
68
68
  end
69
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_activity_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
@@ -166,7 +166,7 @@ files:
166
166
  - config/database.yml
167
167
  - db/migrate/20130630145408_create_activity_table.rb
168
168
  - lib/restpack_activity_service.rb
169
- - lib/restpack_activity_service/api/activity_api.rb
169
+ - lib/restpack_activity_service/api/activity.rb
170
170
  - lib/restpack_activity_service/configuration.rb
171
171
  - lib/restpack_activity_service/models/activity.rb
172
172
  - lib/restpack_activity_service/models/base.rb