bunny_cdn 1.1.1 → 1.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.
- checksums.yaml +4 -4
 - data/README.md +13 -0
 - data/lib/bunny_cdn/storage.rb +19 -1
 - data/lib/bunny_cdn/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7c39cfb456030b3e4c3d329031894dbb9280ed683857cc87c9415ffaf9af5a6b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1e9d967f43084c2c95fff77d546e8eb7662204c2c81107e58583fa5a9e3c14fe
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5eef510c1c3ac8e9faaaef962e22659d36e677d3f5f3845419279a7ab883d58b14aa9dec2fbd5c750a5ab8dab6261ba85bf12c6090921127e15dc94279d96cb9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3427d6dd04a628fac91c642c62a26c2627ae9ee7fb14f659e37c80057c28795fcbd72c012e52c866df6398e9d6b8e33506869195d1a7f25cb37d9825e2914ded
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -39,6 +39,19 @@ BunnyCdn.configure do |config| 
     | 
|
| 
       39 
39 
     | 
    
         
             
            end
         
     | 
| 
       40 
40 
     | 
    
         
             
            ```
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
      
 42 
     | 
    
         
            +
            ### File Uploads
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            New to v1.2.0, there are now two methods for handling file uploads. 
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            To upload a file from a file input on a form, simply use 
         
     | 
| 
      
 47 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 48 
     | 
    
         
            +
            BunnyCdn::Storage.uploadFormFile(path, file)
         
     | 
| 
      
 49 
     | 
    
         
            +
            ```
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            To upload a file to BunnyCDN that already exists on the system, or to upload a file as a secondary option to storing it on the system use
         
     | 
| 
      
 52 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 53 
     | 
    
         
            +
            BunnyCdn::Storage.uploadFile(path, file)
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
       42 
55 
     | 
    
         
             
            ## Development
         
     | 
| 
       43 
56 
     | 
    
         | 
| 
       44 
57 
     | 
    
         
             
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
    
        data/lib/bunny_cdn/storage.rb
    CHANGED
    
    | 
         @@ -59,7 +59,7 @@ module BunnyCdn 
     | 
|
| 
       59 
59 
     | 
    
         
             
                  return response.body
         
     | 
| 
       60 
60 
     | 
    
         
             
                end
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                # Uploads a file to the storage zone
         
     | 
| 
      
 62 
     | 
    
         
            +
                # Uploads a file on the system to the storage zone
         
     | 
| 
       63 
63 
     | 
    
         
             
                # Params:
         
     | 
| 
       64 
64 
     | 
    
         
             
                # +path+:: desired path to upload file
         
     | 
| 
       65 
65 
     | 
    
         
             
                # +file+:: specific file to upload to storage zone
         
     | 
| 
         @@ -77,6 +77,24 @@ module BunnyCdn 
     | 
|
| 
       77 
77 
     | 
    
         
             
                  return response.body
         
     | 
| 
       78 
78 
     | 
    
         
             
                end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
      
 80 
     | 
    
         
            +
                # Uploads a file from a file input to the storage zone
         
     | 
| 
      
 81 
     | 
    
         
            +
                # Params:
         
     | 
| 
      
 82 
     | 
    
         
            +
                # +path+:: desired path to upload file
         
     | 
| 
      
 83 
     | 
    
         
            +
                # +file+:: specific file to upload to storage zone
         
     | 
| 
      
 84 
     | 
    
         
            +
                def self.uploadFormFile(path= '', file)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  fileName = file.original_filename
         
     | 
| 
      
 86 
     | 
    
         
            +
                  headers = {
         
     | 
| 
      
 87 
     | 
    
         
            +
                    :accessKey => apiKey,
         
     | 
| 
      
 88 
     | 
    
         
            +
                    :checksum => ''
         
     | 
| 
      
 89 
     | 
    
         
            +
                  }
         
     | 
| 
      
 90 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 91 
     | 
    
         
            +
                    response = RestClient.put("#{set_region_url}/#{storageZone}/#{path}/#{fileName}", File.read(file.tempfile), headers)
         
     | 
| 
      
 92 
     | 
    
         
            +
                  rescue RestClient::ExceptionWithResponse => exception
         
     | 
| 
      
 93 
     | 
    
         
            +
                    return exception
         
     | 
| 
      
 94 
     | 
    
         
            +
                  end
         
     | 
| 
      
 95 
     | 
    
         
            +
                  return response.body
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
       80 
98 
     | 
    
         
             
                # Deletes a file from the storage zone
         
     | 
| 
       81 
99 
     | 
    
         
             
                # Params:
         
     | 
| 
       82 
100 
     | 
    
         
             
                # +path+:: path to delete file from
         
     | 
    
        data/lib/bunny_cdn/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bunny_cdn
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Brandon Meeks
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-02-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rest-client
         
     | 
| 
         @@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       150 
150 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       151 
151 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       152 
152 
     | 
    
         
             
            requirements: []
         
     | 
| 
       153 
     | 
    
         
            -
            rubygems_version: 3.0. 
     | 
| 
      
 153 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       154 
154 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       155 
155 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       156 
156 
     | 
    
         
             
            summary: Gem to work with BunnyCDN
         
     |