aptly-api 0.5.0 → 0.6.0

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: f4366fc69e420aae0067501a98a0cc13de7e78b9
4
- data.tar.gz: 34924e0d41b9f8c7779e7bd00aa63ae670acde88
3
+ metadata.gz: d3870aafea88cba83edd67d8157b2ad16bd4a3cd
4
+ data.tar.gz: 056eb4dc7da48eea7291c28a97599ad6b03c7094
5
5
  SHA512:
6
- metadata.gz: cd772f0145fef0826037da2b127d4c661aa939bde965355ae17626fccda320cd34e590819f0c7646d88ab2c6a002e97fbd3792b74159520b6b71bb6492ef8067
7
- data.tar.gz: 262cb466331fdd8c08992174c8827604d2b0d26265de412927128e17059b11a5307120ab9676251e2af5c13e557432c364877dc57ac884a00cb05f9ac1c32aa5
6
+ metadata.gz: 59c37196c8fab2ed18055eba1243a90caca9e3daa46c87ebcae99c5c2876a1e3d532761fe85b31ff71d07fcb4e32244216526da2200fd989828b826df30f9d38
7
+ data.tar.gz: 6723cb060bfb7483de86c39a2c8222281a88c4162516b6ccabaa3cf4962b04f6092294816d6c8213c30dd1d1b42bf6ccb1964be35f0a6b05d186049b6b463ae9
data/aptly-api.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'yard', '~> 0.8'
30
30
 
31
31
  spec.add_dependency 'faraday', '~> 0.9'
32
+ spec.add_dependency 'excon', '~> 0.54'
32
33
  end
@@ -6,6 +6,8 @@ module Aptly
6
6
  extend Gem::Deprecate
7
7
 
8
8
  # @!attribute uri
9
+ # Generally any suitable URI is allowed. This can also be a Unix domain
10
+ # socket which needs to be used in the notation unix:/tmp/sock.
9
11
  # @return [URI] the base URI for the API (http://localhost by default)
10
12
  attr_accessor :uri
11
13
 
@@ -18,6 +20,7 @@ module Aptly
18
20
  port: 80,
19
21
  path: '/'),
20
22
  host: nil, port: nil, path: nil)
23
+ @uri = nil
21
24
  @uri = uri unless host || port || path
22
25
  return if @uri
23
26
  @uri = fallback_uri(host, port, path)
@@ -24,12 +24,13 @@ module Aptly
24
24
 
25
25
  def initialize(**kwords)
26
26
  @query = kwords.fetch(:query, DEFAULT_QUERY)
27
+ @base_uri = kwords.delete(:uri) { ::Aptly.configuration.uri.clone }
27
28
 
28
- uri = ::Aptly.configuration.uri
29
- @connection = Faraday.new(uri.to_s) do |c|
29
+ raise if uri.nil?
30
+ @connection = Faraday.new(uri) do |c|
30
31
  c.request :multipart
31
32
  c.request :url_encoded
32
- c.adapter :net_http
33
+ c.adapter :excon, @adapter_options
33
34
  end
34
35
  end
35
36
 
@@ -45,6 +46,20 @@ module Aptly
45
46
 
46
47
  private
47
48
 
49
+ def uri
50
+ @adapter_options ||= {}
51
+ @uri ||= begin
52
+ uri = @base_uri.clone
53
+ return uri unless uri.scheme == 'unix'
54
+ # For Unix domain sockets we need to divide the bits apart as Excon
55
+ # expects the path URI without a socket path and the socket path as
56
+ # option.
57
+ @adapter_options[:socket] = uri.path
58
+ uri.host = nil
59
+ uri
60
+ end
61
+ end
62
+
48
63
  def build_query(kwords)
49
64
  query = @query.merge(kwords.delete(:query) { {} })
50
65
  if kwords.delete(:query_mangle) { true }
data/lib/aptly/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Aptly API
2
2
  module Aptly
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.6.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptly-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harald Sitter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-11-16 00:00:00.000000000 Z
12
+ date: 2017-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0.9'
140
+ - !ruby/object:Gem::Dependency
141
+ name: excon
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '0.54'
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '0.54'
140
154
  description: REST client for the Aptly API
141
155
  email:
142
156
  - sitter@kde.org
@@ -187,9 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
201
  version: '0'
188
202
  requirements: []
189
203
  rubyforge_project:
190
- rubygems_version: 2.5.1
204
+ rubygems_version: 2.6.10
191
205
  signing_key:
192
206
  specification_version: 4
193
207
  summary: REST client for the Aptly API
194
208
  test_files: []
195
- has_rdoc: