salt-api 0.1.0 → 0.1.1

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: 7b41c91f0c42335a1ed632f55ee81cbe2968f667
4
- data.tar.gz: 407badbb4bd5a02d3e524edf456a9f9cda85e08f
3
+ metadata.gz: 71dcf6899abe26e0fcdda86884a6fbfb120f364e
4
+ data.tar.gz: 9f1790f968992c64512ffc296d1cbf2e184cd68c
5
5
  SHA512:
6
- metadata.gz: 2d4a48667e48254b167def9451938600344088696881870f85ffd10fb532885ed6195bb948048525a6a966bb1b44d0ebcafb88b35c8a8702da0b3efab28fe206
7
- data.tar.gz: de0e96076d6fbb82416209b42400c54146d1cef86fabe5d1cf2e547fcd3a031820ba87ff56972a9b2c8f0c9b4ceac8f93cbae2df135683f3a6dddc7cfd6efc5a
6
+ metadata.gz: efdf214d6296aa6579d013f6d155b37463e78dec8f29755d98ac0d0052969fd48293a83a38f4a2ee5669eaea666b9cdec38ef9330b958c68a565c4b291d94a9f
7
+ data.tar.gz: 91f838cac0b226284bf18ed363f6cf00c71d6b26bec824fab367481d6ac7add29c5dec99472fd23ec552efd3d26d569c573da99b41cbda5df9dc10b73080cd47
@@ -5,19 +5,19 @@ module Salt
5
5
  module Api
6
6
  module Client
7
7
  def client
8
- Net::HTTP.new(hostname, 8000).tap do |client|
9
- client.use_ssl = true
8
+ Net::HTTP.new(hostname, port).tap do |client|
9
+ client.use_ssl = use_ssl
10
10
  client.open_timeout = timeout
11
11
  # TODO: Allow specifying CA and such
12
12
  client.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
13
  end
14
14
  end
15
15
 
16
- def login(user, password)
16
+ def login
17
17
  req = Net::HTTP::Post.new("/login")
18
18
  req.set_form_data({
19
19
  'eauth' => 'pam',
20
- 'username' => user,
20
+ 'username' => username,
21
21
  'password' => password
22
22
  })
23
23
  req['Accept'] = "application/x-yaml"
@@ -29,7 +29,7 @@ module Salt
29
29
  end
30
30
 
31
31
  def token
32
- @token ||= login(username, password)["token"]
32
+ @token ||= login["token"]
33
33
  end
34
34
  end
35
35
  end
@@ -5,12 +5,21 @@ module Salt
5
5
  :hostname,
6
6
  :username,
7
7
  :password,
8
- :timeout
8
+ :timeout,
9
+ :port,
10
+ :use_ssl
9
11
  ].freeze
10
12
 
11
13
  attr_accessor *VALID_OPTION_KEYS
12
14
 
15
+ def set_defaults
16
+ @hostname = "salt"
17
+ @port = 8000
18
+ @use_ssl = true
19
+ end
20
+
13
21
  def configure
22
+ set_defaults
14
23
  yield self
15
24
  end
16
25
  end
@@ -1,5 +1,5 @@
1
1
  module Salt
2
2
  module Api
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salt-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua B. Bussdieker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler