fastly 1.2.0 → 1.2.1

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.
@@ -5,6 +5,7 @@ require 'net/http' # also requires uri
5
5
  class Fastly
6
6
  # The UserAgent to communicate with the API
7
7
  class Client #:nodoc: all
8
+ ROOT_CA = File.join("../../cacert.pem", __FILE__)
8
9
  attr_accessor :http, :api_key, :user, :password, :cookie, :customer
9
10
 
10
11
  def initialize(opts)
@@ -13,9 +14,16 @@ class Fastly
13
14
  @password = opts.fetch(:password, nil)
14
15
  @customer = opts.fetch(:customer, nil)
15
16
 
17
+ certificate_store = opts.fetch(:certificate_store, ROOT_CA)
18
+
16
19
  base = opts.fetch(:base_url, 'https://api.fastly.com')
17
20
  uri = URI.parse(base)
18
- @http = Net::HTTP.start(uri.host, uri.port, use_ssl: true)
21
+ ssl = uri.is_a? URI::HTTPS # detect if we should pass `use_ssl`
22
+ @http = Net::HTTP.start(uri.host, uri.port, use_ssl: ssl)
23
+
24
+ http.ca_path = certificate_store
25
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
26
+ http.verify_depth = 5
19
27
 
20
28
  return self unless fully_authed?
21
29
 
@@ -1,4 +1,4 @@
1
1
  # The current version of the library
2
2
  class Fastly
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
@@ -60,11 +60,15 @@ class Fastly
60
60
  end
61
61
 
62
62
  # Purge all assets from this service.
63
+ #
64
+ # See README.md for examples of purging
63
65
  def purge_all
64
66
  fetcher.client.post("#{Service.get_path(id)}/purge_all")
65
67
  end
66
68
 
67
69
  # Purge anything with the specific key from the given service.
70
+ #
71
+ # See README.md for examples of purging
68
72
  def purge_by_key(key)
69
73
  require_api_key!
70
74
  fetcher.client.post("#{Service.get_path(id)}/purge/#{key}")
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: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fastly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-06 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Client library for the Fastly acceleration system
14
14
  email:
@@ -21,9 +21,9 @@ executables:
21
21
  extensions: []
22
22
  extra_rdoc_files: []
23
23
  files:
24
- - .gitignore
25
- - .rubocop.yml
26
- - .travis.yml
24
+ - ".gitignore"
25
+ - ".rubocop.yml"
26
+ - ".travis.yml"
27
27
  - Gemfile
28
28
  - HISTORY.md
29
29
  - LICENSE
@@ -31,6 +31,7 @@ files:
31
31
  - Rakefile
32
32
  - bin/fastly_create_domain
33
33
  - bin/fastly_upload_vcl
34
+ - cacert.pem
34
35
  - fastly.gemspec
35
36
  - lib/fastly.rb
36
37
  - lib/fastly/backend.rb
@@ -80,17 +81,17 @@ require_paths:
80
81
  - lib
81
82
  required_ruby_version: !ruby/object:Gem::Requirement
82
83
  requirements:
83
- - - '>='
84
+ - - ">="
84
85
  - !ruby/object:Gem::Version
85
86
  version: '0'
86
87
  required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  requirements:
88
- - - '>='
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  requirements: []
92
93
  rubyforge_project:
93
- rubygems_version: 2.4.4
94
+ rubygems_version: 2.5.1
94
95
  signing_key:
95
96
  specification_version: 4
96
97
  summary: Client library for the Fastly acceleration system