akamai_api 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -0
  3. data/.yardopts +4 -0
  4. data/Gemfile +16 -0
  5. data/README.md +53 -52
  6. data/Thorfile +7 -1
  7. data/akamai_api.gemspec +1 -7
  8. data/bin/akamai_api +2 -1
  9. data/cassettes/akamai_api_ccu_arl_invalidate/invalid_credentials.yml +1 -1
  10. data/cassettes/akamai_api_ccu_arl_invalidate/invalid_item.yml +1 -1
  11. data/cassettes/akamai_api_ccu_arl_invalidate/multiple_items.yml +1 -1
  12. data/cassettes/akamai_api_ccu_arl_invalidate/single_item.yml +1 -1
  13. data/cassettes/akamai_api_ccu_arl_remove/invalid_credentials.yml +1 -1
  14. data/cassettes/akamai_api_ccu_arl_remove/invalid_item.yml +2 -2
  15. data/cassettes/akamai_api_ccu_arl_remove/multiple_items.yml +1 -1
  16. data/cassettes/akamai_api_ccu_arl_remove/single_item.yml +1 -1
  17. data/cassettes/akamai_api_ccu_cpcode_invalidate/invalid_credentials.yml +1 -1
  18. data/cassettes/akamai_api_ccu_cpcode_invalidate/invalid_item.yml +1 -1
  19. data/cassettes/akamai_api_ccu_cpcode_invalidate/multiple_items.yml +1 -1
  20. data/cassettes/akamai_api_ccu_cpcode_invalidate/single_item.yml +1 -1
  21. data/cassettes/akamai_api_ccu_cpcode_remove/invalid_credentials.yml +1 -1
  22. data/cassettes/akamai_api_ccu_cpcode_remove/invalid_item.yml +1 -1
  23. data/cassettes/akamai_api_ccu_cpcode_remove/multiple_items.yml +1 -1
  24. data/cassettes/akamai_api_ccu_cpcode_remove/single_item.yml +1 -1
  25. data/cassettes/akamai_api_eccu_all_ids/invalid_credentials.yml +68 -0
  26. data/cassettes/akamai_api_eccu_all_ids/successful.yml +72 -0
  27. data/cassettes/akamai_api_eccu_destroy/invalid_credentials.yml +69 -0
  28. data/cassettes/akamai_api_eccu_destroy/not_found_request.yml +55 -0
  29. data/cassettes/akamai_api_eccu_destroy/successful.yml +57 -0
  30. data/cassettes/akamai_api_eccu_find/invalid_credentials.yml +69 -0
  31. data/cassettes/akamai_api_eccu_find/not_found_request.yml +55 -0
  32. data/cassettes/akamai_api_eccu_find/successful.yml +70 -0
  33. data/cassettes/akamai_api_eccu_find/successful_without_content.yml +70 -0
  34. data/cassettes/akamai_api_eccu_publish/invalid_credentials.yml +5 -5
  35. data/cassettes/akamai_api_eccu_publish/invalid_domain.yml +7 -7
  36. data/cassettes/akamai_api_eccu_publish/successful.yml +8 -8
  37. data/cassettes/akamai_api_eccu_update_email/invalid_credentials.yml +69 -0
  38. data/cassettes/akamai_api_eccu_update_email/not_found_request.yml +55 -0
  39. data/cassettes/akamai_api_eccu_update_email/successful.yml +57 -0
  40. data/cassettes/akamai_api_eccu_update_notes/invalid_credentials.yml +70 -0
  41. data/cassettes/akamai_api_eccu_update_notes/not_found_request.yml +56 -0
  42. data/cassettes/akamai_api_eccu_update_notes/successful.yml +58 -0
  43. data/features/ccu_arl_invalidate.feature +5 -9
  44. data/features/ccu_arl_remove.feature +5 -9
  45. data/features/ccu_cpcode_invalidate.feature +2 -6
  46. data/features/ccu_cpcode_remove.feature +2 -6
  47. data/features/ccu_purge_status.feature +2 -2
  48. data/features/eccu_publish.feature +6 -42
  49. data/features/step_definitions/file_named_with_content_steps.rb +3 -0
  50. data/features/support/env.rb +12 -3
  51. data/lib/akamai_api/ccu/base_response.rb +27 -0
  52. data/lib/akamai_api/ccu/error.rb +38 -0
  53. data/lib/akamai_api/ccu/purge/request.rb +58 -11
  54. data/lib/akamai_api/ccu/purge/response.rb +15 -9
  55. data/lib/akamai_api/ccu/purge.rb +14 -3
  56. data/lib/akamai_api/ccu/purge_status/not_found.rb +18 -0
  57. data/lib/akamai_api/ccu/purge_status/request.rb +41 -7
  58. data/lib/akamai_api/ccu/purge_status/response.rb +49 -3
  59. data/lib/akamai_api/ccu/purge_status.rb +17 -9
  60. data/lib/akamai_api/ccu/status/request.rb +20 -7
  61. data/lib/akamai_api/ccu/status/response.rb +8 -2
  62. data/lib/akamai_api/ccu/status.rb +13 -2
  63. data/lib/akamai_api/ccu/unrecognized_option.rb +6 -0
  64. data/lib/akamai_api/ccu.rb +132 -23
  65. data/lib/akamai_api/cli/app.rb +15 -13
  66. data/lib/akamai_api/cli/ccu/arl.rb +10 -4
  67. data/lib/akamai_api/cli/ccu/base.rb +11 -3
  68. data/lib/akamai_api/cli/ccu/cp_code.rb +10 -4
  69. data/lib/akamai_api/cli/ccu/purge_renderer.rb +1 -1
  70. data/lib/akamai_api/cli/ccu/status_renderer.rb +46 -26
  71. data/lib/akamai_api/cli/ccu.rb +2 -4
  72. data/lib/akamai_api/cli/command.rb +60 -25
  73. data/lib/akamai_api/cli/eccu/base.rb +59 -0
  74. data/lib/akamai_api/cli/eccu/entry_renderer.rb +5 -3
  75. data/lib/akamai_api/cli/eccu.rb +2 -56
  76. data/lib/akamai_api/cli.rb +2 -6
  77. data/lib/akamai_api/eccu/base_edit_request.rb +51 -0
  78. data/lib/akamai_api/eccu/base_request.rb +32 -0
  79. data/lib/akamai_api/eccu/destroy_request.rb +30 -0
  80. data/lib/akamai_api/eccu/find_request.rb +45 -0
  81. data/lib/akamai_api/eccu/find_response.rb +110 -0
  82. data/lib/akamai_api/eccu/invalid_domain.rb +7 -0
  83. data/lib/akamai_api/eccu/list_request.rb +21 -0
  84. data/lib/akamai_api/eccu/not_found.rb +6 -0
  85. data/lib/akamai_api/eccu/publish_request.rb +75 -0
  86. data/lib/akamai_api/eccu/soap_body.rb +99 -0
  87. data/lib/akamai_api/eccu/update_attribute_request.rb +62 -0
  88. data/lib/akamai_api/eccu.rb +19 -0
  89. data/lib/akamai_api/eccu_request.rb +39 -117
  90. data/lib/akamai_api/error.rb +5 -0
  91. data/lib/akamai_api/unauthorized.rb +6 -0
  92. data/lib/akamai_api/version.rb +1 -1
  93. data/lib/akamai_api.rb +18 -4
  94. data/spec/features/ccu/purge_request_spec.rb +10 -12
  95. data/spec/features/ccu/purge_status_request_spec.rb +5 -5
  96. data/spec/features/ccu/status_request_spec.rb +3 -3
  97. data/spec/features/eccu/destroy_spec.rb +28 -0
  98. data/spec/features/eccu/find_request_spec.rb +34 -0
  99. data/spec/features/eccu/list_request_spec.rb +22 -0
  100. data/spec/features/eccu/publish_request_spec.rb +29 -0
  101. data/spec/features/eccu/update_email_spec.rb +28 -0
  102. data/spec/features/eccu/update_notes_spec.rb +28 -0
  103. data/spec/lib/akamai_api/ccu/{response_spec.rb → base_response_spec.rb} +2 -2
  104. data/spec/lib/akamai_api/ccu/purge/request_spec.rb +26 -20
  105. data/spec/lib/akamai_api/ccu/purge/response_spec.rb +16 -26
  106. data/spec/lib/akamai_api/ccu/purge_status/not_found_response_spec.rb +34 -34
  107. data/spec/lib/akamai_api/ccu/purge_status/request_spec.rb +24 -12
  108. data/spec/lib/akamai_api/ccu/purge_status/{successful_response_spec.rb → response_spec.rb} +8 -8
  109. data/spec/lib/akamai_api/ccu/status/request_spec.rb +6 -6
  110. data/spec/lib/akamai_api/ccu/status/response_spec.rb +2 -2
  111. data/spec/lib/akamai_api/ccu_spec.rb +7 -7
  112. data/spec/lib/akamai_api/cli/ccu/status_renderer_spec.rb +5 -17
  113. data/spec/lib/akamai_api/eccu/destroy_request_spec.rb +75 -0
  114. data/spec/lib/akamai_api/eccu/find_request_spec.rb +74 -0
  115. data/spec/lib/akamai_api/eccu/find_response_spec.rb +159 -0
  116. data/spec/lib/akamai_api/eccu/list_request_spec.rb +43 -0
  117. data/spec/lib/akamai_api/eccu/publish_request_spec.rb +133 -0
  118. data/spec/lib/akamai_api/eccu/soap_body_spec.rb +46 -0
  119. data/spec/lib/akamai_api/eccu/update_attribute_request_spec.rb +86 -0
  120. data/spec/lib/akamai_api/eccu_request_spec.rb +149 -158
  121. data/spec/spec_helper.rb +11 -3
  122. metadata +90 -104
  123. data/lib/akamai_api/ccu/purge_status/not_found_response.rb +0 -9
  124. data/lib/akamai_api/ccu/purge_status/successful_response.rb +0 -25
  125. data/lib/akamai_api/ccu/response.rb +0 -18
  126. data/lib/akamai_api/soap_body.rb +0 -40
  127. data/spec/lib/akamai_api/soap_body_spec.rb +0 -48
  128. data/spec/support/savon_backports.rb +0 -10
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://foo:bar@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setStatusChangeEmail><fileId
12
+ xsi:type="xsd:int">1234</fileId><statusChangeEmail xsi:type="xsd:string">guest@mikamai.com</statusChangeEmail></akapubeccudt:setStatusChangeEmail></env:Body></env:Envelope>
13
+ headers:
14
+ Soapaction:
15
+ - '"setStatusChangeEmail"'
16
+ Content-Type:
17
+ - text/xml;charset=UTF-8
18
+ Content-Length:
19
+ - '603'
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - '*/*'
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 401
29
+ message: Unauthorized
30
+ headers:
31
+ Server:
32
+ - Apache
33
+ Www-Authenticate:
34
+ - Basic realm="Luna Control Center Web Services (use your Luna username and
35
+ password)"
36
+ Content-Length:
37
+ - '401'
38
+ Content-Type:
39
+ - text/html; charset=iso-8859-1
40
+ Expires:
41
+ - Thu, 22 May 2014 13:28:09 GMT
42
+ Cache-Control:
43
+ - max-age=0, no-cache, no-store
44
+ Pragma:
45
+ - no-cache
46
+ Date:
47
+ - Thu, 22 May 2014 13:28:09 GMT
48
+ Connection:
49
+ - close
50
+ X-Frame-Options:
51
+ - SAMEORIGIN
52
+ body:
53
+ encoding: UTF-8
54
+ string: |
55
+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
56
+ <html><head>
57
+ <title>401 Authorization Required</title>
58
+ </head><body>
59
+ <h1>Authorization Required</h1>
60
+ <p>This server could not verify that you
61
+ are authorized to access the document
62
+ requested. Either you supplied the wrong
63
+ credentials (e.g., bad password), or your
64
+ browser doesn't understand how to supply
65
+ the credentials required.</p>
66
+ </body></html>
67
+ http_version:
68
+ recorded_at: Thu, 22 May 2014 13:28:07 GMT
69
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setStatusChangeEmail><fileId
12
+ xsi:type="xsd:int">1234</fileId><statusChangeEmail xsi:type="xsd:string">guest@mikamai.com</statusChangeEmail></akapubeccudt:setStatusChangeEmail></env:Body></env:Envelope>
13
+ headers:
14
+ Soapaction:
15
+ - '"setStatusChangeEmail"'
16
+ Content-Type:
17
+ - text/xml;charset=UTF-8
18
+ Content-Length:
19
+ - '603'
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - '*/*'
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 500
29
+ message: Internal Server Error
30
+ headers:
31
+ Server:
32
+ - Apache
33
+ Content-Type:
34
+ - text/xml;charset=utf-8
35
+ Expires:
36
+ - Thu, 22 May 2014 13:28:24 GMT
37
+ Cache-Control:
38
+ - max-age=0, no-cache, no-store
39
+ Pragma:
40
+ - no-cache
41
+ Date:
42
+ - Thu, 22 May 2014 13:28:24 GMT
43
+ Connection:
44
+ - close
45
+ X-Frame-Options:
46
+ - SAMEORIGIN
47
+ body:
48
+ encoding: UTF-8
49
+ string: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
50
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</faultcode><faultstring>fileId
51
+ 1234 does not exist</faultstring><detail><ns1:exceptionName xmlns:ns1="http://xml.apache.org/axis/">com.akamai.aws.util.AWSFault</ns1:exceptionName><ns2:hostname
52
+ xmlns:ns2="http://xml.apache.org/axis/">ext-tomapp6.extranet.akamai.com</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
53
+ http_version:
54
+ recorded_at: Thu, 22 May 2014 13:28:23 GMT
55
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setNotes><fileId
12
+ xsi:type="xsd:int">1234</fileId><notes xsi:type="xsd:string">guest@mikamai.com</notes></akapubeccudt:setNotes></env:Body></env:Envelope>
13
+ headers:
14
+ Soapaction:
15
+ - '"setNotes"'
16
+ Content-Type:
17
+ - text/xml;charset=UTF-8
18
+ Content-Length:
19
+ - '561'
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - '*/*'
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Server:
32
+ - Apache
33
+ Content-Type:
34
+ - text/xml;charset=utf-8
35
+ Content-Length:
36
+ - '482'
37
+ Expires:
38
+ - Thu, 22 May 2014 13:29:24 GMT
39
+ Cache-Control:
40
+ - max-age=0, no-cache, no-store
41
+ Pragma:
42
+ - no-cache
43
+ Date:
44
+ - Thu, 22 May 2014 13:29:24 GMT
45
+ Connection:
46
+ - keep-alive
47
+ X-Frame-Options:
48
+ - SAMEORIGIN
49
+ body:
50
+ encoding: UTF-8
51
+ string: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
52
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:setNotesResponse
53
+ soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="https://control.akamai.com/2003/Sep/PublishECCU.xsd"><success
54
+ xsi:type="xsd:boolean">true</success></ns1:setNotesResponse></soapenv:Body></soapenv:Envelope>
55
+ http_version:
56
+ recorded_at: Thu, 22 May 2014 13:29:23 GMT
57
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://foo:bar@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setNotes><fileId
12
+ xsi:type="xsd:int">1234</fileId><notes xsi:type="xsd:string">request updated
13
+ using AkamaiApi</notes></akapubeccudt:setNotes></env:Body></env:Envelope>
14
+ headers:
15
+ Soapaction:
16
+ - '"setNotes"'
17
+ Content-Type:
18
+ - text/xml;charset=UTF-8
19
+ Content-Length:
20
+ - '569'
21
+ Accept-Encoding:
22
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
23
+ Accept:
24
+ - '*/*'
25
+ User-Agent:
26
+ - Ruby
27
+ response:
28
+ status:
29
+ code: 401
30
+ message: Unauthorized
31
+ headers:
32
+ Server:
33
+ - Apache
34
+ Www-Authenticate:
35
+ - Basic realm="Luna Control Center Web Services (use your Luna username and
36
+ password)"
37
+ Content-Length:
38
+ - '401'
39
+ Content-Type:
40
+ - text/html; charset=iso-8859-1
41
+ Expires:
42
+ - Thu, 22 May 2014 12:49:14 GMT
43
+ Cache-Control:
44
+ - max-age=0, no-cache, no-store
45
+ Pragma:
46
+ - no-cache
47
+ Date:
48
+ - Thu, 22 May 2014 12:49:14 GMT
49
+ Connection:
50
+ - close
51
+ X-Frame-Options:
52
+ - SAMEORIGIN
53
+ body:
54
+ encoding: UTF-8
55
+ string: |
56
+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
57
+ <html><head>
58
+ <title>401 Authorization Required</title>
59
+ </head><body>
60
+ <h1>Authorization Required</h1>
61
+ <p>This server could not verify that you
62
+ are authorized to access the document
63
+ requested. Either you supplied the wrong
64
+ credentials (e.g., bad password), or your
65
+ browser doesn't understand how to supply
66
+ the credentials required.</p>
67
+ </body></html>
68
+ http_version:
69
+ recorded_at: Thu, 22 May 2014 12:49:13 GMT
70
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setNotes><fileId
12
+ xsi:type="xsd:int">1234</fileId><notes xsi:type="xsd:string">request updated
13
+ using AkamaiApi</notes></akapubeccudt:setNotes></env:Body></env:Envelope>
14
+ headers:
15
+ Soapaction:
16
+ - '"setNotes"'
17
+ Content-Type:
18
+ - text/xml;charset=UTF-8
19
+ Content-Length:
20
+ - '569'
21
+ Accept-Encoding:
22
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
23
+ Accept:
24
+ - '*/*'
25
+ User-Agent:
26
+ - Ruby
27
+ response:
28
+ status:
29
+ code: 500
30
+ message: Internal Server Error
31
+ headers:
32
+ Server:
33
+ - Apache
34
+ Content-Type:
35
+ - text/xml;charset=utf-8
36
+ Expires:
37
+ - Thu, 22 May 2014 12:50:37 GMT
38
+ Cache-Control:
39
+ - max-age=0, no-cache, no-store
40
+ Pragma:
41
+ - no-cache
42
+ Date:
43
+ - Thu, 22 May 2014 12:50:37 GMT
44
+ Connection:
45
+ - close
46
+ X-Frame-Options:
47
+ - SAMEORIGIN
48
+ body:
49
+ encoding: UTF-8
50
+ string: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
51
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</faultcode><faultstring>fileId
52
+ 1234 does not exist</faultstring><detail><ns1:exceptionName xmlns:ns1="http://xml.apache.org/axis/">com.akamai.aws.util.AWSFault</ns1:exceptionName><ns2:hostname
53
+ xmlns:ns2="http://xml.apache.org/axis/">ext-tomapp1.extranet.akamai.com</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
54
+ http_version:
55
+ recorded_at: Thu, 22 May 2014 12:50:36 GMT
56
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@control.akamai.com/webservices/services/PublishECCU
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:akapubeccudt="https://control.akamai.com/2003/Sep/PublishECCU.xsd"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="https://control.akamai.com/AWS.xsd"
11
+ xmlns:ins1="https://control.akamai.com/Publish.xsd"><env:Body><akapubeccudt:setNotes><fileId
12
+ xsi:type="xsd:int">1234</fileId><notes xsi:type="xsd:string">request
13
+ updated using AkamaiApi</notes></akapubeccudt:setNotes></env:Body></env:Envelope>
14
+ headers:
15
+ Soapaction:
16
+ - '"setNotes"'
17
+ Content-Type:
18
+ - text/xml;charset=UTF-8
19
+ Content-Length:
20
+ - '574'
21
+ Accept-Encoding:
22
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
23
+ Accept:
24
+ - '*/*'
25
+ User-Agent:
26
+ - Ruby
27
+ response:
28
+ status:
29
+ code: 200
30
+ message: OK
31
+ headers:
32
+ Server:
33
+ - Apache
34
+ Content-Type:
35
+ - text/xml;charset=utf-8
36
+ Content-Length:
37
+ - '482'
38
+ Expires:
39
+ - Thu, 22 May 2014 12:57:30 GMT
40
+ Cache-Control:
41
+ - max-age=0, no-cache, no-store
42
+ Pragma:
43
+ - no-cache
44
+ Date:
45
+ - Thu, 22 May 2014 12:57:30 GMT
46
+ Connection:
47
+ - keep-alive
48
+ X-Frame-Options:
49
+ - SAMEORIGIN
50
+ body:
51
+ encoding: UTF-8
52
+ string: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
53
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:setNotesResponse
54
+ soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="https://control.akamai.com/2003/Sep/PublishECCU.xsd"><success
55
+ xsi:type="xsd:boolean">true</success></ns1:setNotesResponse></soapenv:Body></soapenv:Envelope>
56
+ http_version:
57
+ recorded_at: Thu, 22 May 2014 12:57:29 GMT
58
+ recorded_with: VCR 2.9.0
@@ -4,7 +4,7 @@ Feature: akamai_api ccu arl invalidate
4
4
 
