locomotivecms_wagon 1.5.4 → 1.5.5

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: 80736e3b3140592d940de1d47d1fb160828e092d
4
- data.tar.gz: 26830e5eee2ea0d15313736446ed500d8bf68f77
3
+ metadata.gz: d29d1ebdfcc402538d09a6a719a998f4006ff29e
4
+ data.tar.gz: e7a85f25d6d7a193c0cb385becd4b28e47a84352
5
5
  SHA512:
6
- metadata.gz: 5f70206ceba29668a34974a65e7f126fc45293b388d3540cea5ef6a3fb93b27f12d1e2d373bbecb8e5a35a20a019bfdfc695b7c298a22f1aa3ce25d2762f6a10
7
- data.tar.gz: 4491ea679b74f560d3875f9d32aa02dcc7eb18a5494868c1e09380a3c43cc027ed4256923b12b3615a7953fb0a2a69d5b4f2734dedc3a937f259281f5c3db9c1
6
+ metadata.gz: dd72ab98df4fda5497cabcb1ea6161db0489c8cb0fc11745628642551e4b235040e23bb953fb9bb80847da453c60422094e7566133a7a2edbb6ebeb9467683ac
7
+ data.tar.gz: 2dfadf5cc1297a0842962cebb34ce6d3391f5a9b1fb5dda04302ac99bd36f353c979d5b12872b0c90d81c166f40cd540fd9be6e382ce274c186a2749160b3de2
@@ -12,7 +12,10 @@ module Locomotive
12
12
  end
13
13
 
14
14
  def id
15
- (@_source.respond_to?(:id) ? @_source.id : nil) || 'new'
15
+ (@_source.respond_to?(:id) ? @_source.id : nil) ||
16
+ (@_source.respond_to?(:slug) ? @_source.slug : nil) ||
17
+ (@_source.respond_to?(:_slug) ? @_source._slug : nil) ||
18
+ 'new'
16
19
  end
17
20
 
18
21
  # converts an array of records to an array of liquid drops
@@ -43,4 +46,4 @@ module Locomotive
43
46
  end
44
47
  end
45
48
  end
46
- end
49
+ end
@@ -8,12 +8,21 @@ module Locomotive
8
8
  include ::HTTParty
9
9
 
10
10
  def self.consume(url, options = {})
11
+ method = options.delete(:method).try(:to_sym) || :get
12
+
11
13
  url = ::HTTParty.normalize_base_uri(url)
12
14
 
13
15
  uri = URI.parse(url)
14
- options[:base_uri] = "#{uri.scheme}://#{uri.host}"
15
- options[:base_uri] += ":#{uri.port}" if uri.port != 80
16
- path = uri.request_uri
16
+ path = uri.path.blank? ? '/' : uri.path
17
+
18
+ if uri.query
19
+ params = Rack::Utils.parse_nested_query(uri.query)
20
+ key = method == :post ? :body : :query
21
+ options[key] = params unless params.blank?
22
+ end
23
+
24
+ uri.query = nil; uri.path = ''
25
+ options[:base_uri] = uri.to_s
17
26
 
18
27
  options.delete(:format) if options[:format] == 'default'
19
28
  options[:format] = options[:format].gsub(/[\'\"]/, '').to_sym if options.has_key?(:format)
@@ -22,11 +31,9 @@ module Locomotive
22
31
  username, password = options.delete(:username), options.delete(:password)
23
32
  options[:basic_auth] = { username: username, password: password } if username
24
33
 
25
- path ||= '/'
26
-
27
- # Locomotive::Wagon::Logger.debug "[WebService] consuming #{path}, #{options.inspect}"
34
+ Locomotive::Wagon::Logger.debug "[WebService] consuming #{path}, #{options.inspect}"
28
35
 
29
- response = self.get(path, options)
36
+ response = self.send(method, path, options)
30
37
 
31
38
  if response.code == 200
32
39
  _response = response.parsed_response
@@ -45,4 +52,4 @@ module Locomotive
45
52
  end
46
53
  end
47
54
  end
48
- end
55
+ end
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
2
  module Wagon
3
- VERSION = '1.5.4'
3
+ VERSION = '1.5.5'
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
35
35
 
36
36
  gem.add_dependency 'httmultiparty', '0.3.10'
37
37
  gem.add_dependency 'will_paginate', '~> 3.0.3'
38
- gem.add_dependency 'locomotivecms_mounter', '~> 1.5.3'
38
+ gem.add_dependency 'locomotivecms_mounter', '~> 1.5.4'
39
39
 
40
40
  gem.add_dependency 'faker', '~> 0.9.5'
41
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_wagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-06 00:00:00.000000000 Z
12
+ date: 2015-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -227,14 +227,14 @@ dependencies:
227
227
  requirements:
228
228
  - - "~>"
229
229
  - !ruby/object:Gem::Version
230
- version: 1.5.3
230
+ version: 1.5.4
231
231
  type: :runtime
232
232
  prerelease: false
233
233
  version_requirements: !ruby/object:Gem::Requirement
234
234
  requirements:
235
235
  - - "~>"
236
236
  - !ruby/object:Gem::Version
237
- version: 1.5.3
237
+ version: 1.5.4
238
238
  - !ruby/object:Gem::Dependency
239
239
  name: faker
240
240
  requirement: !ruby/object:Gem::Requirement
@@ -869,7 +869,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
869
869
  version: '0'
870
870
  requirements: []
871
871
  rubyforge_project:
872
- rubygems_version: 2.4.5
872
+ rubygems_version: 2.2.0
873
873
  signing_key:
874
874
  specification_version: 4
875
875
  summary: The LocomotiveCMS wagon is a site generator for the LocomotiveCMS engine