live_resource-pubnub 0.0.1 → 0.0.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.
@@ -1,8 +1,2 @@
1
1
  require "live_resource/pubnub/version"
2
2
  require "live_resource/pubnub/pubnub_protocol"
3
-
4
- module LiveResource
5
- module Pubnub
6
- # Your code goes here...
7
- end
8
- end
@@ -31,6 +31,11 @@ module LiveResource
31
31
  resource_id
32
32
  end
33
33
 
34
+ def encode_identifier(identifier)
35
+ permitted_characters = URI::REGEXP::PATTERN::UNRESERVED
36
+ identifier.gsub(/[^#{permitted_characters}]/, '_')
37
+ end
38
+
34
39
  end
35
40
 
36
41
  end
@@ -1,5 +1,5 @@
1
1
  module LiveResource
2
2
  module Pubnub
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -78,4 +78,14 @@ describe PubnubProtocol do
78
78
  expect(subject).to eq resource_id
79
79
  end
80
80
  end
81
+
82
+ describe "#encode_identifier" do
83
+ subject { pubnub_protocol.encode_identifier(identifier) }
84
+
85
+ let(:identifier) { "/a-b?c#d e" }
86
+
87
+ it 'should replace any reserved URI characters with "_"' do
88
+ expect(subject).to eq '_a-b_c_d_e'
89
+ end
90
+ end
81
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: live_resource-pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-08 00:00:00.000000000 Z
12
+ date: 2013-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: live_resource
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: -2026245229616821162
114
+ hash: 4064468882096408339
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -2026245229616821162
123
+ hash: 4064468882096408339
124
124
  requirements: []
125
125
  rubyforge_project:
126
126
  rubygems_version: 1.8.25