doppler 1.0.1 → 1.0.2

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: b02a59489c478d737e5969eab8cf3afecb217c49
4
- data.tar.gz: a2335a4f35579d0f3023d5bc3558568562ba2a3b
3
+ metadata.gz: 69b112d5d1d5dbf328711c0f22f1c02be2f4afb8
4
+ data.tar.gz: 89663dbd70d8c5afddebb2b98cfbbf3a19a64d34
5
5
  SHA512:
6
- metadata.gz: 3113831876da0c9fe14815642e4e87aa1e41ec5e0b2250b7765068df9d2b1cf0357b5170a7c11f20c7e27784fc4d95db8307c49bbcafa16880fce56c2259bc93
7
- data.tar.gz: 4bab5c34a684a22e225fa9bbcd0ccd4d3dbc2d7d7efa263f70204f5f46c62bc978a7f3d2f58db92bdfd066c39fcfaf8d57a71a35ce18803b1564c9d2803c042a
6
+ metadata.gz: c532bc666dacd189406cf42b2c1ca580956667ea745cf7829cb1bef32180c75fd84f98986e6054210a58957fab48c6206fdd8866867e8873d0afaed1aa081de5
7
+ data.tar.gz: 3ccf3ff1b647be6a1cc630764cdae2933fa1c6c101e17b2ab1cfd91505063adc4cac06d747c75b38025437f2f7257efc0e247e358bb84d42c687d1f7a50c342b
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Doppler Ruby Library
2
2
 
3
+ [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/DopplerHQ/ruby-client)
3
4
  [![image](https://img.shields.io/gem/v/doppler-client.svg)](https://rubygems.org/gems/doppler-client)
4
5
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/92ec3d37764c40da8dffb6a85c6cbfa4)](https://www.codacy.com/app/Doppler/ruby-client?utm_source=github.com&utm_medium=referral&utm_content=DopplerHQ/ruby-client&utm_campaign=Badge_Grade)
5
6
 
@@ -2,7 +2,7 @@ require 'doppler/client'
2
2
 
3
3
  module Doppler
4
4
  # configure doppler host url
5
- @@host_url = "https://api.doppler.com"
5
+ @@host_url = "https://deploy.doppler.com"
6
6
  def self.host_url=(host)
7
7
  @@host_url = host_url
8
8
  end
@@ -5,7 +5,6 @@ require 'doppler/version'
5
5
  module Doppler
6
6
  class Client
7
7
  MAX_RETRIES = 10
8
- ENVIRONMENT_SEGMENT = '/environments/'
9
8
 
10
9
  def initialize()
11
10
  if Doppler.api_key.nil?
@@ -25,8 +24,8 @@ module Doppler
25
24
  end
26
25
 
27
26
  def startup
28
- resp = self._request('/fetch_keys', {})
29
- @remote_keys = resp.fetch("keys")
27
+ resp = self._request('/v1/variables')
28
+ @remote_keys = resp.fetch("variables")
30
29
 
31
30
  overwrite_env()
32
31
  write_to_backup()
@@ -59,24 +58,26 @@ module Doppler
59
58
  end
60
59
 
61
60
 
62
- def _request(endpoint, body, retry_count=0)
61
+ def _request(endpoint, retry_count=0)
63
62
  raise ArgumentError, 'endpoint not string' unless endpoint.is_a? String
64
63
 
65
- raw_url = Doppler.host_url + ENVIRONMENT_SEGMENT + Doppler.environment + endpoint
66
- uri = URI.parse(raw_url)
64
+ uri = URI.parse(Doppler.host_url + endpoint)
65
+ uri.query = URI.encode_www_form({
66
+ 'pipeline': Doppler.pipeline,
67
+ 'environment': Doppler.environment
68
+ })
67
69
  header = {
68
70
  'Content-Type': 'application/json',
69
71
  'api-key': Doppler.api_key,
70
- 'pipeline': Doppler.pipeline,
71
72
  'client-sdk': 'ruby',
72
73
  'client-version': Doppler::VERSION
73
-
74
74
  }
75
- http = ::Net::HTTP.new(uri.host, uri.port)
76
- http.use_ssl = true
77
75
 
78
76
  begin
79
- response = http.post(uri.path, body.to_json, header)
77
+ request = Net::HTTP::Get.new(uri, header)
78
+ response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|
79
+ http.request(request)
80
+ }
80
81
  response_data = JSON.parse(response.body)
81
82
  if response_data['success'] == false
82
83
  raise RuntimeError, response_data["messages"].join(". ")
@@ -102,11 +103,11 @@ module Doppler
102
103
  end
103
104
 
104
105
  data = {}
105
- data["keys"] = keys
106
+ data["variables"] = keys
106
107
  return data
107
108
 
108
109
  else
109
- return _request(endpoint, body, retry_count)
110
+ return _request(endpoint, retry_count)
110
111
  end
111
112
  end
112
113
 
@@ -1,3 +1,3 @@
1
1
  module Doppler
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doppler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doppler Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler