foreign_office 0.1.1 → 0.1.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf32739fee81b0bc8be61f18f585e721dd01736
|
4
|
+
data.tar.gz: e42d37d55f26e121d7a83c100da65c9cc26214fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc81bc349c49729151305bdd30342b4579e13576fd71eaad7a8ab65a32f81b49332f2ab3f513649a5443c5ebb0503a88918b83dfe69c6098a6b1e9413b0cf41a
|
7
|
+
data.tar.gz: b4a5b2ca24a7edb259078888ca1b29391a2da2be4fde9d6b49a359e925c612c9cb3d2f75637779bc5fe2d888e5080dc7a0dcad2861dda93b22a010da38f29d16
|
@@ -9,10 +9,12 @@ var ForeignOffice = Class.extend({
|
|
9
9
|
this.channels_by_name = [];
|
10
10
|
},
|
11
11
|
config: function(config){
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
bus_class = eval(config.bus_name);
|
13
|
+
third_party_library = this.library_name_for(config.bus_name)
|
14
|
+
try {
|
15
|
+
bus_class = eval(third_party_library)
|
16
|
+
}
|
17
|
+
catch(err){
|
16
18
|
bus_class = TestBus
|
17
19
|
}
|
18
20
|
this.bus = new bus_class(config);
|
@@ -33,9 +35,9 @@ var ForeignOffice = Class.extend({
|
|
33
35
|
channelNames: function(){
|
34
36
|
return $.map(this.channels,function(channel){return channel.channel_name});
|
35
37
|
},
|
36
|
-
|
37
|
-
var
|
38
|
-
|
38
|
+
library_name_for: function(bus_name){
|
39
|
+
var library_map = {PubnubBus: 'PUBNUB', PusherBus: 'Pusher'}
|
40
|
+
return library_map[bus_name]
|
39
41
|
}
|
40
42
|
});
|
41
43
|
|
@@ -44,6 +46,8 @@ foreign_office = new ForeignOffice();
|
|
44
46
|
var ForeignOfficeChannel = Class.extend({
|
45
47
|
init: function(channel_name){
|
46
48
|
var foreign_office_channel = this;
|
49
|
+
debug_logger.log("Subscribing to: ");
|
50
|
+
debug_logger.log(channel_name);
|
47
51
|
foreign_office.bus.subscribe({
|
48
52
|
channel : channel_name,
|
49
53
|
callback : function(m){
|
@@ -1,5 +1,6 @@
|
|
1
1
|
var PubnubBus = Class.extend({
|
2
2
|
init: function(config){
|
3
|
+
debug_logger.log("initializing pubnub js")
|
3
4
|
this.pubnub = PUBNUB.init({
|
4
5
|
publish_key : config.publish_key,
|
5
6
|
subscribe_key : config.subscribe_key,
|
@@ -7,9 +8,10 @@ var PubnubBus = Class.extend({
|
|
7
8
|
});
|
8
9
|
},
|
9
10
|
subscribe: function(subscription){
|
11
|
+
debug_logger.log("subscribing with PubnubBus")
|
12
|
+
debug_logger.log(subscription)
|
10
13
|
this.pubnub.subscribe({
|
11
14
|
channel : subscription.channel,
|
12
|
-
backfill: true,
|
13
15
|
message : function(m){subscription.callback(m)}
|
14
16
|
});
|
15
17
|
|
@@ -44,17 +44,16 @@ class ForeignOffice::Busses::PubnubBus < ForeignOffice::Busses::GenericBus
|
|
44
44
|
self.connection.publish(
|
45
45
|
channel: message[:channel],
|
46
46
|
message: message,
|
47
|
-
http_sync: true
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
)
|
47
|
+
http_sync: true
|
48
|
+
) do |envelope|
|
49
|
+
if '200' != envelope.status_code.to_s
|
50
|
+
Rails.logger.error "ForeignOffice error esponse:"
|
51
|
+
Rails.logger.error envelope.message
|
52
|
+
Rails.logger.error envelope.channel
|
53
|
+
Rails.logger.error envelope.status_code
|
54
|
+
Rails.logger.error envelope.timetoken
|
55
|
+
end
|
56
|
+
end
|
58
57
|
end
|
59
58
|
|
60
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreign_office
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Draut
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|