pco-url 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed356d2dbbab3e8708ea65a815ca446bcd3e03f4
4
- data.tar.gz: 9cd7d6c4b34c7a5ae5bbfd8c09d223e6eb41cb81
3
+ metadata.gz: be3eb46f919cb623fbb6232e443ab60a6313c84a
4
+ data.tar.gz: 9b18a5461d22051ea2922280b96413b2419a79c4
5
5
  SHA512:
6
- metadata.gz: ebdba2d53cc88b853682bde6c207878c6a5101050031327b6b43ddddf1f2e37f422118c5abc4abd34333b7ed220e9e6ad55c2252eb97e162d8049bf548299e01
7
- data.tar.gz: aaaa5009648ba29dee52ab3d6065069d9494d48ac9b7b8e241a922f399170d91142947828eaae423d7e1c0010b5edb9e6a031ce678965851380a8e9f32f975dc
6
+ metadata.gz: 25db8d4fe497d0cabf40702822877b6528fdf9c9da48a49e004541077bdae1154fe2a2732caa98276ffcfe3855df63a54352e1b1e56dd0c4287405cb97a709e2
7
+ data.tar.gz: 073305bdf03bccc3d17ce0d6ed8ab83ff685a34ec3714fed009ee3f321de61db96742f3649f0b4dc2cefc7eebe0b66c07d0bf739788fe04469de263999142720
data/lib/pco/url.rb CHANGED
@@ -48,8 +48,10 @@ module PCO
48
48
  attr_reader :query
49
49
 
50
50
  def initialize(app_name:, path: nil, query: nil, encrypt_query_params: false)
51
- @app_name = app_name.to_s.gsub("_", "-")
52
- @path = path
51
+ @app_name = app_name.to_s.gsub("_", "-")
52
+ @path = path
53
+
54
+ @path = @path[1..-1] if @path && @path[0] == "/"
53
55
 
54
56
  if query
55
57
  @query = encrypt_query_params ? "_e=#{URLcrypt.encrypt(query)}" : query
@@ -1,5 +1,5 @@
1
1
  module PCO
2
2
  class URL
3
- VERSION = "1.4.0"
3
+ VERSION = "1.5.0"
4
4
  end
5
5
  end
data/spec/pco_url_spec.rb CHANGED
@@ -177,7 +177,7 @@ describe PCO::URL do
177
177
 
178
178
  it 'sets the app_name and path attrs' do
179
179
  expect(subject.app_name).to eq('people')
180
- expect(subject.path).to eq('/households/2.json')
180
+ expect(subject.path).to eq('households/2.json')
181
181
  end
182
182
  end
183
183
 
@@ -188,7 +188,7 @@ describe PCO::URL do
188
188
 
189
189
  it 'sets the app_name, path, and query attrs' do
190
190
  expect(subject.app_name).to eq('people')
191
- expect(subject.path).to eq('/households/2.html')
191
+ expect(subject.path).to eq('households/2.html')
192
192
  expect(subject.query).to eq('full_access=1&total_control=1')
193
193
  end
194
194
 
@@ -207,6 +207,10 @@ describe PCO::URL do
207
207
  it "decrypts the encrypted portion and appends the unencrypted portion" do
208
208
  expect(subject.query).to eq('full_access=1&total_control=1&foo=bar')
209
209
  end
210
+
211
+ it "returns the full url" do
212
+ expect(subject.to_s).to eq('https://people-staging.planningcenteronline.com/households/2.html?full_access=1&total_control=1&foo=bar')
213
+ end
210
214
  end
211
215
  end
212
216
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pco-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: urlcrypt