akamai-edgegrid 1.0.5 → 1.0.6

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.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/akamai/edgegrid.rb +24 -25
  3. metadata +5 -11
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGNiODYyYzU3YWQ5OTQ5ODA3YTAyOWM5MDcwNDI0MTVkNDQ3MzI0NA==
5
+ data.tar.gz: !binary |-
6
+ NTk4NDdhYTUyYzNhNjk1ZTJmYTc5ZTFiNDAxNjMzOTNhMDk3MmFjNQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTgxZDhiMDgyZGZlMWFkY2ZmNDRiMzAzNDgzMjA2ODE1MzJmNmY5NWRlNGIz
10
+ NDE1MzIyMmY2OGM1YzM0Y2ZkMzIyN2FiMjFiZjY1ZWZmYWEzYzQ0Mjg2MzQy
11
+ YzQ3M2ZjZDNlNzY4YTk2ZTM0OWU2NmQ4MTdhMWYwYjgwYTUzMzU=
12
+ data.tar.gz: !binary |-
13
+ NjJkMDBiMjU3ZmEzOTRiNTQ0OTQ4YzA4NDJmMGI0NGQyZWJlZmQ1YzM2OWRl
14
+ ZTU0NGJlZjgzNTFlMmIwOGFhYThhOGVlMjNiZWNkMDNlMGQwYTgyYTA3ZWQ5
15
+ NDVhYTc0OWZlMDhmMzkzMTQyMTczNGUxMjI4MTMyYzgxZGFlYzU=
@@ -29,6 +29,16 @@ require 'uri'
29
29
  require 'net/http'
30
30
  require 'inifile'
31
31
 
32
+ def get_host(filename="~/.edgerc", section="default")
33
+ edgerc_path = File.expand_path(filename)
34
+ file = IniFile.load(edgerc_path)
35
+ data = file[section]
36
+ address = data["host"] || ""
37
+ address.gsub!('/','')
38
+ return address
39
+ end
40
+
41
+
32
42
  module Akamai #:nodoc:
33
43
  module Edgegrid #:nodoc:
34
44
 
@@ -60,6 +70,7 @@ module Akamai #:nodoc:
60
70
  #
61
71
  class HTTP < Net::HTTP
62
72
  attr_accessor :host, :section
73
+
63
74
  private
64
75
 
65
76
  def self.base64_hmac_sha256(data, key)
@@ -77,20 +88,8 @@ module Akamai #:nodoc:
77
88
  public
78
89
 
79
90
  # Creates a new Akamai::Edgegrid::HTTP object (takes same options as Net::HTTP)
80
- def initialize(address, port, filename='~/.edgerc', section='default')
81
- if filename
82
- edgerc_path = File.expand_path(filename)
83
-
84
- if File.exist?(edgerc_path)
85
- @section = section
86
- file = IniFile.load(edgerc_path)
87
- data = file[address]
88
- address = data["host"] || ""
89
- address.gsub!('/','')
90
- @host = address
91
- end
92
- end
93
-
91
+ def initialize(address, port)
92
+ @host = address
94
93
  super(address, port)
95
94
  if port == 80
96
95
  @use_ssl = false
@@ -196,17 +195,17 @@ module Akamai #:nodoc:
196
195
  end
197
196
 
198
197
  def setup_from_edgerc(opts)
199
- edgerc_path = opts[:filename] || File.expand_path('~/.edgerc')
200
-
201
- if File.exist?(edgerc_path) && @section
202
- file = IniFile.load(edgerc_path)
203
- data = file[@section]
204
- @client_token = data["client_token"]
205
- @client_secret = data["client_secret"]
206
- @access_token = data["access_token"]
207
- @max_body = data["max_body"] || 2048
208
- @headers_to_sign = opts[:headers_to_sign] || []
209
- end
198
+ edgerc_path = opts[:filename] || File.expand_path('~/.edgerc')
199
+ @section = opts[:section] || "default"
200
+ if File.exist?(edgerc_path)
201
+ file = IniFile.load(edgerc_path)
202
+ data = file[@section]
203
+ @client_token = data["client_token"]
204
+ @client_secret = data["client_secret"]
205
+ @access_token = data["access_token"]
206
+ @max_body = data["max_body"] || 2048
207
+ @headers_to_sign = opts[:headers_to_sign] || []
208
+ end
210
209
 
211
210
  if opts[:debug]
212
211
  @log = Logger.new(STDERR)
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akamai-edgegrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
5
- prerelease:
4
+ version: 1.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jonathan Landis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: simplecov
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: inifile
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -53,26 +48,25 @@ files:
53
48
  homepage: https://github.com/akamai-open/AkamaiOPEN-edgegrid-ruby
54
49
  licenses:
55
50
  - Apache
51
+ metadata: {}
56
52
  post_install_message:
57
53
  rdoc_options: []
58
54
  require_paths:
59
55
  - lib
60
56
  required_ruby_version: !ruby/object:Gem::Requirement
61
- none: false
62
57
  requirements:
63
58
  - - ! '>='
64
59
  - !ruby/object:Gem::Version
65
60
  version: '1.9'
66
61
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
62
  requirements:
69
63
  - - ! '>='
70
64
  - !ruby/object:Gem::Version
71
65
  version: '0'
72
66
  requirements: []
73
67
  rubyforge_project:
74
- rubygems_version: 1.8.23.2
68
+ rubygems_version: 2.4.8
75
69
  signing_key:
76
- specification_version: 3
70
+ specification_version: 4
77
71
  summary: Akamai {OPEN} EdgeGrid Authenticator for net/http
78
72
  test_files: []