restpack_activity 0.0.5 → 0.0.7
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/README.md +1 -1
- data/lib/restpack_activity/models/activity.rb +4 -2
- data/lib/restpack_activity/proxies/activity/api.rb +9 -6
- data/lib/restpack_activity/proxies/activity/local.rb +5 -5
- data/lib/restpack_activity/proxies/base_proxy.rb +2 -0
- data/lib/restpack_activity/version.rb +1 -1
- data/restpack_activity.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a83e44dd48091b097197d6364e09e283512ca9
|
4
|
+
data.tar.gz: 77b177e9fc4b919e3d32b5075198d08e6551919b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb4c30d671916dfc61279c1d3693e9a78982d3f1351bfe6aa1e090f4ade023685668112ac6e056a6c62f97fc6e5d813a15a6d67854fbdc21ae8668a86829d702
|
7
|
+
data.tar.gz: dcb4a6c27cd0564fd3be7f967f5b0d575cc3a0d6dcdfd18e67b75ded6c56c490800412106e2736dca3d66b5fb101669d304705a1c644c63f87e68f45dd537b6f
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# restpack_activity [](https://travis-ci.org/RestPack/restpack_activity) [](https://codeclimate.com/github/RestPack/restpack_activity) [](https://gemnasium.com/RestPack/restpack_activity)
|
1
|
+
# restpack_activity [](https://travis-ci.org/RestPack/restpack_activity) [](https://codeclimate.com/github/RestPack/restpack_activity) [](https://gemnasium.com/RestPack/restpack_activity) [](http://badge.fury.io/rb/restpack_activity)
|
2
2
|
|
3
3
|
A client gem to the RestPack Activity service
|
4
4
|
|
@@ -13,7 +13,7 @@ class Activity
|
|
13
13
|
|
14
14
|
def self.get(id)
|
15
15
|
response = service.get(id)
|
16
|
-
Activity.new(response.result)
|
16
|
+
Activity.new(response.result[:activities].first)
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.destroy(id)
|
@@ -75,6 +75,7 @@ class Activity
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def update_attributes(params)
|
78
|
+
#TODO: GJ: extract into base class
|
78
79
|
#TODO: whitelist updateble params
|
79
80
|
@title = params[:title] if params[:title]
|
80
81
|
@content = params[:content] if params[:content]
|
@@ -97,6 +98,7 @@ class Activity
|
|
97
98
|
private
|
98
99
|
|
99
100
|
def attributes
|
101
|
+
#TODO: GJ: extract into base class
|
100
102
|
#TODO: GJ: only those that have changed
|
101
103
|
hash = {
|
102
104
|
id: @id,
|
@@ -104,13 +106,13 @@ class Activity
|
|
104
106
|
user_id: @user_id,
|
105
107
|
title: @title,
|
106
108
|
content: @content,
|
107
|
-
data: @data,
|
108
109
|
tags: @tags.join(','),
|
109
110
|
access: @access.join(',')
|
110
111
|
}
|
111
112
|
|
112
113
|
hash[:latitude] = @latitude unless @latitude.blank?
|
113
114
|
hash[:longitude] = @longitude unless @longitude.blank?
|
115
|
+
hash[:data] = @data unless @data.blank?
|
114
116
|
hash
|
115
117
|
end
|
116
118
|
end
|
@@ -3,23 +3,23 @@ require 'rest_client'
|
|
3
3
|
module RestPack::Activity::Proxies
|
4
4
|
class Api < RestPack::BaseProxy
|
5
5
|
def self.get(id)
|
6
|
-
http(:get, "/api/v1/activities/#{id}
|
6
|
+
http(:get, "/api/v1/activities/#{id}")
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.list(params = {})
|
10
|
-
http(:get, "/api/v1/activities
|
10
|
+
http(:get, "/api/v1/activities", params)
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.create(params)
|
14
|
-
http(:post, "/api/v1/activities
|
14
|
+
http(:post, "/api/v1/activities", params)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.update(params)
|
18
|
-
http(:put, "/api/v1/activities/#{params[:id]}
|
18
|
+
http(:put, "/api/v1/activities/#{params[:id]}", params)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.destroy(id)
|
22
|
-
http(:delete, "/api/v1/activities/#{id}
|
22
|
+
http(:delete, "/api/v1/activities/#{id}")
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -27,7 +27,10 @@ module RestPack::Activity::Proxies
|
|
27
27
|
def self.http(method, path, params = {})
|
28
28
|
params = { params: params } if method == :get
|
29
29
|
|
30
|
-
|
30
|
+
credentials = "#{RestPack::Activity.config.application_id}:#{RestPack::Activity.config.api_token}"
|
31
|
+
|
32
|
+
url = "http://#{credentials}@#{RestPack::Activity.config.api_domain}#{path}"
|
33
|
+
RestClient.send(method, url, params) do |rest_response|
|
31
34
|
response = RestPack::Service::Response.from_rest(rest_response)
|
32
35
|
raise_exceptions_if_required(response)
|
33
36
|
response
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module RestPack::Activity::Proxies
|
2
2
|
class Local < RestPack::BaseProxy
|
3
3
|
def self.get(id)
|
4
|
-
response =
|
4
|
+
response = Commands::Activities::Activity::Get.run({
|
5
5
|
id: id,
|
6
6
|
application_id: RestPack::Activity.config.application_id
|
7
7
|
})
|
@@ -11,7 +11,7 @@ module RestPack::Activity::Proxies
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.list(params = {})
|
14
|
-
response =
|
14
|
+
response = Commands::Activities::Activity::List.run(params, {
|
15
15
|
application_id: RestPack::Activity.config.application_id
|
16
16
|
})
|
17
17
|
|
@@ -20,7 +20,7 @@ module RestPack::Activity::Proxies
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.create(params)
|
23
|
-
response =
|
23
|
+
response = Commands::Activities::Activity::Create.run(params, {
|
24
24
|
application_id: RestPack::Activity.config.application_id
|
25
25
|
})
|
26
26
|
|
@@ -29,7 +29,7 @@ module RestPack::Activity::Proxies
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.update(params)
|
32
|
-
response =
|
32
|
+
response = Commands::Activities::Activity::Update.run(params, {
|
33
33
|
application_id: RestPack::Activity.config.application_id
|
34
34
|
})
|
35
35
|
|
@@ -38,7 +38,7 @@ module RestPack::Activity::Proxies
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.destroy(id)
|
41
|
-
response =
|
41
|
+
response = Commands::Activities::Activity::Destry.run({
|
42
42
|
id: id,
|
43
43
|
application_id: RestPack::Activity.config.application_id
|
44
44
|
})
|
data/restpack_activity.gemspec
CHANGED
@@ -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_activity_service"
|
21
|
+
spec.add_dependency "restpack_activity_service"
|
22
22
|
spec.add_dependency "activemodel", "~> 4.0.0"
|
23
23
|
spec.add_dependency "activesupport", "~> 4.0"
|
24
24
|
spec.add_dependency "rest-client", "~> 1.6.7"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restpack_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
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-
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: restpack_activity_service
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
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
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.0.
|
185
|
+
rubygems_version: 2.0.7
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: A client gem to the activity service
|