restpack_activity_service 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/db/migrate/20130630145408_create_activity_table.rb +1 -1
- data/lib/restpack_activity_service/configuration.rb +6 -17
- data/lib/restpack_activity_service/models/activity.rb +1 -3
- data/lib/restpack_activity_service/models/base.rb +2 -2
- data/lib/restpack_activity_service/serializers/activity_serializer.rb +2 -2
- data/lib/restpack_activity_service/services/activity/create.rb +2 -2
- data/lib/restpack_activity_service/services/activity/destroy.rb +1 -1
- data/lib/restpack_activity_service/services/activity/get.rb +2 -2
- data/lib/restpack_activity_service/services/activity/list.rb +2 -2
- data/lib/restpack_activity_service/services/activity/update.rb +2 -2
- data/lib/restpack_activity_service/tasks/db.rake +1 -1
- data/lib/restpack_activity_service/version.rb +1 -1
- data/lib/restpack_activity_service.rb +1 -0
- data/restpack_activity_service.gemspec +1 -1
- data/spec/services/list_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f941ceef7e63a3e1dde7778fdf190068af6f627f
|
4
|
+
data.tar.gz: 84ee257e64578edc633098f4cdf961fccd922471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 653043c127353e54b5bfaa31640860e2af066536706b1eb4c118728998814d5c51297be4d7d766d2cabb8cc5029276247d45ef0694b9471b6704df3326525b95
|
7
|
+
data.tar.gz: d9611d2a47eb56eab3cca643324d260de8fb2622443988510f98a7b938a1ce083dade134ff30eea5503f87bc4cc64788c72379688fba11d6a0c9daab1f40ce77
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/RestPack/restpack_activity_service.png?branch=master)](https://travis-ci.org/RestPack/restpack_activity_service) [![Code Climate](https://codeclimate.com/github/RestPack/restpack_activity_service.png)](https://codeclimate.com/github/RestPack/restpack_activity_service) [![Dependency Status](https://gemnasium.com/RestPack/restpack_activity_service.png)](https://gemnasium.com/RestPack/restpack_activity_service) [![Gem Version](https://badge.fury.io/rb/restpack_activity_service.png)](http://badge.fury.io/rb/restpack_activity_service) [![Coverage Status](https://coveralls.io/repos/RestPack/restpack_activity_service/badge.png?branch=master)](https://coveralls.io/r/RestPack/restpack_activity_service?branch=master)
|
1
|
+
# restpack_activity_service
|
4
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/RestPack/restpack_activity_service.png?branch=master)](https://travis-ci.org/RestPack/restpack_activity_service) [![Code Climate](https://codeclimate.com/github/RestPack/restpack_activity_service.png)](https://codeclimate.com/github/RestPack/restpack_activity_service) [![Dependency Status](https://gemnasium.com/RestPack/restpack_activity_service.png)](https://gemnasium.com/RestPack/restpack_activity_service) [![Gem Version](https://badge.fury.io/rb/restpack_activity_service.png)](http://badge.fury.io/rb/restpack_activity_service)
|
5
4
|
|
6
5
|
**Work In Progress**
|
7
6
|
|
@@ -1,24 +1,13 @@
|
|
1
1
|
module RestPack::Activity::Service
|
2
|
-
class Configuration
|
3
|
-
attr_accessor :
|
2
|
+
class Configuration < RestPack::Service::Configuration
|
3
|
+
attr_accessor :application_id
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
@database_table_prefix = "restpack_"
|
7
|
-
end
|
8
|
-
|
9
|
-
def prefix_table_name(name)
|
10
|
-
"#{@database_table_prefix}#{name}".to_sym
|
11
|
-
end
|
12
5
|
end
|
13
6
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
7
|
+
mattr_accessor :config
|
8
|
+
@@config = Configuration.new
|
17
9
|
|
18
|
-
def self.
|
19
|
-
|
20
|
-
yield configuration if block_given?
|
10
|
+
def self.setup
|
11
|
+
yield @@config
|
21
12
|
end
|
22
|
-
|
23
|
-
self.configure
|
24
13
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module RestPack::Models
|
1
|
+
module RestPack::Activity::Service::Models
|
2
2
|
class Base < ActiveRecord::Base
|
3
3
|
self.abstract_class = true
|
4
4
|
|
5
5
|
def self.restpack_table_name(name)
|
6
|
-
self.table_name = RestPack::Activity::Service.
|
6
|
+
self.table_name = RestPack::Activity::Service.config.prefix_db_table(name)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module RestPack::Serializers
|
1
|
+
module RestPack::Activity::Service::Serializers
|
2
2
|
class ActivitySerializer
|
3
3
|
include RestPack::Serializer
|
4
4
|
|
5
|
-
self.model_class = RestPack::Models::Activity
|
5
|
+
self.model_class = RestPack::Activity::Service::Models::Activity
|
6
6
|
self.key = :activities
|
7
7
|
|
8
8
|
attributes :id, :application_id, :user_id, :title, :content, :latitude, :longitude,
|
@@ -33,8 +33,8 @@ module RestPack::Services::Activity
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def execute
|
36
|
-
activity = RestPack::Models::Activity.create(inputs)
|
37
|
-
RestPack::Serializers::ActivitySerializer.as_json(activity)
|
36
|
+
activity = RestPack::Activity::Service::Models::Activity.create(inputs)
|
37
|
+
RestPack::Activity::Service::Serializers::ActivitySerializer.as_json(activity)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -6,7 +6,7 @@ module RestPack::Services::Activity
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def execute
|
9
|
-
activity = RestPack::Models::Activity.find_by_id_and_application_id(
|
9
|
+
activity = RestPack::Activity::Service::Models::Activity.find_by_id_and_application_id(
|
10
10
|
inputs[:id],
|
11
11
|
inputs[:application_id]
|
12
12
|
)
|
@@ -6,13 +6,13 @@ module RestPack::Services::Activity
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def execute
|
9
|
-
activity = RestPack::Models::Activity.find_by_id_and_application_id(
|
9
|
+
activity = RestPack::Activity::Service::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::Serializers::ActivitySerializer.as_json(activity)
|
15
|
+
RestPack::Activity::Service::Serializers::ActivitySerializer.as_json(activity)
|
16
16
|
else
|
17
17
|
status :not_found
|
18
18
|
end
|
@@ -14,7 +14,7 @@ module RestPack::Services::Activity
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def execute
|
17
|
-
scope = RestPack::Models::Activity.all
|
17
|
+
scope = RestPack::Activity::Service::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::Serializers::ActivitySerializer.resource(inputs, scope)
|
25
|
+
RestPack::Activity::Service::Serializers::ActivitySerializer.resource(inputs, scope)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -19,11 +19,11 @@ module RestPack::Services::Activity
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def execute
|
22
|
-
activity = RestPack::Models::Activity.find_by_id_and_application_id(inputs[:id], inputs[:application_id])
|
22
|
+
activity = RestPack::Activity::Service::Models::Activity.find_by_id_and_application_id(inputs[:id], inputs[:application_id])
|
23
23
|
|
24
24
|
if activity
|
25
25
|
activity.update_attributes(inputs)
|
26
|
-
RestPack::Serializers::ActivitySerializer.as_json(activity)
|
26
|
+
RestPack::Activity::Service::Serializers::ActivitySerializer.as_json(activity)
|
27
27
|
else
|
28
28
|
status :not_found
|
29
29
|
end
|
@@ -33,7 +33,7 @@ namespace :restpack do
|
|
33
33
|
task :configuration do
|
34
34
|
p "RestPack::Activity::Service Configuration"
|
35
35
|
p "--------------------------------"
|
36
|
-
p "database_table_prefix: #{RestPack::Activity::Service.
|
36
|
+
p "database_table_prefix: #{RestPack::Activity::Service.config.database_table_prefix}"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -4,6 +4,7 @@ require "restpack_serializer"
|
|
4
4
|
|
5
5
|
require "restpack_activity_service/version"
|
6
6
|
require "restpack_activity_service/configuration"
|
7
|
+
require "restpack_activity_service/models/base"
|
7
8
|
require "restpack_activity_service/models/activity"
|
8
9
|
|
9
10
|
require "restpack_activity_service/serializers/activity_serializer"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "restpack_service", "~> 0.0.
|
21
|
+
spec.add_dependency "restpack_service", "~> 0.0.27"
|
22
22
|
spec.add_dependency "restpack_serializer", "~> 0.4.1"
|
23
23
|
spec.add_dependency "restpack_gem", "~> 0.0.9"
|
24
24
|
spec.add_dependency "sinatra", "~> 1.4.3"
|
data/spec/services/list_spec.rb
CHANGED
@@ -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::Models::Activity.count
|
49
|
+
response.result[:meta][:activities][:count].should == RestPack::Activity::Service::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::Models::Activity.count
|
66
|
+
response.result[:meta][:activities][:count].should == RestPack::Activity::Service::Models::Activity.count
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restpack_activity_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Joyce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: restpack_service
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.27
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.27
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: restpack_serializer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|