5
5
  @vcr
6
6
  Scenario: invalid credentials
7
- When I run `akamai_api ccu arl invalidate http://www.foo.com/bar.txt -u foo -p bar`
7
+ When I run `akamai_api ccu arl invalidate http://www.foo.bar/t.txt -u foo -p bar`
8
8
  Then the output should contain:
9
9
  """
10
10
  Your login credentials are invalid.
@@ -12,23 +12,19 @@ Feature: akamai_api ccu arl invalidate
12
12
 
13
13
  @vcr
14
14
  Scenario: invalid item
15
- When I run `akamai_api ccu arl invalidate http://www.foo.com/bar.txt`
15
+ When I run `akamai_api ccu arl invalidate http://www.foo.bar/t.txt`
16
16
  Then the output should contain:
17
17
  """
18
- There was an error processing your request:
18
+ Error 403: 'unauthorized arl' (http://www.foo.com/bar.txt)
19
19
  """
20
20
  And the output should contain:
21
21
  """
22
- * Result: 403 - unauthorized arl (http://www.foo.com/bar.txt)
23
- """
24
- And the output should contain:
25
- """
26
- * Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl
22
+ Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl
27
23
  """
28
24
 
29
25
  @vcr
30
26
  Scenario: single item
31
- When I run `akamai_api ccu arl invalidate http://www.foo.com/bar.txt`
27
+ When I run `akamai_api ccu arl invalidate http://www.foo.bar/t.txt`
32
28
  Then the output should contain:
33
29
  """
34
30
  Purge request successfully submitted:
@@ -4,7 +4,7 @@ Feature: akamai_api ccu arl remove
4
4
 
5
5
  @vcr
6
6
  Scenario: invalid credentials
7
- When I run `akamai_api ccu arl remove http://www.foo.com/bar.txt -u foo -p bar`
7
+ When I run `akamai_api ccu arl remove http://www.foo.bar/t.txt -u foo -p bar`
8
8
  Then the output should contain:
9
9
  """
10
10
  Your login credentials are invalid.
@@ -12,23 +12,19 @@ Feature: akamai_api ccu arl remove
12
12
 
13
13
  @vcr
14
14
  Scenario: invalid item
15
- When I run `akamai_api ccu arl remove http://www.foo.com/bar.txt`
15
+ When I run `akamai_api ccu arl remove http://www.foo.bar/t.txt`
16
16
  Then the output should contain:
17
17
  """
18
- There was an error processing your request:
18
+ Error 403: 'unauthorized arl' (http://www.foo.bar/t.txt)
19
19
  """
20
20
  And the output should contain:
21
21
  """
22
- * Result: 403 - unauthorized arl (http://www.foo.com/bar.txt)
23
- """
24
- And the output should contain:
25
- """
26
- * Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl
22
+ Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl
27
23
  """
28
24
 
29
25
  @vcr
30
26
  Scenario: single item
31
- When I run `akamai_api ccu arl remove http://www.foo.com/bar.txt`
27
+ When I run `akamai_api ccu arl remove http://www.foo.bar/t.txt`
32
28
  Then the output should contain:
33
29
  """
34
30
  Purge request successfully submitted:
@@ -15,15 +15,11 @@ Feature: akamai_api ccu cpcode invalidate
15
15
  When I run `akamai_api ccu cpcode invalidate 12345`
16
16
  Then the output should contain:
17
17
  """
18
- There was an error processing your request:
18
+ Error 403: 'unauthorized cpcode' (12345)
19
19
  """
20
20
  And the output should contain:
21
21
  """
22
- * Result: 403 - unauthorized cpcode (12345)
23
- """
24
- And the output should contain:
25
- """
26
- * Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-cpcode
22
+ Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-cpcode
27
23
  """
28
24
 
29
25
  @vcr
@@ -15,15 +15,11 @@ Feature: akamai_api ccu cpcode remove
15
15
  When I run `akamai_api ccu cpcode remove 12345`
16
16
  Then the output should contain:
17
17
  """
18
- There was an error processing your request:
18
+ Error 403: 'unauthorized cpcode' (12345)
19
19
  """
20
20
  And the output should contain:
21
21
  """
22
- * Result: 403 - unauthorized cpcode (12345)
23
- """
24
- And the output should contain:
25
- """
26
- * Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-cpcode
22
+ Described by: https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-cpcode
27
23
  """
28
24
 
29
25
  @vcr
@@ -67,7 +67,7 @@ Feature: akamai_api ccu purge status
67
67
  When I run `akamai_api ccu status foobarbaz`
68
68
  Then the output should contain:
69
69
  """
70
- No purge request found using /ccu/v2/purges/foobarbaz:
70
+ No purge request found
71
71
  """
72
72
  And the output should contain:
73
73
  """
@@ -75,7 +75,7 @@ Feature: akamai_api ccu purge status
75
75
  """
76
76
  And the output should contain:
77
77
  """
78
- * Purge ID: foobarbaz | Support ID: 12345678901234567890-123456789
78
+ * Support ID: 12345678901234567890-123456789
79
79
  """
80
80
  And the output should contain:
81
81
  """
@@ -4,19 +4,7 @@ Feature: akamai_api eccu publish
4
4
 
5
5
  @vcr
6
6
  Scenario: invalid credentials
7
- Given a file named "publish.xml" with:
8
- """
9
- <?xml version="1.0"?>
10
- <eccu>
11
- <match:recursive-dirs value="foo" >
12
- <match:recursive-dirs value="bar" >
13
- <match:recursive-dirs value="baz.jpg" >
14
- <revalidate>now</revalidate>
15
- </match:recursive-dirs>
16
- </match:recursive-dirs>
17
- </match:recursive-dirs>
18
- </eccu>
19
- """
7
+ Given a file named "publish.xml" with the content of "spec/fixtures/eccu_request.xml"
20
8
  When I run `akamai_api eccu publish_xml ./publish.xml foo.com -u foo -p bar`
21
9
  Then the output should contain:
22
10
  """
@@ -25,40 +13,16 @@ Feature: akamai_api eccu publish
25
13
 
26
14
  @vcr
27
15
  Scenario: invalid domain
28
- Given a file named "publish.xml" with:
29
- """
30
- <?xml version="1.0"?>
31
- <eccu>
32
- <match:recursive-dirs value="foo" >
33
- <match:recursive-dirs value="bar" >
34
- <match:recursive-dirs value="baz.jpg" >
35
- <revalidate>now</revalidate>
36
- </match:recursive-dirs>
37
- </match:recursive-dirs>
38
- </match:recursive-dirs>
39
- </eccu>
40
- """
41
- When I run `akamai_api eccu publish_xml ./publish.xml john.smith.com`
16
+ Given a file named "publish.xml" with the content of "spec/fixtures/eccu_request.xml"
17
+ When I run `akamai_api eccu publish_xml ./publish.xml foobarbaz.com`
42
18
  Then the output should contain:
43
19
  """
44
- ECCU validation failed: You are not authorized to specify this digital property
20
+ You are not authorized to specify this digital property
45
21
  """
46
22
 
47
23
  @vcr
48
24
  Scenario: successful
49
- Given a file named "publish.xml" with:
50
- """
51
- <?xml version="1.0"?>
52
- <eccu>
53
- <match:recursive-dirs value="foo" >
54
- <match:recursive-dirs value="bar" >
55
- <match:recursive-dirs value="baz.jpg" >
56
- <revalidate>now</revalidate>
57
- </match:recursive-dirs>
58
- </match:recursive-dirs>
59
- </match:recursive-dirs>
60
- </eccu>
61
- """
25
+ Given a file named "publish.xml" with the content of "spec/fixtures/eccu_request.xml"
62
26
  When I run `akamai_api eccu publish_xml ./publish.xml foo.com`
63
27
  Then the output should contain:
64
28
  """
@@ -86,7 +50,7 @@ Feature: akamai_api eccu publish
86
50
  """
87
51
  And the output should contain:
88
52
  """
89
- * Notes : ECCU Request using AkamaiApi gem
53
+ * Notes : ECCU Request using AkamaiApi
90
54
  """
91
55
  And the output should contain:
92
56
  """
@@ -0,0 +1,3 @@
1
+ Given /^a file named "([^"]*)" with the content of "([^"]*)"$/ do |dest_file_name, source_file_name|
2
+ write_file(dest_file_name, File.read(source_file_name))
3
+ end
@@ -5,8 +5,14 @@ require 'aruba/cucumber'
5
5
  require 'aruba/in_process'
6
6
  require 'vcr'
7
7
  require 'webmock'
8
+ require 'coveralls'
9
+ Coveralls.wear_merged!
8
10
 
9
- require File.expand_path '../../../spec/auth', __FILE__
11
+ begin
12
+ require File.expand_path '../auth.rb', __FILE__
13
+ rescue LoadError
14
+ AkamaiApi.config[:auth] = ['test_username', 'test_password']
15
+ end
10
16
  ENV['AKAMAI_USERNAME'], ENV['AKAMAI_PASSWORD'] = AkamaiApi.config[:auth]
11
17
 
12
18
  VCR.cucumber_tags do |t|
@@ -17,15 +23,18 @@ VCR.configure do |c|
17
23
  c.hook_into :webmock
18
24
  c.cassette_library_dir = 'cassettes'
19
25
  c.default_cassette_options = {
20
- record: :once
26
+ record: :once,
27
+ match_requests_on: [:method, :uri, :body]
21
28
  }
22
29
  c.after_http_request do |request|
23
30
  request.uri.gsub! ENV['AKAMAI_USERNAME'], 'USERNAME'
24
31
  request.uri.gsub! ENV['AKAMAI_PASSWORD'], 'PASSWORD'
32
+ request.body.gsub! "AkamaiApi #{AkamaiApi::VERSION}", "AkamaiApi VERSION"
25
33
  end
26
34
  c.before_playback do |i|
27
35
  i.request.uri.gsub! 'USERNAME', ENV['AKAMAI_USERNAME']
28
36
  i.request.uri.gsub! 'PASSWORD', ENV['AKAMAI_PASSWORD']
37
+ i.request.body.gsub! "AkamaiApi VERSION", "AkamaiApi #{AkamaiApi::VERSION}"
29
38
  end
30
39
  end
31
40
 
@@ -37,7 +46,7 @@ class VcrFriendlyCLI
37
46
  def execute!
38
47
  $stdin = @stdin
39
48
  $stdout = @stdout
40
- @kernel.exit AkamaiApi::Cli::App.start(@argv.dup)
49
+ @kernel.exit AkamaiApi::CLI::App.start(@argv.dup)
41
50
  end
42
51
  end
43
52
 
@@ -0,0 +1,27 @@
1
+ module AkamaiApi
2
+ module CCU
3
+ # @abstract
4
+ # This class is intended as a generic superclass for all the specific responses that can be received
5
+ # when doing a request through the Akamai CCU interface
6
+ class BaseResponse
7
+ # @return [Hash<String, *>] raw Raw object describing the error.
8
+ attr_reader :raw
9
+
10
+ # @param [Hash<String, *>] raw Raw object describing the error.
11
+ def initialize raw
12
+ @raw = raw
13
+ end
14
+
15
+ # @return [String] Reference provided to Customer Care when needed.
16
+ def support_id
17
+ raw['supportId']
18
+ end
19
+
20
+ # @return [Fixnum] Response HTTP Status Code describing the error
21
+ def code
22
+ raw['httpStatus']
23
+ end
24
+ alias :http_status :code
25
+ end
26
+ end
27
+ end