fastly 2.5.2 → 2.5.3

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: b75dc13044604bb40449d7fb5211800bc012b44b43ac51ea1fd443a3bd882e86
4
- data.tar.gz: 540582acde735caf0786d3060b2f907bf772bac1a359165c41f8cf53244fd5f1
3
+ metadata.gz: ff6374dedf0a4320acb1bb370b700f31dffbb841ad039e717c9b6bd713a6cb5a
4
+ data.tar.gz: f53667b8fa95b6e9cf013ec23c94feee19b860c28de60aba3fee4ddd17ffaa4c
5
5
  SHA512:
6
- metadata.gz: 0a6ec0d7a43e57a7e87c9489bc0d53801c03d56115dbe849b9a8a7d1a591dac3597a2d01bb511f8d6d21f1c5b2897b60addbcd91ffec99a74b736d914ca66b0c
7
- data.tar.gz: 5298847912ac68c9b7a2a92323c7e8a35f0b84c4e823fec14a12f99b3bae1ae4548efb59d137887a59ef1cb60adb249aa094a56a0bc9190306ff3862e62411b2
6
+ metadata.gz: f3115a7e69149466f180e3d823c13ef9d4a895178a6e33e02522afa1b5551df59da7655dd3c316eba9cb0be0df2494b2b2f4a6803a2ec6b04cb8f4f1b06be11f
7
+ data.tar.gz: c7a1a39686da60e1986b24d7ef7d94cdba247e29117a99bed51924e23716da3dc72cc44869e1b711f75745309ff71597c165d2048fb5b43ed38fa6d0d2fc4e88
@@ -0,0 +1,3 @@
1
+ FASTLY_TEST_USER=
2
+ FASTLY_TEST_PASSWORD=
3
+ FASTLY_TEST_API_KEY=
data/Gemfile CHANGED
@@ -11,3 +11,7 @@ group :development, :test do
11
11
  gem 'rubocop', '~> 0.57.2', require: false
12
12
  gem 'webmock'
13
13
  end
14
+
15
+ group :test do
16
+ gem 'dotenv'
17
+ end
data/README.md CHANGED
@@ -202,15 +202,19 @@ This option should not be used in a production setting as all HTTP headers, requ
202
202
 
203
203
  ### Notes for testing
204
204
 
205
- The test suite requires the following `ENV` variables to be set:
205
+ The test suite tests create and delete three services in sequence, so you may want to create an account just for these tests.
206
206
 
207
- * `FASTLY_TEST_USER` - Your user email
208
- * `FASTLY_TEST_PASSWORD` - Your account password
209
- * `FASTLY_TEST_API_KEY` - Your API key (found at https://app.fastly.com/#account)
207
+ To run the test suite:
210
208
 
211
- While the test suite is safe to be run on all accounts and isn't harmful to your
212
- data, the tests will create and delete 3 services in sequence so you may want
213
- to create an account just for tests.
209
+ 1. Generate a personal token for these tests: https://manage.fastly.com/account/personal/tokens
210
+
211
+ 2. Copy `.env.example` to `.env` and add the values for the variables:
212
+
213
+ * `FASTLY_TEST_USER` - Your user email
214
+ * `FASTLY_TEST_PASSWORD` - Your account password
215
+ * `FASTLY_TEST_API_KEY` - Your personal token
216
+
217
+ 3. Run the tests via `bundle exec rake test:unit`
214
218
 
215
219
  ## Copyright
216
220
 
@@ -16,9 +16,9 @@ class Fastly
16
16
  end
17
17
 
18
18
  # Get the number of the Version this belongs to
19
- def version_number # rubocop:disable all
20
- @version
21
- end # rubocop:enable all
19
+ def version_number
20
+ @version ||= nil
21
+ end
22
22
 
23
23
  # :nodoc:
24
24
  def as_hash
@@ -27,6 +27,10 @@ class Fastly
27
27
 
28
28
  return self unless fully_authed?
29
29
 
30
+ warn("DEPRECATION WARNING: Username/password authentication is deprecated
31
+ and will not be available starting September 2020;
32
+ please migrate to API tokens as soon as possible.")
33
+
30
34
  # If full auth creds (user/pass) then log in and set a cookie
31
35
  resp = http.post(
32
36
  '/login',
@@ -1,4 +1,4 @@
1
1
  # The current version of the library
2
2
  class Fastly
3
- VERSION = "2.5.2"
3
+ VERSION = "2.5.3"
4
4
  end
@@ -2,7 +2,8 @@
2
2
  class Fastly
3
3
  # Represents something you want to serve - this can be, for example, a whole web site, a Wordpress site, or just your image servers
4
4
  class Service < Base
5
- attr_accessor :id, :customer_id, :name, :comment, :versions
5
+ attr_accessor :id, :customer_id, :name, :comment
6
+ attr_writer :versions
6
7
 
7
8
  @versions = []
8
9
 
@@ -12,7 +12,7 @@ describe Fastly::Client do
12
12
  }
13
13
  end
14
14
 
15
- it 'does not log in if user/pass are not provided' do
15
+ it 'does not set the user/pass if they are not provided' do
16
16
  client = Fastly::Client.new(api_key: api_key)
17
17
 
18
18
  assert_equal api_key, client.api_key
@@ -29,6 +29,13 @@ describe Fastly::Client do
29
29
  assert_equal "Invalid auth credentials. Check username/password.", e.message
30
30
  end
31
31
 
32
+ it 'surfaces a deprecation message when a username or password is provided' do
33
+ stub_request(:any, /api.fastly.com/).
34
+ to_return(body: JSON.generate(i: "dont care"), status: 200)
35
+
36
+ assert_output('', /DEPRECATION WARNING:/) { Fastly::Client.new(user: user, password: pass) }
37
+ end
38
+
32
39
  it 'initializes an http client' do
33
40
  client = Fastly::Client.new(api_key: api_key)
34
41
 
@@ -2,6 +2,7 @@ require 'common'
2
2
  require 'fastly'
3
3
  require 'minitest/autorun'
4
4
  require 'pry'
5
+ require 'dotenv/load'
5
6
 
6
7
  class Fastly
7
8
  class TestCase < Minitest::Test; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fastly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Client library for the Fastly acceleration system
14
14
  email:
@@ -21,6 +21,7 @@ executables:
21
21
  extensions: []
22
22
  extra_rdoc_files: []
23
23
  files:
24
+ - ".env.example"
24
25
  - ".gitignore"
25
26
  - ".rubocop.yml"
26
27
  - ".travis.yml"
@@ -109,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  - !ruby/object:Gem::Version
110
111
  version: '0'
111
112
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.7.6.2
113
+ rubygems_version: 3.0.6
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Client library for the Fastly acceleration system