messaging_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ module Messaging
2
+ class Message < LogicalModel
3
+ self.hydra = HYDRA
4
+ self.resource_path = "/v0/messages"
5
+ self.attribute_keys =
6
+ [
7
+ :key_name,
8
+ :data
9
+ ]
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
+ 'message'
17
+ end
18
+
19
+ def self.paginate()
20
+ raise 'Not Implemented In Service'
21
+ end
22
+
23
+ def destroy()
24
+ raise 'Not Implemented In Service'
25
+ end
26
+
27
+ def update()
28
+ raise 'Not Implemented In Service'
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module Messaging
2
+ class NotifyMe < LogicalModel
3
+ self.hydra = HYDRA
4
+ self.resource_path = "/v0/notify_me"
5
+ self.attribute_keys =
6
+ [
7
+ :secret_key, # secret key to validate notification
8
+ :url, # url to which notification should be posted
9
+ :key_name # key from wich to receive notifications
10
+ ]
11
+ self.use_api_key = true
12
+ self.api_key_name = "app_key"
13
+ self.api_key = API_KEY
14
+ self.host = HOST
15
+
16
+ def json_root
17
+ 'notify_me'
18
+ end
19
+
20
+ def destroy()
21
+ # needs a diferent implementation, there is no ID.
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ if(defined?(Rails))
2
+ module Messaging
3
+
4
+ unless defined? HYDRA
5
+ HYDRA = Typhoeus::Hydra.new
6
+ end
7
+
8
+ HOST = case Rails.env
9
+ when "production"
10
+ "padma-messaging.herokuapp.com"
11
+ when "staging"
12
+ "padma-messaging-staging.herokuapp.com"
13
+ when "development"
14
+ "localhost:3011"
15
+ when "test"
16
+ "localhost:3011"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ module Messaging
2
+ class Client
3
+
4
+ # @param key_name [String]
5
+ # @param url [String]
6
+ # @param secret_key [String]
7
+ def self.subscribe_to(key_name,url,secret_key="")
8
+
9
+ end
10
+
11
+ # @param key_name [String]
12
+ def self.unsubscribe_from(key_name)
13
+
14
+ end
15
+
16
+ # @param key [String]
17
+ # @param data [Hash]
18
+ def self.post_message(key,data={})
19
+ m = Message.new(key_name: key, data: data.to_json)
20
+ m.create
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ module MessagingClient
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ require 'logical_model'
2
+ if defined?(Rails)
3
+ require 'messaging/railties'
4
+ require 'messaging/client'
5
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: messaging_client
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Dwayne Macgowan
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-02-11 00:00:00 -03:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: railties
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 1
31
+ version: "3.1"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: logical_model
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 4
45
+ - 5
46
+ version: 0.4.5
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description: This is client library for padma-Messaging-ws
50
+ email:
51
+ - dwaynemac@gmail.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files: []
57
+
58
+ files:
59
+ - app/models/messaging/notify_me.rb
60
+ - app/models/messaging/message.rb
61
+ - lib/messaging_client.rb
62
+ - lib/messaging/client.rb
63
+ - lib/messaging/railties.rb
64
+ - config/initializers/messaging_client.rb
65
+ has_rdoc: true
66
+ homepage: ""
67
+ licenses: []
68
+
69
+ post_install_message:
70
+ rdoc_options: []
71
+
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirements: []
91
+
92
+ rubyforge_project:
93
+ rubygems_version: 1.3.7.1
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Client library for padma-messaging-ws
97
+ test_files: []
98
+