fog-akamai 0.1.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.
- checksums.yaml +7 -0
 - data/.gitignore +18 -0
 - data/.ruby-gemset +1 -0
 - data/.ruby-version +1 -0
 - data/.travis.yml +45 -0
 - data/CONTRIBUTING.md +19 -0
 - data/CONTRIBUTORS.md +2 -0
 - data/Gemfile +6 -0
 - data/LICENSE.md +21 -0
 - data/README.md +36 -0
 - data/Rakefile +11 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/fog-akamai.gemspec +33 -0
 - data/gemfiles/Gemfile-edge +10 -0
 - data/gemfiles/Gemfile-ruby-1.8.7 +7 -0
 - data/lib/fog/akamai/models/storage/directories.rb +18 -0
 - data/lib/fog/akamai/models/storage/directory.rb +18 -0
 - data/lib/fog/akamai/models/storage/file.rb +35 -0
 - data/lib/fog/akamai/models/storage/files.rb +28 -0
 - data/lib/fog/akamai/parsers/storage/dir.rb +33 -0
 - data/lib/fog/akamai/requests/storage/dir.rb +26 -0
 - data/lib/fog/akamai/requests/storage/download.rb +22 -0
 - data/lib/fog/akamai/requests/storage/stat.rb +26 -0
 - data/lib/fog/akamai/requests/storage/upload.rb +27 -0
 - data/lib/fog/akamai/storage.rb +112 -0
 - data/lib/fog/akamai/version.rb +5 -0
 - data/lib/fog/akamai.rb +24 -0
 - metadata +199 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0fd6496beeb81adaf17b9c531670a5fc4d29cbd6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 17398769af5612dbfbc314845a84feced0843552
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 95ab846e7491dfd361f61ab744641efd98c2401f5c9f4b296cbc8d058bcad4caad01b3401e3574288b49c4ff970e89ff7ab63177bcbf6a8541d29da83628070f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 02df2e86430f927c848b427075af5e8327730ff41a15795242afb6ebe0890465b9ebd82fac9d679bb92edb442b1150bc4c400bc1116ea0807f8fc5f62dd26507
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.ruby-gemset
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            fog-akamai
         
     | 
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ruby-2.2.3
         
     | 
    
        data/.travis.yml
    ADDED
    
    | 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            nguage: ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            sudo: false
         
     | 
| 
      
 3 
     | 
    
         
            +
            script: bundle exec rake test
         
     | 
| 
      
 4 
     | 
    
         
            +
            branches:
         
     | 
| 
      
 5 
     | 
    
         
            +
              except:
         
     | 
| 
      
 6 
     | 
    
         
            +
              - "/\\Av\\d+\\Z/"
         
     | 
| 
      
 7 
     | 
    
         
            +
            matrix:
         
     | 
| 
      
 8 
     | 
    
         
            +
              fast_finish: true
         
     | 
| 
      
 9 
     | 
    
         
            +
              include:
         
     | 
| 
      
 10 
     | 
    
         
            +
              - rvm: 1.8.7
         
     | 
| 
      
 11 
     | 
    
         
            +
                gemfile: gemfiles/Gemfile-ruby-1.8.7
         
     | 
| 
      
 12 
     | 
    
         
            +
              - rvm: 1.9.3
         
     | 
| 
      
 13 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 14 
     | 
    
         
            +
              - rvm: 2.0.0
         
     | 
| 
      
 15 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 16 
     | 
    
         
            +
              - rvm: 2.1.0
         
     | 
| 
      
 17 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 18 
     | 
    
         
            +
              - rvm: 2.1.1
         
     | 
| 
      
 19 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 20 
     | 
    
         
            +
              - rvm: 2.1.1
         
     | 
| 
      
 21 
     | 
    
         
            +
                gemfile: gemfiles/Gemfile-edge
         
     | 
| 
      
 22 
     | 
    
         
            +
              - rvm: 2.2.0
         
     | 
| 
      
 23 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 24 
     | 
    
         
            +
              - rvm: 2.2.0
         
     | 
| 
      
 25 
     | 
    
         
            +
                gemfile: gemfiles/Gemfile-edge
         
     | 
| 
      
 26 
     | 
    
         
            +
              - rvm: jruby-18mode
         
     | 
