akamai_ccu 1.5.7 → 1.5.8

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
  SHA1:
3
- metadata.gz: a734d5241216fd737a75ca24c455c96e34248442
4
- data.tar.gz: 46b2464a82a569c26fadbe59f0cb907bb928ce0b
3
+ metadata.gz: 267c2f6feb51252b2b9cde5592d74f7ef81bf03c
4
+ data.tar.gz: '08ffb1b4e4fb3a01c556042c7188c67d51516051'
5
5
  SHA512:
6
- metadata.gz: b80ee1c47cf7c01c3fd85e091512efb36b8b9ccd4b255a19729592bae15e01d86ddcdb2158505986125021aeae1627302c2a12e53ecb90fae2842ba4c60226c6
7
- data.tar.gz: e17d06450b539ccb54d7386fce3fcaa4b477437f8d91c68b00fa89a9ca9427a7bba8d5c2eaff273ceb9fc82efc8ea17fc03abb132032faddc03b9cfcd861b659
6
+ metadata.gz: 7d87236050315502498f17f45eb7f5d18b915e27a17209eb2d4e8683cf480796c026d9c5a7bead5c575c04e0da6d35ab9c4323cde413dedc95bedc52ce40ffde
7
+ data.tar.gz: ccad81b10d6eb4b6caa64ab7271782fcdb081f0ba540258d9cdf5668017c06c02450b70d7858dc8ec42d66e7a17b7a0cd2ba5a1e01c034868800403703fd63d3
@@ -1,3 +1,4 @@
1
+ require "logger"
1
2
  require "time"
2
3
 
3
4
  module AkamaiCCU
@@ -6,7 +7,8 @@ module AkamaiCCU
6
7
 
7
8
  attr_reader :body, :title, :status, :detail, :support_id, :purge_id, :decribed_by, :completion_at
8
9
 
9
- def initialize(body = {}, time = Time.now)
10
+ def initialize(body: {}, time: Time.now, logger: Logger.new(nil))
11
+ @logger = logger
10
12
  @body = parse(body)
11
13
  @title = @body["title"]
12
14
  @status = @body.fetch("httpStatus") { @body.fetch("status", BAD_STATUS) }
@@ -36,6 +38,8 @@ module AkamaiCCU
36
38
  private def parse(body)
37
39
  return body if body.is_a? Hash
38
40
  JSON.parse(body)
41
+ rescue JSON::ParserError => e
42
+ @logger.error { "reponse parse error: #{e.message}" }
39
43
  end
40
44
  end
41
45
  end
@@ -1,3 +1,3 @@
1
1
  module AkamaiCCU
2
- VERSION = "1.5.7"
2
+ VERSION = "1.5.8"
3
3
  end
@@ -46,7 +46,7 @@ module AkamaiCCU
46
46
  self.class.logger.debug { "request: uri=#{request.path}; body=#{request.body}; authorization=#{request["Authorization"]}" }
47
47
  end
48
48
  self.class.logger.info { "response: inspect=#{response.inspect}; body=#{response.body}" }
49
- response_klass.new(response.body)
49
+ response_klass.new(body: response.body, logger: self.class.logger)
50
50
  end
51
51
  end
52
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akamai_ccu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - costajob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler