akamai_api 0.1.1 → 0.2.0

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +5 -15
  3. data/README.md +106 -36
  4. data/Thorfile +5 -0
  5. data/akamai_api.gemspec +6 -3
  6. data/bin/akamai_api +1 -2
  7. data/cassettes/akamai_api_ccu_arl_invalidate/invalid_credentials.yml +37 -0
  8. data/cassettes/akamai_api_ccu_arl_invalidate/invalid_item.yml +36 -0
  9. data/cassettes/akamai_api_ccu_arl_invalidate/multiple_items.yml +38 -0
  10. data/cassettes/akamai_api_ccu_arl_invalidate/single_item.yml +38 -0
  11. data/cassettes/akamai_api_ccu_arl_remove/invalid_credentials.yml +37 -0
  12. data/cassettes/akamai_api_ccu_arl_remove/invalid_item.yml +36 -0
  13. data/cassettes/akamai_api_ccu_arl_remove/multiple_items.yml +38 -0
  14. data/cassettes/akamai_api_ccu_arl_remove/single_item.yml +38 -0
  15. data/cassettes/akamai_api_ccu_cpcode_invalidate/invalid_credentials.yml +37 -0
  16. data/cassettes/akamai_api_ccu_cpcode_invalidate/invalid_item.yml +36 -0
  17. data/cassettes/akamai_api_ccu_cpcode_invalidate/multiple_items.yml +38 -0
  18. data/cassettes/akamai_api_ccu_cpcode_invalidate/single_item.yml +38 -0
  19. data/cassettes/akamai_api_ccu_cpcode_remove/invalid_credentials.yml +37 -0
  20. data/cassettes/akamai_api_ccu_cpcode_remove/invalid_item.yml +36 -0
  21. data/cassettes/akamai_api_ccu_cpcode_remove/multiple_items.yml +38 -0
  22. data/cassettes/akamai_api_ccu_cpcode_remove/single_item.yml +38 -0
  23. data/cassettes/akamai_api_ccu_purge_status/completed_request.yml +35 -0
  24. data/cassettes/akamai_api_ccu_purge_status/enqueued_request.yml +35 -0
  25. data/cassettes/akamai_api_ccu_purge_status/invalid_credentials.yml +35 -0
  26. data/cassettes/akamai_api_ccu_purge_status/not_found_request.yml +37 -0
  27. data/cassettes/akamai_api_ccu_status/invalid_credentials.yml +35 -0
  28. data/cassettes/akamai_api_ccu_status/valid_credentials.yml +34 -0
  29. data/cassettes/akamai_api_eccu_last_request/invalid_credentials.yml +68 -0
  30. data/cassettes/akamai_api_eccu_last_request/valid_credentials.yml +140 -0
  31. data/cassettes/akamai_api_eccu_publish/invalid_credentials.yml +73 -0
  32. data/cassettes/akamai_api_eccu_publish/invalid_domain.yml +60 -0
  33. data/cassettes/akamai_api_eccu_publish/successful.yml +126 -0
  34. data/cassettes/akamai_api_eccu_requests/invalid_credentials.yml +68 -0
  35. data/cassettes/akamai_api_eccu_requests/valid_credentials.yml +325 -0
  36. data/features/ccu_arl_invalidate.feature +83 -0
  37. data/features/ccu_arl_remove.feature +83 -0
  38. data/features/ccu_cpcode_invalidate.feature +83 -0
  39. data/features/ccu_cpcode_remove.feature +83 -0
  40. data/features/ccu_purge_status.feature +83 -0
  41. data/features/ccu_status.feature +31 -0
  42. data/features/eccu_last_request.feature +47 -0
  43. data/features/eccu_publish.feature +98 -0
  44. data/features/eccu_requests.feature +43 -0
  45. data/features/step_definitions/contain_multiple_times_steps.rb +3 -0
  46. data/features/support/env.rb +58 -0
  47. data/lib/akamai_api/ccu/purge/request.rb +76 -0
  48. data/lib/akamai_api/ccu/purge/response.rb +31 -0
  49. data/lib/akamai_api/ccu/purge.rb +5 -0
  50. data/lib/akamai_api/ccu/purge_status/not_found_response.rb +9 -0
  51. data/lib/akamai_api/ccu/purge_status/request.rb +32 -0
  52. data/lib/akamai_api/ccu/purge_status/response.rb +19 -0
  53. data/lib/akamai_api/ccu/purge_status/successful_response.rb +25 -0
  54. data/lib/akamai_api/ccu/purge_status.rb +10 -0
  55. data/lib/akamai_api/ccu/response.rb +18 -0
  56. data/lib/akamai_api/ccu/status/request.rb +23 -0
  57. data/lib/akamai_api/ccu/status/response.rb +11 -0
  58. data/lib/akamai_api/ccu/status.rb +2 -0
  59. data/lib/akamai_api/ccu.rb +14 -50
  60. data/lib/akamai_api/cli/app.rb +2 -2
  61. data/lib/akamai_api/cli/ccu/arl.rb +36 -0
  62. data/lib/akamai_api/cli/ccu/base.rb +18 -0
  63. data/lib/akamai_api/cli/ccu/cp_code.rb +39 -0
  64. data/lib/akamai_api/cli/ccu/purge_renderer.rb +49 -0
  65. data/lib/akamai_api/cli/ccu/status_renderer.rb +69 -0
  66. data/lib/akamai_api/cli/ccu.rb +5 -10
  67. data/lib/akamai_api/cli/eccu/entry_renderer.rb +63 -0
  68. data/lib/akamai_api/cli/eccu.rb +16 -14
  69. data/lib/akamai_api/cli.rb +7 -2
  70. data/lib/akamai_api/eccu_request.rb +19 -1
  71. data/lib/akamai_api/version.rb +1 -1
  72. data/lib/akamai_api.rb +3 -1
  73. data/spec/features/ccu/purge_request_spec.rb +94 -0
  74. data/spec/features/ccu/purge_status_request_spec.rb +31 -0
  75. data/spec/features/ccu/status_request_spec.rb +17 -0
  76. data/spec/fixtures/ccu/successful_purge.json +1 -0
  77. data/spec/lib/akamai_api/ccu/purge/request_spec.rb +124 -0
  78. data/spec/lib/akamai_api/ccu/purge/response_spec.rb +54 -0
  79. data/spec/lib/akamai_api/ccu/purge_status/not_found_response_spec.rb +41 -0
  80. data/spec/lib/akamai_api/ccu/purge_status/request_spec.rb +64 -0
  81. data/spec/lib/akamai_api/ccu/purge_status/successful_response_spec.rb +86 -0
  82. data/spec/lib/akamai_api/ccu/response_spec.rb +15 -0
  83. data/spec/lib/akamai_api/ccu/status/request_spec.rb +22 -0
  84. data/spec/lib/akamai_api/ccu/status/response_spec.rb +29 -0
  85. data/spec/lib/akamai_api/ccu_spec.rb +49 -61
  86. data/spec/lib/akamai_api/cli/ccu/status_renderer_spec.rb +36 -0
  87. data/spec/lib/akamai_api/eccu_request_spec.rb +5 -5
  88. data/spec/spec_helper.rb +21 -1
  89. metadata +163 -26
  90. data/lib/akamai_api/ccu_response.rb +0 -51
  91. data/lib/akamai_api/cli/ccu_arl.rb +0 -40
  92. data/lib/akamai_api/cli/ccu_cp_code.rb +0 -48
  93. data/lib/akamai_api/cli/template.rb +0 -36
  94. data/lib/akamai_api/cp_code.rb +0 -33
  95. data/spec/fixtures/ccu/successful_purge.xml +0 -15
  96. data/spec/fixtures/cp_code/collection.xml +0 -21
  97. data/spec/fixtures/cp_code/single.xml +0 -16
  98. data/spec/lib/akamai_api/cp_code_spec.rb +0 -47
  99. data/wsdls/cpcode.wsdl +0 -2765
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e808bab22100f62956f5006c1ba29d1fb22577db
4
- data.tar.gz: bfa20069a4011e136c8d6a81b983a9c6ec4599c2
3
+ metadata.gz: da5bb7a0452b3d4b21385faf7458834c366add6c
4
+ data.tar.gz: 55bc7df2f48e4941cd70050941b283524a744e56
5
5
  SHA512:
