config_server_agent 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
  SHA256:
3
- metadata.gz: cba5de75917c2c406b472c604ce084f0c051625c5e24b547b57fe594ca03c2f1
4
- data.tar.gz: 72c253ecbf9ef983bcfec697c57847eb7945d997a3a9ca151fd50672278d51ba
3
+ metadata.gz: bc879021defba75dd0f80bdf720a6aed93bfc7087c1dde865b298acbe5ffc0c0
4
+ data.tar.gz: 21e44879624e3bb30cc30d1c8f7fac444893c50d353f3a51c1ad32e93d4190d0
5
5
  SHA512:
6
- metadata.gz: 5b928f1c843ea560eea1568c672008e5efe9e2fa6b0d0168603664b4d884acc8dd36b1fab9ed5e5ab57627618ba95da64a5076b4f03789782a4efa7359ef4e2b
7
- data.tar.gz: 0defd64e147843af7ad7d79ff38326c06d5d83d3f4d9e81f0cf439e88dc152379ea0f34d31865aa87f8edb435f509a5e3a920316236b0eb02cd9b389f02bbe60
6
+ metadata.gz: a7582e8caa5d37f8f437bd931eb39748bc5f0841f2132e69f1840b1fc4d541ac27e467e5be19e6ba4db71c44ae7fb0118e415420004ce022e80a944dae6cc751
7
+ data.tar.gz: 6f2e0ea7c91554480778d2cf59c6c776b17e53530f89f82d333353452b739786e841adf54aa5763f098e03f86cf652028e149e710e4411c1eaf1b8f03965562d
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.1.1 - 2019-02-06
8
+ ### Added
9
+ - Changed the default User-Agent string from 'Ruby' to 'ConfigServerAgent/0.1.x'
10
+ - Added user_agent & user_agent_comment parameters to the constructor, which allows
11
+ a user to fully or partially configure the User-Agent string.
12
+
7
13
  ## 0.1.0 - 2018-12-06
8
14
  ### Added
9
15
  - Initial commit
data/README.md CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- `ConfigServerAgent` requires six parameters to operate correctly. These parameters can either be explicitly provided to theq constructor, or they will be pulled from environment variables. An `ArgumentError` will be raised if the parameters are not available for either source. Parameters supplied to the constructor will take precedence over environment variables.
29
+ `ConfigServerAgent` requires six parameters to operate correctly. These parameters can either be explicitly provided to the constructor, or they will be pulled from environment variables. An `ArgumentError` will be raised if the parameters are not available from either source. Parameters supplied to the constructor will take precedence over environment variables.
30
30
 
31
31
  ```ruby
32
32
  # Providing explicitly:
@@ -76,7 +76,7 @@ After checking out the repo, run `bundle install` to install dependencies. Then,
76
76
 
77
77
  ## Contributing
78
78
 
79
- To experiment with that code, run `rake console` for an interactive prompt.
79
+ To experiment with the code, run `rake console` for an interactive prompt.
80
80
 
81
81
  ## License
82
82
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  Use this client to retrieve your configuration from a Config Server.
15
15
  The required parameters can either be supplied to the constructor, or
16
16
  they will be pulled from environment variables. An ArgumentError will
17
- be raised if the parameters are not available for either source.
17
+ be raised if the parameters are not available from either source.
18
18
  Parameters supplied to the constructor will take precedence over environment
19
19
  variables.
20
20
  EOM
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.metadata["homepage_uri"] = spec.homepage
30
30
  spec.metadata["source_code_uri"] = "https://bitbucket.org/supporterhub/config_server_agent"
31
- spec.metadata["changelog_uri"] = "https://bitbucket.org/supporterhub/config_server_agent/srv/master/CHANGELOG.md"
31
+ spec.metadata["changelog_uri"] = "https://bitbucket.org/supporterhub/config_server_agent/src/master/CHANGELOG.md"
32
32
  else
33
33
  raise "RubyGems 2.0 or newer is required to protect against " \
34
34
  "public gem pushes."
@@ -1,3 +1,3 @@
1
1
  class ConfigServerAgent
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -13,7 +13,9 @@ class ConfigServerAgent
13
13
  auth0_host: ENV['AUTH0_HOST'],
14
14
  config_server_audience: ENV['CONFIG_SERVER_AUDIENCE'],
15
15
  config_server_api_key: ENV['CONFIG_SERVER_API_KEY'],
16
- config_server_host: ENV['CONFIG_SERVER_HOST']
16
+ config_server_host: ENV['CONFIG_SERVER_HOST'],
17
+ user_agent: "ConfigServerAgent/#{ConfigServerAgent::VERSION}",
18
+ user_agent_comment: nil
17
19
  )
18
20
  @auth0_client_id = auth0_client_id or raise ArgumentError, "Missing auth0_client_id parameter"
19
21
  @auth0_client_secret = auth0_client_secret or raise ArgumentError, "Missing auth0_client_secret parameter"
@@ -23,6 +25,8 @@ class ConfigServerAgent
23
25
  @config_server_host = config_server_host or raise ArgumentError, "Missing config_server_host parameter"
24
26
  @config = nil
25
27
  @mutex = Mutex.new
28
+ @user_agent = user_agent
29
+ @user_agent += " (#{user_agent_comment})" if user_agent_comment
26
30
  end
27
31
 
28
32
  def get_config
@@ -47,6 +51,7 @@ class ConfigServerAgent
47
51
  http.use_ssl = url.scheme == 'https'
48
52
 
49
53
  request = Net::HTTP::Post.new url
54
+ request['user-agent'] = @user_agent
50
55
  request['content-type'] = 'application/json'
51
56
  request['authorization'] = "Bearer #{token}"
52
57
  request['accept'] = 'application/json'
@@ -62,6 +67,7 @@ class ConfigServerAgent
62
67
  http.use_ssl = url.scheme == 'https'
63
68
 
64
69
  request = Net::HTTP::Post.new url
70
+ request['user-agent'] = @user_agent
65
71
  request['content-type'] = 'application/json'
66
72
  request.body = {
67
73
  client_id: @auth0_client_id,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_server_agent
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
  - Aidan Samuel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-09 00:00:00.000000000 Z
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ dependencies:
83
83
  description: " Use this client to retrieve your configuration from a Config Server.
84
84
  The required parameters can either be supplied to the constructor, or they will
85
85
  be pulled from environment variables. An ArgumentError will be raised if the parameters
86
- are not available for either source. Parameters supplied to the constructor will
86
+ are not available from either source. Parameters supplied to the constructor will
87
87
  take precedence over environment variables. "
88
88
  email:
89
89
  - aidan.samuel@supporterhub.com
@@ -109,7 +109,7 @@ metadata:
109
109
  allowed_push_host: https://rubygems.org
110
110
  homepage_uri: https://bitbucket.org/supporterhub/
111
111
  source_code_uri: https://bitbucket.org/supporterhub/config_server_agent
112
- changelog_uri: https://bitbucket.org/supporterhub/config_server_agent/srv/master/CHANGELOG.md
112
+ changelog_uri: https://bitbucket.org/supporterhub/config_server_agent/src/master/CHANGELOG.md
113
113
  post_install_message:
114
114
  rdoc_options: []
115
115
  require_paths: