activity_stream_client 0.0.1
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.
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'logical_model'
|
2
|
+
module ActivityStream
|
3
|
+
class Activity < LogicalModel
|
4
|
+
self.attribute_keys = [
|
5
|
+
:id,
|
6
|
+
:username,
|
7
|
+
:account_name,
|
8
|
+
:content,
|
9
|
+
:generator,
|
10
|
+
:verb,
|
11
|
+
:target_id,
|
12
|
+
:target_type,
|
13
|
+
:object_id,
|
14
|
+
:object_type,
|
15
|
+
:created_at,
|
16
|
+
:updated_at
|
17
|
+
]
|
18
|
+
|
19
|
+
self.hydra = HYDRA
|
20
|
+
self.use_ssl = (ENV['RACK_ENV']=="production")
|
21
|
+
self.resource_path = "/v0/activities"
|
22
|
+
self.use_api_key = true
|
23
|
+
self.api_key_name = "app_key"
|
24
|
+
self.api_key = API_KEY
|
25
|
+
self.host = HOST
|
26
|
+
|
27
|
+
# this method should be overridden in each app.
|
28
|
+
def local?
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_accessor :cached_object
|
33
|
+
def object
|
34
|
+
if cached_object.present?
|
35
|
+
cached_object
|
36
|
+
elsif local?
|
37
|
+
klass = self.object_type.camelize.constantize
|
38
|
+
self.cached_object = klass.find(object_id) if klass.exists?(object_id)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def local_deleted_object?
|
43
|
+
local? && object.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
attr_accessor :cached_target
|
47
|
+
def target
|
48
|
+
if cached_target.present?
|
49
|
+
cached_target
|
50
|
+
elsif local?
|
51
|
+
klass = target_type.camelize.constantize
|
52
|
+
self.cached_target = klass.find(object_id) if klass.exists?(object_id)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# wrapper for CRM-Merge API interaction
|
2
|
+
# Configuration for LogicalModel on /config/initializers/logical_model.rb
|
3
|
+
module ActivityStream
|
4
|
+
class Merge < LogicalModel
|
5
|
+
|
6
|
+
self.hydra = HYDRA
|
7
|
+
self.use_ssl = (ENV['RACK_ENV'] == "production")
|
8
|
+
self.resource_path = "/v0/merges"
|
9
|
+
self.attribute_keys = [:parent_id, :son_id]
|
10
|
+
self.use_api_key = true
|
11
|
+
self.api_key_name = "app_key"
|
12
|
+
self.api_key = API_KEY
|
13
|
+
self.host = HOST
|
14
|
+
|
15
|
+
def json_root
|
16
|
+
'merge'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activity_stream_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dwayne Macgowan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: logical_model
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: This is client library for padma-ActivityStream-ws
|
47
|
+
email:
|
48
|
+
- dwaynemac@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- app/models/activity_stream/activity.rb
|
54
|
+
- app/models/activity_stream/merge.rb
|
55
|
+
- lib/activity_stream/railties.rb
|
56
|
+
- lib/activity_stream_client.rb
|
57
|
+
homepage: ''
|
58
|
+
licenses: []
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.8.24
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Client library for padma-ActivityStream-ws
|
81
|
+
test_files: []
|
82
|
+
has_rdoc:
|