| 
      
 27 
     | 
    
         
            +
                gemfile: gemfiles/Gemfile-ruby-1.8.7
         
     | 
| 
      
 28 
     | 
    
         
            +
              - rvm: jruby-19mode
         
     | 
| 
      
 29 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 30 
     | 
    
         
            +
              - rvm: jruby-head
         
     | 
| 
      
 31 
     | 
    
         
            +
                gemfile: Gemfile
         
     | 
| 
      
 32 
     | 
    
         
            +
              allow_failures:
         
     | 
| 
      
 33 
     | 
    
         
            +
              - rvm: jruby-head
         
     | 
| 
      
 34 
     | 
    
         
            +
            notifications:
         
     | 
| 
      
 35 
     | 
    
         
            +
              email: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              irc:
         
     | 
| 
      
 37 
     | 
    
         
            +
                channels:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - irc.freenode.org#ruby-fog
         
     | 
| 
      
 39 
     | 
    
         
            +
                template:
         
     | 
| 
      
 40 
     | 
    
         
            +
                - "[#%{build_number}] %{message} %{build_url}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                - "[#%{build_number}] %{commit} on %{branch} by %{author}"
         
     | 
| 
      
 42 
     | 
    
         
            +
                - "[#%{build_number}] %{compare_url}"
         
     | 
| 
      
 43 
     | 
    
         
            +
                on_success: always
         
     | 
| 
      
 44 
     | 
    
         
            +
                on_failure: always
         
     | 
| 
      
 45 
     | 
    
         
            +
                use_notice: false
         
     | 
    
        data/CONTRIBUTING.md
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## Getting Involved
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### Coding
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * Pick a task:
         
     | 
| 
      
 8 
     | 
    
         
            +
              * Offer feedback on open [pull requests](https://github.com/alexandru-calinoiu/fog-akamai/pulls).
         
     | 
| 
      
 9 
     | 
    
         
            +
              * Review open [issues](https://github.com/alexandru-calinoiu/fog-akamai/issues) for things to help on.
         
     | 
| 
      
 10 
     | 
    
         
            +
              * [Create an issue](https://github.com/alexandru-calinoiu/fog-akamai/issues/new) to start a discussion on additions or features.
         
     | 
| 
      
 11 
     | 
    
         
            +
            * Fork the project, add your changes and tests to cover them in a topic branch.
         
     | 
| 
      
 12 
     | 
    
         
            +
            * Commit your changes and rebase against `fog/fog` to ensure everything is up to date.
         
     | 
| 
      
 13 
     | 
    
         
            +
            * [Submit a pull request](https://github.com/alexandru-calinoiu/fog-akamai/compare/).
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ### Non-Coding
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            * Offer feedback on open [issues](https://github.com/alexandru-calinoiu/fog-akamai/issues).
         
     | 
| 
      
 18 
     | 
    
         
            +
            * Organize or volunteer at events.
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
    
        data/CONTRIBUTORS.md
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.md
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2014-2015 [CONTRIBUTORS.md](https://github.com/fog/fog/blob/master/CONTRIBUTORS.md)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy of
         
     | 
| 
      
 6 
     | 
    
         
            +
            this software and associated documentation files (the "Software"), to deal in
         
     | 
| 
      
 7 
     | 
    
         
            +
            the Software without restriction, including without limitation the rights to
         
     | 
| 
      
 8 
     | 
    
         
            +
            use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
         
     | 
| 
      
 9 
     | 
    
         
            +
            the Software, and to permit persons to whom the Software is furnished to do so,
         
     | 
| 
      
 10 
     | 
    
         
            +
            subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
         
     | 
| 
      
 17 
     | 
    
         
            +
            FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
         
     | 
| 
      
 18 
     | 
    
         
            +
            COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
         
     | 
| 
      
 20 
     | 
    
         
            +
            CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Fog::Storage
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fog/storage`. To experiment with that code, run `bin/console` for an interactive prompt.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            TODO: Delete this and the text above, and describe your gem
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'fog-akamai'
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                $ gem install fog-akamai
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/alexandru-calinoiu/fog-akamai.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "fog/akamai"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/fog-akamai.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'fog/akamai/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'fog-akamai'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Fog::Akamai::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Calin']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['calinoiu.alexandru@agilefreaks.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.summary       = %q{Module for 'fog' gem to support Akamai}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.description   = %q{This library can be used as a module for `fog` or as standalone provider
         
     | 
| 
      
 15 
     | 
    
         
            +
                                    to use Akamai}
         
     | 
| 
      
 16 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/alexandru-calinoiu/fog-akamai'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.bindir        = 'exe'
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.10'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency 'minitest', '~> 5.8'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency 'minitest-reporters', '~> 1.1'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency 'test-unit', '~> 3.1'
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency 'webmock', '~> 1.22'
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_dependency 'fog-core',  '~> 1.27'
         
     | 
| 
      
 31 
     | 
    
         
            +
              spec.add_dependency 'fog-json',  '~> 1.0'
         
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_dependency 'fog-xml',   '~> 0.1'
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Directories < Fog::Collection
         
     | 
| 
      
 5 
     | 
    
         
            +
                    model Fog::Storage::Akamai::Directory
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    def get(key)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      data = service.dir(key).body
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                      directory = new(:key => data[:directory].sub("/#{service.akamai_cp_code}", ''))
         
     | 
| 
      
 11 
     | 
    
         
            +
                      directory.files.load(data[:files].map { |file| file.merge(:directory => directory) })
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                      directory
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Directory < Fog::Model
         
     | 
| 
      
 5 
     | 
    
         
            +
                    identity :key
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    attribute :parent
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    def files
         
     | 
| 
      
 10 
     | 
    
         
            +
                      @files ||= Fog::Storage::Akamai::Files.new(
         
     | 
| 
      
 11 
     | 
    
         
            +
                        :directory => self,
         
     | 
| 
      
 12 
     | 
    
         
            +
                        :service => service
         
     | 
| 
      
 13 
     | 
    
         
            +
                      )
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
               module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                 class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                   class File < Fog::Model
         
     | 
| 
      
 5 
     | 
    
         
            +
                     include Fog::Akamai::Shared
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                     identity :key, :aliases => 'name'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                     attribute :directory
         
     | 
| 
      
 10 
     | 
    
         
            +
                     attribute :name
         
     | 
| 
      
 11 
     | 
    
         
            +
                     attribute :mtime
         
     | 
| 
      
 12 
     | 
    
         
            +
                     attribute :md5
         
     | 
| 
      
 13 
     | 
    
         
            +
                     attribute :size
         
     | 
| 
      
 14 
     | 
    
         
            +
                     attribute :body
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                     def get(key)
         
     | 
| 
      
 17 
     | 
    
         
            +
                       requires :directory
         
     | 
| 
      
 18 
     | 
    
         
            +
                     end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                     def save
         
     | 
| 
      
 21 
     | 
    
         
            +
                       requires :body, :directory, :key
         
     | 
| 
      
 22 
     | 
    
         
            +
                       service.upload(full_path(key, directory), body)
         
     | 
| 
      
 23 
     | 
    
         
            +
                     end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                     def destroy
         
     | 
| 
      
 26 
     | 
    
         
            +
                       requires :directory, :key
         
     | 
| 
      
 27 
     | 
    
         
            +
                     end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                     def ready?
         
     | 
| 
      
 30 
     | 
    
         
            +
                       true
         
     | 
| 
      
 31 
     | 
    
         
            +
                     end
         
     | 
| 
      
 32 
     | 
    
         
            +
                   end
         
     | 
| 
      
 33 
     | 
    
         
            +
                 end
         
     | 
| 
      
 34 
     | 
    
         
            +
               end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Files < Fog::Collection
         
     | 
| 
      
 5 
     | 
    
         
            +
                    include Fog::Akamai::Shared
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    model Fog::Storage::Akamai::File
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    attribute :directory
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    def all
         
     | 
| 
      
 12 
     | 
    
         
            +
                      requires :directory
         
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    def get(path)
         
     | 
| 
      
 16 
     | 
    
         
            +
                      body = service.download(full_path(path, directory)).data[:body]
         
     | 
| 
      
 17 
     | 
    
         
            +
                      new(:body => body)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    def stat(path)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      new(service.stat(full_path(path, directory)).data[:body][:files].first)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    rescue Excon::Errors::NotFound
         
     | 
| 
      
 23 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Parsers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Storage
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module Akamai
         
     | 
| 
      
 5 
     | 
    
         
            +
                    class Dir < Fog::Parsers::Base
         
     | 
| 
      
 6 
     | 
    
         
            +
                      def reset
         
     | 
| 
      
 7 
     | 
    
         
            +
                        @response = { :directory => '', :files => [] }
         
     | 
| 
      
 8 
     | 
    
         
            +
                      end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                      def start_element(name, attrs = [])
         
     | 
| 
      
 11 
     | 
    
         
            +
                        case name
         
     | 
| 
      
 12 
     | 
    
         
            +
                          when 'stat'
         
     | 
| 
      
 13 
     | 
    
         
            +
                            @response[:directory] = attrs.first.value
         
     | 
| 
      
 14 
     | 
    
         
            +
                          when 'file'
         
     | 
| 
      
 15 
     | 
    
         
            +
                            @response[:files] << attrs_to_hash(attrs) if is_file?(attrs)
         
     | 
| 
      
 16 
     | 
    
         
            +
                        end
         
     | 
| 
      
 17 
     | 
    
         
            +
                      end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                      private
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                        def is_file?(attrs)
         
     | 
| 
      
 22 
     | 
    
         
            +
                          attrs.any? { |attr| attr.localname == 'type' && attr.value == 'file' }
         
     | 
| 
      
 23 
     | 
    
         
            +
                        end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                        def attrs_to_hash(attrs)
         
     | 
| 
      
 26 
     | 
    
         
            +
                          attrs.inject({}) { |result, attr| result.merge(attr.localname => attr.value) }
         
     | 
| 
      
 27 
     | 
    
         
            +
                        end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Real
         
     | 
| 
      
 5 
     | 
    
         
            +
                    require 'fog/akamai/parsers/storage/dir'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    def dir(path = nil)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      path ||= ''
         
     | 
| 
      
 9 
     | 
    
         
            +
                      request(:dir,
         
     | 
| 
      
 10 
     | 
    
         
            +
                              {
         
     | 
| 
      
 11 
     | 
    
         
            +
                                :path => format_path(path),
         
     | 
| 
      
 12 
     | 
    
         
            +
                                :method => 'GET',
         
     | 
| 
      
 13 
     | 
    
         
            +
                                :expects => 200,
         
     | 
| 
      
 14 
     | 
    
         
            +
                                :parser => Fog::Parsers::Storage::Akamai::Dir.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                              })
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  class Mock
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def dir
         
     | 
| 
      
 21 
     | 
    
         
            +
                      raise Fog::Mock.not_implemented
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Real
         
     | 
| 
      
 5 
     | 
    
         
            +
                    def download(path)
         
     | 
| 
      
 6 
     | 
    
         
            +
                      request(:download,
         
     | 
| 
      
 7 
     | 
    
         
            +
                              {
         
     | 
| 
      
 8 
     | 
    
         
            +
                                :path => format_path(path),
         
     | 
| 
      
 9 
     | 
    
         
            +
                                :method => 'GET',
         
     | 
| 
      
 10 
     | 
    
         
            +
                                :expects => 200
         
     | 
| 
      
 11 
     | 
    
         
            +
                              })
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  class Mock
         
     | 
| 
      
 16 
     | 
    
         
            +
                    def download(path)
         
     | 
| 
      
 17 
     | 
    
         
            +
                      raise Fog::Mock.not_implemented
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Real
         
     | 
| 
      
 5 
     | 
    
         
            +
                    require 'fog/akamai/parsers/storage/dir'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    def stat(path)
         
     | 
| 
      
 8 
     | 
    
         
            +
                      raise ArgumentError.new('path needs to have a value') if path.empty?
         
     | 
| 
      
 9 
     | 
    
         
            +
                      request(:stat,
         
     | 
| 
      
 10 
     | 
    
         
            +
                              {
         
     | 
| 
      
 11 
     | 
    
         
            +
                                :path => format_path(path),
         
     | 
| 
      
 12 
     | 
    
         
            +
                                :method => 'GET',
         
     | 
| 
      
 13 
     | 
    
         
            +
                                :expects => 200,
         
     | 
| 
      
 14 
     | 
    
         
            +
                                :parser => Fog::Parsers::Storage::Akamai::Dir.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                              })
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  class Mock
         
     | 
| 
      
 20 
     | 
    
         
            +
                    def stat(path)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      raise Fog::Mock.not_implemented
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Real
         
     | 
| 
      
 5 
     | 
    
         
            +
                    def upload(path, body)
         
     | 
| 
      
 6 
     | 
    
         
            +
                      raise ArgumentError('path is required') if path.empty?
         
     | 
| 
      
 7 
     | 
    
         
            +
                      raise ArgumentError('body is required') if body == nil
         
     | 
| 
      
 8 
     | 
    
         
            +
                      data = Fog::Storage.parse_data(body)
         
     | 
| 
      
 9 
     | 
    
         
            +
                      request(:upload,
         
     | 
| 
      
 10 
     | 
    
         
            +
                              {
         
     | 
| 
      
 11 
     | 
    
         
            +
                                :path => format_path(path),
         
     | 
| 
      
 12 
     | 
    
         
            +
                                :method => 'PUT',
         
     | 
| 
      
 13 
     | 
    
         
            +
                                :headers => data[:headers],
         
     | 
| 
      
 14 
     | 
    
         
            +
                                :body => data[:body],
         
     | 
| 
      
 15 
     | 
    
         
            +
                                :expects => 200
         
     | 
| 
      
 16 
     | 
    
         
            +
                              })
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  class Mock
         
     | 
| 
      
 21 
     | 
    
         
            +
                    def upload(path, body)
         
     | 
| 
      
 22 
     | 
    
         
            +
                      raise Fog::Mock.not_implementedend
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,112 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Akamai < Fog::Service
         
     | 
| 
      
 4 
     | 
    
         
            +
                  requires :akamai_host, :akamai_key_name, :akamai_key, :akamai_cp_code
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  VALID_ACTIONS = [:dir, :download, :stat, :upload]
         
     | 
| 
      
 7 
     | 
    
         
            +
                  ACS_AUTH_DATA_HEADER = 'X-Akamai-ACS-Auth-Data'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  ACS_AUTH_SIGN_HEADER = 'X-Akamai-ACS-Auth-Sign'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  ACS_AUTH_ACTION_HEADER = 'X-Akamai-ACS-Action'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  model_path 'fog/akamai/models/storage'
         
     | 
| 
      
 12 
     | 
    
         
            +
                  collection :directories
         
     | 
| 
      
 13 
     | 
    
         
            +
                  model :directory
         
     | 
| 
      
 14 
     | 
    
         
            +
                  collection :files
         
     | 
| 
      
 15 
     | 
    
         
            +
                  model :file
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  request_path 'fog/akamai/requests/storage'
         
     | 
| 
      
 18 
     | 
    
         
            +
                  request :dir
         
     | 
| 
      
 19 
     | 
    
         
            +
                  request :download
         
     | 
| 
      
 20 
     | 
    
         
            +
                  request :stat
         
     | 
| 
      
 21 
     | 
    
         
            +
                  request :upload
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  module Helpers
         
     | 
| 
      
 24 
     | 
    
         
            +
                    def format_path(path)
         
     | 
| 
      
 25 
     | 
    
         
            +
                      ["/#{akamai_cp_code}", path].reject(&:empty?).join
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  class Mock
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  class Real
         
     | 
| 
      
 33 
     | 
    
         
            +
                    include Helpers
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    attr_reader :akamai_key, :akamai_host, :akamai_cp_code, :akamai_key_name, :scheme, :port
         
     | 
| 
      
 36 
     | 
    
         
            +
                    # Initialize connection to Akamai
         
     | 
| 
      
 37 
     | 
    
         
            +
                    #
         
     | 
| 
      
 38 
     | 
    
         
            +
                    # ==== Notes
         
     | 
| 
      
 39 
     | 
    
         
            +
                    # options parameter must include values for :akamai_host, :akamai_key_name,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    # :akamai_key and :akamai_cp_code in order to create a connection
         
     | 
| 
      
 41 
     | 
    
         
            +
                    #
         
     | 
| 
      
 42 
     | 
    
         
            +
                    # ==== Examples
         
     | 
| 
      
 43 
     | 
    
         
            +
                    #   akamai_storage = Storage.new(
         
     | 
| 
      
 44 
     | 
    
         
            +
                    #     :akamai_host => your_akamai_host_name,
         
     | 
| 
      
 45 
     | 
    
         
            +
                    #     :akamai_key_name => you_akamai_key_name,
         
     | 
| 
      
 46 
     | 
    
         
            +
                    #     :akamai_key => you_akamai_key,
         
     | 
| 
      
 47 
     | 
    
         
            +
                    #     :akamai_cp_code => your_cp_code
         
     | 
| 
      
 48 
     | 
    
         
            +
                    #   )
         
     | 
| 
      
 49 
     | 
    
         
            +
                    #
         
     | 
| 
      
 50 
     | 
    
         
            +
                    # ==== Parameters
         
     | 
| 
      
 51 
     | 
    
         
            +
                    # * options<~Hash> - config arguments for connection.  Defaults to {}.
         
     | 
| 
      
 52 
     | 
    
         
            +
                    #
         
     | 
| 
      
 53 
     | 
    
         
            +
                    # ==== Returns
         
     | 
| 
      
 54 
     | 
    
         
            +
                    # * Storage object for akamai.
         
     | 
| 
      
 55 
     | 
    
         
            +
                    def initialize(options = {})
         
     | 
| 
      
 56 
     | 
    
         
            +
                      @akamai_host = options[:akamai_host]
         
     | 
| 
      
 57 
     | 
    
         
            +
                      @akamai_key_name = options[:akamai_key_name]
         
     | 
| 
      
 58 
     | 
    
         
            +
                      @akamai_key = options[:akamai_key]
         
     | 
| 
      
 59 
     | 
    
         
            +
                      @akamai_cp_code = options[:akamai_cp_code]
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                      @scheme = options[:scheme] || 'https'
         
     | 
| 
      
 62 
     | 
    
         
            +
                      @port = options[:port] || 443
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    def acs_auth_data
         
     | 
| 
      
 66 
     | 
    
         
            +
                      version = '5'
         
     | 
| 
      
 67 
     | 
    
         
            +
                      reserved_field1 = '0.0.0.0'
         
     | 
| 
      
 68 
     | 
    
         
            +
                      reserved_field2 = '0.0.0.0'
         
     | 
| 
      
 69 
     | 
    
         
            +
                      time = Time.now.to_i.to_s
         
     | 
| 
      
 70 
     | 
    
         
            +
                      unique_id = SecureRandom.uuid
         
     | 
| 
      
 71 
     | 
    
         
            +
                      [version, reserved_field1, reserved_field2, time, unique_id, akamai_key_name].join(', ')
         
     | 
| 
      
 72 
     | 
    
         
            +
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                    def acs_action(action)
         
     | 
| 
      
 75 
     | 
    
         
            +
                      raise ArgumentError.new("Invalid action #{action} valid actions are: #{VALID_ACTIONS}") unless VALID_ACTIONS.include?(action)
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                      "version=1&action=#{action}&format=xml"
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                    def acs_auth_sign(auth_data, path, action)
         
     | 
| 
      
 81 
     | 
    
         
            +
                      data = auth_data + sign_string(path, action)
         
     | 
| 
      
 82 
     | 
    
         
            +
                      digest = OpenSSL::Digest::Digest::SHA256.new
         
     | 
| 
      
 83 
     | 
    
         
            +
                      Base64.encode64(OpenSSL::HMAC.digest(digest, akamai_key, data)).strip()
         
     | 
| 
      
 84 
     | 
    
         
            +
                    end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                    private
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                      def request(action, params)
         
     | 
| 
      
 89 
     | 
    
         
            +
                        url = "#{scheme}://#{akamai_host}:#{port}"
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                        path = params[:path]
         
     | 
| 
      
 92 
     | 
    
         
            +
                        auth_data = acs_auth_data
         
     | 
| 
      
 93 
     | 
    
         
            +
                        auth_sign = acs_auth_sign(auth_data, path, action)
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                        headers = {
         
     | 
| 
      
 96 
     | 
    
         
            +
                          ACS_AUTH_DATA_HEADER => auth_data,
         
     | 
| 
      
 97 
     | 
    
         
            +
                          ACS_AUTH_SIGN_HEADER => auth_sign,
         
     | 
| 
      
 98 
     | 
    
         
            +
                          ACS_AUTH_ACTION_HEADER => acs_action(action)
         
     | 
| 
      
 99 
     | 
    
         
            +
                        }.merge(params[:headers] || {})
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                        params = params.merge(headers: headers)
         
     | 
| 
      
 102 
     | 
    
         
            +
                        Fog::XML::Connection.new(url).request(params)
         
     | 
| 
      
 103 
     | 
    
         
            +
                      end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                      def sign_string(path, action)
         
     | 
| 
      
 106 
     | 
    
         
            +
                        action = "x-akamai-acs-action:#{acs_action(action)}\n"
         
     | 
| 
      
 107 
     | 
    
         
            +
                        "#{path}\n#{action}"
         
     | 
| 
      
 108 
     | 
    
         
            +
                      end
         
     | 
| 
      
 109 
     | 
    
         
            +
                  end
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/fog/akamai.rb
    ADDED
    
    | 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fog/core'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fog/xml'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'fog/akamai/version'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Fog
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Storage
         
     | 
| 
      
 7 
     | 
    
         
            +
                autoload :Akamai, 'fog/akamai/storage'
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              module Akamai
         
     | 
| 
      
 11 
     | 
    
         
            +
                extend Fog::Provider
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                service(:storage, 'Storage')
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                module Shared
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def full_path(path, directory = nil)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    if directory
         
     | 
| 
      
 18 
     | 
    
         
            +
                      path = [directory.key, path].join('/')
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                    path
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,199 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: fog-akamai
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Calin
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-11-04 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: minitest
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '5.8'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '5.8'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: minitest-reporters
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: test-unit
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '3.1'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '3.1'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: webmock
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '1.22'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '1.22'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: fog-core
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '1.27'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '1.27'
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: fog-json
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: fog-xml
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 139 
     | 
    
         
            +
            description: |-
         
     | 
| 
      
 140 
     | 
    
         
            +
              This library can be used as a module for `fog` or as standalone provider
         
     | 
| 
      
 141 
     | 
    
         
            +
                                      to use Akamai
         
     | 
| 
      
 142 
     | 
    
         
            +
            email:
         
     | 
| 
      
 143 
     | 
    
         
            +
            - calinoiu.alexandru@agilefreaks.com
         
     | 
| 
      
 144 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 145 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 146 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 147 
     | 
    
         
            +
            files:
         
     | 
| 
      
 148 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 149 
     | 
    
         
            +
            - ".ruby-gemset"
         
     | 
| 
      
 150 
     | 
    
         
            +
            - ".ruby-version"
         
     | 
| 
      
 151 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 152 
     | 
    
         
            +
            - CONTRIBUTING.md
         
     | 
| 
      
 153 
     | 
    
         
            +
            - CONTRIBUTORS.md
         
     | 
| 
      
 154 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 155 
     | 
    
         
            +
            - LICENSE.md
         
     | 
| 
      
 156 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 157 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 158 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 159 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 160 
     | 
    
         
            +
            - fog-akamai.gemspec
         
     | 
| 
      
 161 
     | 
    
         
            +
            - gemfiles/Gemfile-edge
         
     | 
| 
      
 162 
     | 
    
         
            +
            - gemfiles/Gemfile-ruby-1.8.7
         
     | 
| 
      
 163 
     | 
    
         
            +
            - lib/fog/akamai.rb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - lib/fog/akamai/models/storage/directories.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - lib/fog/akamai/models/storage/directory.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - lib/fog/akamai/models/storage/file.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - lib/fog/akamai/models/storage/files.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - lib/fog/akamai/parsers/storage/dir.rb
         
     | 
| 
      
 169 
     | 
    
         
            +
            - lib/fog/akamai/requests/storage/dir.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - lib/fog/akamai/requests/storage/download.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - lib/fog/akamai/requests/storage/stat.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib/fog/akamai/requests/storage/upload.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            - lib/fog/akamai/storage.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - lib/fog/akamai/version.rb
         
     | 
| 
      
 175 
     | 
    
         
            +
            homepage: https://github.com/alexandru-calinoiu/fog-akamai
         
     | 
| 
      
 176 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 177 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 178 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 179 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 180 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 181 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 182 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 183 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 184 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 185 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 186 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 187 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 188 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 189 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 190 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 191 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 192 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 193 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 194 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 195 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
      
 196 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 197 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 198 
     | 
    
         
            +
            summary: Module for 'fog' gem to support Akamai
         
     | 
| 
      
 199 
     | 
    
         
            +
            test_files: []
         
     |