akamai_ccu 1.5.3 → 1.5.4

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: ef3e0fed8df1e3850924b49115112c43960ca51c
4
- data.tar.gz: 32f31aed414f4e0adede30a7da468d22a2b36de6
3
+ metadata.gz: 590edfc04540966643fb8dcb26d61b1bc1fd472d
4
+ data.tar.gz: 786b909ccd366835593fd460dc590d6d2d2b6edd
5
5
  SHA512:
6
- metadata.gz: 7413b4ad784481a2dea0fe33abeb5beb72ab1ea299545d5213a784f3f81f14d2c009548338216ed80e3a0a4694e867ed7fcf97dfcf70ea7c93aec8bbfe5a87e8
7
- data.tar.gz: 79656ea6a16a49e45102814b4c9fa4beb9cdec5b0f8d37ad52c4b6ea6e668849d89dfae727284bad85659ef25f41689c199f8e7e3f9fb8231eb2f7beb9bb2637
6
+ metadata.gz: 7e08562da9ceb7f72beb90ed9bd38fdae72b23088f28f3c7c47ce964f1dbc5940b85f61d9a805e4632c365fe5529cd202c8e154b3648e5bbe76f04ce7b21543d
7
+ data.tar.gz: 27796fd0c26becf2f80a1bfdeba91b5d3b5b8586da1248576e24c3854e9462150234029683a5e66c86ce36faae9e26598612fcd96c512aec20d8d10f90b45e83
@@ -18,13 +18,13 @@ module AkamaiCCU
18
18
  @wrapper_klass = wrapper_klass
19
19
  @secret_klass = secret_klass
20
20
  @endpoint_klass = endpoint_klass
21
+ @secret = File.expand_path("~/.edgerc")
21
22
  @network = Endpoint::Network::STAGING
22
23
  end
23
24
 
24
25
  def call
25
26
  parser.parse!(@args)
26
27
  return @logger.warn("specify contents to purge by bulk, CP codes or urls") if Array(@objects).empty?
27
- return @logger.warn("specify path to the secret file either by edgerc or by txt") unless @secret
28
28
  return @logger.warn("specified secret file does not exist") unless File.exist?(@secret)
29
29
  @wrapper_klass.setup(@secret_klass.by_file(@secret), Client, @logger)
30
30
  wrapper = @wrapper_klass.new(endpoint: endpoint, headers: Array(@headers))
@@ -51,7 +51,7 @@ module AkamaiCCU
51
51
  OptionParser.new do |opts|
52
52
  opts.banner = "Usage: ccu_#{@action} --secret=~/.edgerc --production --cp=12345,98765"
53
53
 
54
- opts.on("-sSECRET", "--secret=SECRET", "Load secret data by file") do |secret|
54
+ opts.on("-sSECRET", "--secret=SECRET", "Load secret by file (default to ~/.edgerc)") do |secret|
55
55
  @secret = File.expand_path(secret)
56
56
  end
57
57
 
@@ -67,7 +67,7 @@ module AkamaiCCU
67
67
  @objects = bulk_objects(File.expand_path(bulk))
68
68
  end
69
69
 
70
- opts.on("--headers=HEADERS", "Specify HTTP headers to sign") do |headers|
70
+ opts.on("--headers=HEADERS", "Specify any HTTP headers to sign") do |headers|
71
71
  @headers = headers.split(",").map(&:strip)
72
72
  end
73
73
 
@@ -9,19 +9,17 @@ module AkamaiCCU
9
9
 
10
10
  class FileContentError < ArgumentError; end
11
11
 
12
- class << self
13
- def by_file(name = "~/.edgerc", time = Time.now)
14
- path = File.expand_path(name)
15
- return unless File.exist?(path)
16
- opts = File.readlines(path).reduce({}) do |acc, entry|
17
- _, k, v = Array(entry.match(ENTRY_REGEX))
18
- acc[k] = v if k && v
19
- acc
20
- end
21
- new(client_secret: opts.fetch("client_secret"), host: opts.fetch("host"), access_token: opts.fetch("access_token"), client_token: opts.fetch("client_token"), max_body: opts.fetch("max-body", BODY_SIZE), time: time)
22
- rescue KeyError => e
23
- raise FileContentError, "bad file content, #{e.message}", e.backtrace
12
+ def self.by_file(name = "~/.edgerc", time = Time.now)
13
+ path = File.expand_path(name)
14
+ return unless File.exist?(path)
15
+ opts = File.readlines(path).reduce({}) do |acc, entry|
16
+ _, k, v = Array(entry.match(ENTRY_REGEX))
17
+ acc[k] = v if k && v
18
+ acc
24
19
  end
20
+ new(client_secret: opts.fetch("client_secret"), host: opts.fetch("host"), access_token: opts.fetch("access_token"), client_token: opts.fetch("client_token"), max_body: opts.fetch("max-body", BODY_SIZE), time: time)
21
+ rescue KeyError => e
22
+ raise FileContentError, "bad file content, #{e.message}", e.backtrace
25
23
  end
26
24
 
27
25
  attr_reader :host, :max_body, :nonce, :timestamp
@@ -1,3 +1,3 @@
1
1
  module AkamaiCCU
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akamai_ccu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - costajob