6
- metadata.gz: 28c2e41dea359a7194fba6eebd36a4e0283e2d4e410126da8d51e5a0605ee5bcd15eeb230014ee8ec4365f9e3579c3f5ad9239b1b58e7724ffc998ad98f4d298
7
- data.tar.gz: ed23b76abba84de88cdff67d0af10b64ecadbd56e9c93165f6d99db6b9d43c8efb01a4a0464fde468905191b418f73821762754991d0c12e91256a5b51fbdb59
6
+ metadata.gz: b940d0dee60736afadcc0313ea2adb660c0ddbb1527e52b648b4acf34f381996ea82bdd6271e162034239d466ed151e9913aedaaf881c6b5287e85f4cb3f48b7
7
+ data.tar.gz: e976472d6fac76144147d48747a9414f1a485c2b70981d157ad1cf186d1f19cd36091ec2534fe48bf3038f639bdde0c08201e2a069876d09dd9394d4550ebec8
data/Guardfile CHANGED
@@ -5,20 +5,10 @@ guard :rspec do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
6
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
7
  watch('spec/spec_helper.rb') { "spec" }
8
-
9
- # Rails example
10
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
- watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
- watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
- watch('config/routes.rb') { "spec/routing" }
15
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
-
17
- # Capybara features specs
18
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
-
20
- # Turnip features and steps
21
- watch(%r{^spec/acceptance/(.+)\.feature$})
22
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
8
  end
