parliament-utils 0.2.2 → 0.2.3

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: 3a20daf87301bc5afe1af8c05732339621bc2c45
4
- data.tar.gz: 7206dd59685b4c34724a90efbfe263b118178e08
3
+ metadata.gz: d050ead54413d5e5add3db477f62722452ff0cfb
4
+ data.tar.gz: 1426f74fdbe7abb1cc2d940281f80afd7b03622d
5
5
  SHA512:
6
- metadata.gz: 2137ac13c8f4ceab2bcbbb4bfe4ee381608b1812f79c433404620c5854d7860a0d36ffbdc9c30cba5ff92de3046c72fcd7507e71c72014dbf6dbe68ce794c8fd
7
- data.tar.gz: 165cc4e2883e682812c7d5be7bdc5017e9730052cab8e271fa22bb71e951e46edcd87de33051896b251017b8eceda4a8f73d31d69b633447e2f5f10dfd92b4b1
6
+ metadata.gz: 3277280384cf8071914ab3db7150d589bfe48f1721c0aadab9cf4a6a395c17df686cfab733b8fee5a050e714fad0d320b354b8f7a7607b122f86691f001b1e6f
7
+ data.tar.gz: e65d6abe42df7bcb7c6c325c2e19c6389edf25adc80bf65370c1eb7ceec34f8877926c1e5b3fc4a2e747b3a419044b7fa0cf8b4d2877141500a773003b0a0c07
@@ -23,7 +23,13 @@ module Parliament
23
23
  raise StandardError, 'Data URL does not exist' if @data_url.nil?
24
24
 
25
25
  response.headers['Accept'] = request.formats.first
26
- redirect_to(@data_url.call(params).query_url) && return
26
+ # Store format_type if format in url is json or xml
27
+ request.path_parameters[:format] == 'json' || request.path_parameters[:format] == 'xml' ? format_type = request.path_parameters[:format] : format_type = nil
28
+ # Set redirect_url as URI object
29
+ redirect_url = URI(@data_url.call(params).query_url)
30
+ # add format_type to path if format in url is json or xml
31
+ redirect_url.path = redirect_url.path + '.' + format_type if format_type
32
+ redirect_to(redirect_url.to_s) && return
27
33
  end
28
34
 
29
35
  # Get the data URL for our current controller and action OR raise a StandardError
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module Utils
3
- VERSION = '0.2.2'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-24 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parliament-ruby