24
9
 
10
+ guard 'cucumber' do
11
+ watch(%r{^features/.+\.feature$})
12
+ watch(%r{^features/support/.+$}) { 'features' }
13
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
14
+ end
data/README.md CHANGED
@@ -1,22 +1,22 @@
1
1
  # AkamaiApi
2
2
 
3
- AkamaiApi is a ruby library and command line utility to interact with Akamai CCU (Content Control Utility) and ECCU (Enhanced Content Control Utility) services.
3
+ __Now with CCU REST support!__
4
4
 
5
- __Note__: If you need ruby 1.8 compatibility or if you have any problem with the current release, try to use the [savon1](https://github.com/nicolaracco/akamai_api/tree/savon1) branch (or [version 0.0.7](https://github.com/nicolaracco/akamai_api/tree/v0.0.7))... and open a pull request, of course :-)
5
+ AkamaiApi is a ruby library and command line utility to interact with Akamai CCU (Content Control Utility) and ECCU (Enhanced Content Control Utility) services.
6
6
 
7
7
  # Using the CLI
8
8
 
9
9
  After gem installation you will have a CLI utility to execute operations on Akamai. Each method requires authentication. You can provide auth info using one of the following methods:
10
10
 
11
11
  - Passing --username (-u) and --password (-p) arguments at each invocation
12
- - Set ENV variables: AKAMAI_USERNAME and AKAMAI_PASSWORD
13
- - Creating a config file in your HOME directory named .akamai_api.yml with the following format:
12
+ - Set ENV variables: `AKAMAI_USERNAME` and `AKAMAI_PASSWORD`
13
+ - Creating a config file in your HOME directory named `.akamai_api.yml` with the following format:
14
14
 
15
15
  ```yaml
16
16
  auth:
17
17
  - user
18
18
  - pass
19
- log: true # optional for enabling logging. false by default
19
+ log: true # optional for enabling logging in ECCU requests. false by default
20
20
  ```
21
21
 
22
22
  ## Tasks
@@ -35,9 +35,10 @@ Use *akamai_api help* to view the help of the CLI.
35
35
  In the CCU interface you can work with CP Codes and ARLs.
36
36
 
37
37
  ```
38
- akamai_api ccu cpcode # CP Code CCU actions
39
- akamai_api ccu help [COMMAND] # Describe subcommands or one specific subcommand
40
- akamai_api ccu arl # ARL CCU actions
38
+ akamai_api ccu cpcode # CP Code CCU actions
39
+ akamai_api ccu help [COMMAND] # Describe subcommands or one specific subcommand
40
+ akamai_api ccu arl # ARL CCU actions
41
+ akamai_api ccu status [progress_uri] # Show the CCU queue status if no progress_uri is given, or show a CCU Purge request status if a progress uri is given
41
42
  ```
42
43
 
43
44
  ### CP Code
@@ -45,14 +46,12 @@ In the CCU interface you can work with CP Codes and ARLs.
45
46
  ```
46
47
  akamai_api ccu cpcode help [COMMAND] # Describe subcommands or one specific subcommand
47
48
  akamai_api ccu cpcode invalidate CPCODE1 CPCODE2 ... # Purge CP Code(s) marking their cache as expired
48
- akamai_api ccu cpcode list # Print the list of CP Codes
49
49
  akamai_api ccu cpcode remove CPCODE1 CPCODE2 ... # Purge CP Code(s) removing them from the cache
50
50
  ```
51
51
 
52
52
  When removing or invalidating a CP Code you can provide the following optional arguments:
53
53
 
54
54
  - *--domain*, *-d*: Specify if you want to work with *production* or *staging*. This is a completely optional argument and usually you don't need to set it.
55
- - *--emails*, *-e*: Specify the list of email used by Akamai to send notifications about the purge request.
56
55
 
57
56
  ### ARL
58
57
 
@@ -65,17 +64,43 @@ When removing or invalidating a CP Code you can provide the following optional a
65
64
  When removing or invalidating an ARL you can provide the following optional arguments:
66
65
 
67
66
  - *--domain*, *-d*: Specify if you want to work with *production* or *staging*. This is a completely optional argument and usually you don't need to set it.
68
- - *--emails*, *-e*: Specify the list of email used by Akamai to send notifications about the purge request.
67
+
68
+ ### Status
69
+
70
+ If you don't provide a `progress_uri` this command will print the CCU queue status. E.g.
71
+
72
+ ```bash
73
+ $ akamai_api ccu status
74
+ ------------
75
+ Status has been successfully received:
76
+ * Result: 200 - The queue may take a minute to reflect new or removed requests.
77
+ * Support ID: 12345678901234567890-123456789
78
+ * Queue Length: 0
79
+ ------------
80
+ ```
81
+
82
+ When you provide a `progress_uri` or a `purge_id` this command will print the CCU request status. E.g.
83
+
84
+ ```bash
85
+ $ akamai_api ccu status 12345678-1234-5678-1234-123456789012 # or you can pass /ccu/v2/purges/12345678-1234-5678-1234-123456789012
86
+ ------------
87
+ Status has been successfully received:
88
+ * Result: 200 - Done
89
+ * Purge ID: 12345678-1234-5678-1234-123456789012 | Support ID: 12345678901234567890-123456789
90
+ * Submitted by 'gawaine' on 2014-05-20 08:19:21 UTC
91
+ * Completed on: 2014-05-20 08:22:20 UTC
92
+ ------------
93
+ ```
69
94
 
70
95
  ## ECCU
71
96
 
72
97
  In the ECCU interface you can see the requestes already published and publish your own requests.
73
98
 
74
99
  ```
75
- akamai_api eccu help [COMMAND] # Describe subcommands or one specific subcommand
76
- akamai_api eccu last_request # Print the last request made to ECCU
100
+ akamai_api eccu help [COMMAND] # Describe subcommands or one specific subcommand
101
+ akamai_api eccu last_request # Print the last request made to ECCU
77
102
  akamai_api eccu publish_xml path/to/request.xml john.com # Publish a request made in XML for the specified Digital Property (usually the Host Header)
78
- akamai_api eccu requests # Print the list of the last requests made to ECCU
103
+ akamai_api eccu requests # Print the list of the last requests made to ECCU
79
104
  ```
80
105
 
81
106
  ### Viewing Requests
@@ -112,7 +137,7 @@ The command takes two arguments:
112
137
  Remember to init the AkamaiApi gem with your login credentials. You can set your credentials with the following statement:
113
138
 
114
139
  ```ruby
115
- AkamaiApi.config.merge! :auth => ['user', 'pass']
140
+ AkamaiApi.config.merge! :auth => ['user', 'pass']
116
141
  ```
117
142
 
118
143
  - CpCode: model representing a CP Code. Use the ::all method to retrieve the list of available CpCode.
@@ -121,43 +146,88 @@ Remember to init the AkamaiApi gem with your login credentials. You can set your
121
146
 
122
147
  ## Ccu
123
148
 
149
+ ### ::status
150
+
151
+ When no argument is given, this command will return a [`AkamaiApi::Ccu::Status::Response`](lib/akamai_api/ccu/status/response.rb) object describing the status of the Akamai CCU queue. E.g.
152
+
153
+ ```ruby
154
+ AkamaiApi::Ccu.status
155
+ # => #<AkamaiApi::Ccu::Status::Response:0x00000101167978 @raw={"supportId"=>"12345678901234567890-123456789", "httpStatus"=>200, "detail"=>"The queue may take a minute to reflect new or removed requests.", "queueLength"=>0}>
156
+ ```
157
+
158
+ When you pass a `progress_uri` or a `purge_id`, this command will check the given Akamai CCU request. E.g.
159
+
160
+ ```ruby
161
+ AkamaiApi::Ccu.status '/ccu/v2/purges/foobarbaz' # you can pass only 'foobarbaz' (the purge request id) as argument
162
+ # => #<AkamaiApi::Ccu::PurgeStatus::SuccessfulResponse:0x000001014da088
163
+ # @raw=
164
+ # {"originalEstimatedSeconds"=>480,
165
+ # "progressUri"=>"/ccu/v2/purges/12345678-1234-5678-1234-123456789012",
166
+ # "originalQueueLength"=>6,
167
+ # "purgeId"=>"12345678-1234-5678-1234-123456789012",
168
+ # "supportId"=>"12345678901234567890-123456789",
169
+ # "httpStatus"=>200,
170
+ # "completionTime"=>"2014-02-19T22:16:20Z",
171
+ # "submittedBy"=>"test1",
172
+ # "purgeStatus"=>"In-Progress",
173
+ # "submissionTime"=>"2014-02-19T21:16:20Z",
174
+ # "pingAfterSeconds"=>60}>
175
+ ```
176
+
177
+ It will return a [`AkamaiApi::Ccu::PurgeStatus::SuccessfulResponse`](lib/akamai_api/ccu/purge_status/successful_response.rb) object when a purge request is found, or a [`Akamai::Ccu::PurgeStatus::NotFoundResponse`](lib/akamai_api/ccu/purge_status/not_found_response.rb) when no request can be found.
178
+
124
179
  ### ::purge
125
180
 
126
181
  ```ruby
127
- def purge action, type, items, args = {}
128
- ...
129
- end
182
+ module AkamaiApi::Ccu
183
+ def purge action, type, items, args = {}
184
+ ...
185
+ end
186
+ end
130
187
  ```
131
188
 
132
- - action: symbol or string. It should be *remove* or *invalidate*. See the CLI documentation for more details
133
- - type: symbol or string. It should be *arl* or *cpcode*. Use arl to purge a list of urls, and cpcodes to purge a list of cp codes
134
- - items: the list of the resources to clean
135
- - args: additional options (email, domain)
189
+ - `action`: symbol or string. It should be *remove* or *invalidate*. See the CLI documentation for more details
190
+ - `type`: symbol or string. It should be *arl* or *cpcode*. Use arl to purge a list of urls, and cpcodes to purge a list of cp codes
191
+ - `items`: the list of the resources to clean
192
+ - `args`: additional options (domain)
193
+
194
+ It will return a [`AkamaiApi::Ccu::Purge::Response`](lib/akamai_api/ccu/purge/response.rb) object that you can use to retrieve the `progress_uri` (or the `purge_id`) of the request.
136
195
 
137
- e.g.
196
+ E.g.
138
197
 
139
198
  ```ruby
140
- AkamaiApi::Ccu.purge :remove, :arl, ['http://www.foo.com/a.txt'], :email => ['foo@foo.com']
199
+ AkamaiApi::Ccu.purge :remove, :arl, ['http://www.foo.com/a.txt'], :domain => 'staging'
200
+ # => #<AkamaiApi::Ccu::Purge::Response:0x00000101bf2848
201
+ # @raw=
202
+ # {"describedBy"=>"foo",
203
+ # "title"=>"bar",
204
+ # "pingAfterSeconds"=>100,
205
+ # "purgeId"=>"1234",
206
+ # "supportId"=>"130",
207
+ # "detail"=>"baz",
208
+ # "httpStatus"=>201,
209
+ # "estimatedSeconds"=>90,
210
+ # "progressUri"=>"/ccu/v2/purges/1234"}>
141
211
  ```
142
212
 
143
- ### Helpers
213
+ ### Purge Helpers
144
214
 
145
215
  ```ruby
146
- ccu = AkamaiApi::Ccu
216
+ ccu = AkamaiApi::Ccu
147
217
 
148
- ccu.invalidate_cpcode cpcodes # => wrapper to call .purge :invalidate, :cpcode
149
- ccu.invalidate_arl arls # => wrapper to call .purge :invalidate, :arl
150
- ccu.invalidate :arl, arls # => wrapper to call .purge :invalidate
218
+ ccu.invalidate_cpcode cpcodes # => wrapper to call .purge :invalidate, :cpcode
219
+ ccu.invalidate_arl arls # => wrapper to call .purge :invalidate, :arl
220
+ ccu.invalidate :arl, arls # => wrapper to call .purge :invalidate
151
221
 
152
- ccu.remove_cpcodes cpcodes # => wrapper to call .purge :remove, :cpcode
153
- ccu.remove_arl arls # => wrapper to call .purge :remove, :arl
154
- ccu.remove :arl # => wrapper to call .purge :remove
222
+ ccu.remove_cpcodes cpcodes # => wrapper to call .purge :remove, :cpcode
223
+ ccu.remove_arl arls # => wrapper to call .purge :remove, :arl
224
+ ccu.remove :arl # => wrapper to call .purge :remove
155
225
  ```
156
226
 
157
227
  ## EccuRequest
158
228
 
159
- An EccuRequest is an object representing an ECCU Request. To see all the published requests use the ::all method.
160
- To retrieve only the last request, you can use the ::last method.
229
+ An EccuRequest is an object representing an ECCU Request. To see all the published requests use the `::all` method.
230
+ To retrieve only the last request, you can use the `::last` method.
161
231
  The following code should be self explaining about both class methods and instance methods:
162
232
 
163
233
  ```ruby
@@ -184,7 +254,7 @@ You can specify the following optional arguments in args: file_name, notes, vers
184
254
  # Contributing
185
255
 
186
256
  - Clone this repository
187
- - Run 'bundle install --binstubs=bin/stubs'
257
+ - Run 'bundle install'
188
258
  - To run the specs, create the file spec/auth.rb with the following content:
189
259
 
190
260
  ```ruby
@@ -194,4 +264,4 @@ You can specify the following optional arguments in args: file_name, notes, vers
194
264
  })
195
265
  ```
196
266
 
197
- - Run specs with `thor spec` or use `guard`
267
+ - Run specs using `guard`. Alternatively you can execute the specs with `thor spec` and cucumber features with `cucumber`
data/Thorfile CHANGED
@@ -27,4 +27,9 @@ class Default < Thor
27
27
  def spec
28
28
  exec "rspec --color --format=documentation spec"
29
29
  end
30
+
31
+ desc "features", "Run Cucumber features"
32
+ def features
33
+ exec "cucumber"
34
+ end
30
35
  end
data/akamai_api.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'akamai_api/version'
@@ -18,11 +17,15 @@ Gem::Specification.new do |gem|
18
17
  gem.require_paths = ["lib"]
19
18
  gem.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
20
19
 
20
+ gem.add_dependency 'httparty', '~> 0.13.1'
21
21
  gem.add_dependency 'activesupport', '>= 2.3.9', '< 5.0'
22
22
  gem.add_dependency 'thor', '>= 0.14.0', '< 2.0'
23
23
  gem.add_dependency 'savon', '~> 2.3.0'
24
24
  gem.add_dependency 'builder', '~> 3.0'
25
25
 
26
- gem.add_development_dependency 'rspec', '~> 2.11'
27
- gem.add_development_dependency 'guard-rspec', '~> 3.0.2'
26
+ gem.add_development_dependency 'guard-rspec'
27
+ gem.add_development_dependency 'guard-cucumber'
28
+ gem.add_development_dependency 'aruba'
29
+ gem.add_development_dependency 'webmock'
30
+ gem.add_development_dependency 'vcr'
28
31
  end
data/bin/akamai_api CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require 'thor'
3
2
  require 'active_support/core_ext'
4
3
  require 'akamai_api'
5
4
  require 'akamai_api/cli'
6
5
 
7
- AkamaiApi::Cli::App.start
6
+ AkamaiApi::Cli::App.start
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://foo:bar@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"invalidate","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 401
15
+ message: Unauthorized
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 14:31:21 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '146'
23
+ Allow:
24
+ - GET, HEAD, POST
25
+ Www-Authenticate:
26
+ - Basic realm="Luna Control Center"
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - text/html;charset=utf-8
31
+ body:
32
+ encoding: UTF-8
33
+ string: <html><head><title>401 Unauthorized</title></head><body><p>401 Unauthorized</p><p>You
34
+ are not authorized to access that resource</p></body></html>
35
+ http_version:
36
+ recorded_at: Tue, 13 May 2014 14:31:21 GMT
37
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"invalidate","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 403
15
+ message: Forbidden
16
+ headers:
17
+ Date:
18
+ - Thu, 15 May 2014 06:51:09 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '209'
23
+ Allow:
24
+ - GET, HEAD, POST
25
+ Vary:
26
+ - Authorization
27
+ Content-Type:
28
+ - application/api-problem+json
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"supportId": "12345678901234567890-123456789", "title": "unauthorized
32
+ arl", "httpStatus": 403, "detail": "http://www.foo.com/bar.txt", "describedBy":
33
+ "https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl"}'
34
+ http_version:
35
+ recorded_at: Thu, 15 May 2014 06:51:12 GMT
36
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"invalidate","objects":["http://www.foo.com/bar.txt","http://www.foo.com/baz.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 201
15
+ message: Created
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 15:37:48 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '268'
23
+ Content-Location:
24
+ - /ccu/v2/purges/12345678-1234-5678-1234-123456789012
25
+ Allow:
26
+ - GET, HEAD, POST
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - application/json
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"estimatedSeconds": 420, "progressUri": "/ccu/v2/purges/12345678-1234-5678-1234-123456789012",
34
+ "purgeId": "12345678-1234-1234-1234-123456789012", "supportId": "12345678901234567890-123456789",
35
+ "httpStatus": 201, "detail": "Request accepted.", "pingAfterSeconds": 420}'
36
+ http_version:
37
+ recorded_at: Tue, 13 May 2014 15:37:49 GMT
38
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"invalidate","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 201
15
+ message: Created
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 15:37:48 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '268'
23
+ Content-Location:
24
+ - /ccu/v2/purges/12345678-1234-5678-1234-123456789012
25
+ Allow:
26
+ - GET, HEAD, POST
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - application/json
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"estimatedSeconds": 420, "progressUri": "/ccu/v2/purges/12345678-1234-5678-1234-123456789012",
34
+ "purgeId": "12345678-1234-1234-1234-123456789012", "supportId": "12345678901234567890-123456789",
35
+ "httpStatus": 201, "detail": "Request accepted.", "pingAfterSeconds": 420}'
36
+ http_version:
37
+ recorded_at: Tue, 13 May 2014 15:37:49 GMT
38
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://foo:bar@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"remove","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 401
15
+ message: Unauthorized
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 14:31:21 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '146'
23
+ Allow:
24
+ - GET, HEAD, POST
25
+ Www-Authenticate:
26
+ - Basic realm="Luna Control Center"
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - text/html;charset=utf-8
31
+ body:
32
+ encoding: UTF-8
33
+ string: <html><head><title>401 Unauthorized</title></head><body><p>401 Unauthorized</p><p>You
34
+ are not authorized to access that resource</p></body></html>
35
+ http_version:
36
+ recorded_at: Tue, 13 May 2014 14:31:21 GMT
37
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"remove","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 403
15
+ message: Forbidden
16
+ headers:
17
+ Date:
18
+ - Thu, 15 May 2014 06:51:09 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '209'
23
+ Allow:
24
+ - GET, HEAD, POST
25
+ Vary:
26
+ - Authorization
27
+ Content-Type:
28
+ - application/api-problem+json
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"supportId": "12345678901234567890-123456789", "title": "unauthorized
32
+ arl", "httpStatus": 403, "detail": "http://www.foo.com/bar.txt", "describedBy":
33
+ "https://api.ccu.akamai.com/ccu/v2/errors/unauthorized-arl"}'
34
+ http_version:
35
+ recorded_at: Thu, 15 May 2014 06:51:12 GMT
36
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"remove","objects":["http://www.foo.com/bar.txt","http://www.foo.com/baz.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 201
15
+ message: Created
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 15:37:48 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '268'
23
+ Content-Location:
24
+ - /ccu/v2/purges/12345678-1234-5678-1234-123456789012
25
+ Allow:
26
+ - GET, HEAD, POST
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - application/json
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"estimatedSeconds": 420, "progressUri": "/ccu/v2/purges/12345678-1234-5678-1234-123456789012",
34
+ "purgeId": "12345678-1234-1234-1234-123456789012", "supportId": "12345678901234567890-123456789",
35
+ "httpStatus": 201, "detail": "Request accepted.", "pingAfterSeconds": 420}'
36
+ http_version:
37
+ recorded_at: Tue, 13 May 2014 15:37:49 GMT
38
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://USERNAME:PASSWORD@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"arl","action":"remove","objects":["http://www.foo.com/bar.txt"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 201
15
+ message: Created
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 15:37:48 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '268'
23
+ Content-Location:
24
+ - /ccu/v2/purges/12345678-1234-5678-1234-123456789012
25
+ Allow:
26
+ - GET, HEAD, POST
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - application/json
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"estimatedSeconds": 420, "progressUri": "/ccu/v2/purges/12345678-1234-5678-1234-123456789012",
34
+ "purgeId": "12345678-1234-1234-1234-123456789012", "supportId": "12345678901234567890-123456789",
35
+ "httpStatus": 201, "detail": "Request accepted.", "pingAfterSeconds": 420}'
36
+ http_version:
37
+ recorded_at: Tue, 13 May 2014 15:37:49 GMT
38
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://foo:bar@api.ccu.akamai.com/ccu/v2/queues/default/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"type":"cpcode","action":"invalidate","objects":["12345"]}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 401
15
+ message: Unauthorized
16
+ headers:
17
+ Date:
18
+ - Tue, 13 May 2014 14:31:21 GMT
19
+ Server:
20
+ - Apache
21
+ Content-Length:
22
+ - '146'
23
+ Allow:
24
+ - GET, HEAD, POST
25
+ Www-Authenticate:
26
+ - Basic realm="Luna Control Center"
27
+ Vary:
28
+ - Authorization
29
+ Content-Type:
30
+ - text/html;charset=utf-8
31
+ body:
32
+ encoding: UTF-8
33
+ string: <html><head><title>401 Unauthorized</title></head><body><p>401 Unauthorized</p><p>You
34
+ are not authorized to access that resource</p></body></html>
35
+ http_version:
36
+ recorded_at: Tue, 13 May 2014 14:31:21 GMT
37
+ recorded_with: VCR 2.9.0