namira 0.1.3 → 0.1.4
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/.gitignore +0 -1
 - data/README.md +18 -1
 - data/lib/namira/backend.rb +1 -1
 - data/lib/namira/errors/http_error.rb +3 -2
 - data/lib/namira/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9847678dcc4df200c97bad41e62b525401335eb3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 72c72e7726a2972dc1fbd561bb178810ea348e71
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e0fb5f3ae1b7425b845a9c0ac63ed9aca8014a16b211b0b56d4beae656ba5725e44eb0cff634e28d1bc116d291da3cdedb9f233261d6a9a42f242f2298f47988
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ee3a92d409a1d39b2e102c6243c02defbef48c38e6c30becf241dc7020d4ebc3379ba29e6e4432c095307e5e01a6211ed7e9e0d522665c9f1a5ab5db54918650
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -18,7 +18,7 @@ Or install it yourself as: 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            ## Usage
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
            ### GET
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            ```ruby
         
     | 
| 
       24 
24 
     | 
    
         
             
            # Create a request
         
     | 
| 
         @@ -31,6 +31,23 @@ response = request.response 
     | 
|
| 
       31 
31 
     | 
    
         
             
            response.from_json
         
     | 
| 
       32 
32 
     | 
    
         
             
            ```
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
      
 34 
     | 
    
         
            +
            ### POST
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 37 
     | 
    
         
            +
            # Create a request
         
     | 
| 
      
 38 
     | 
    
         
            +
            request = Namira::Request.new(
         
     | 
| 
      
 39 
     | 
    
         
            +
              uri: 'https://httpbin.org/headers',
         
     | 
| 
      
 40 
     | 
    
         
            +
              http_method: :post,
         
     | 
| 
      
 41 
     | 
    
         
            +
              request_body: JSON.dump({})
         
     | 
| 
      
 42 
     | 
    
         
            +
            )
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            # Send the request
         
     | 
| 
      
 45 
     | 
    
         
            +
            response = request.response
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            # Parse a JSON response
         
     | 
| 
      
 48 
     | 
    
         
            +
            response.from_json
         
     | 
| 
      
 49 
     | 
    
         
            +
            ```
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       34 
51 
     | 
    
         
             
            #### Configuration
         
     | 
| 
       35 
52 
     | 
    
         | 
| 
       36 
53 
     | 
    
         
             
            There are a few settings you can pass.
         
     | 
    
        data/lib/namira/backend.rb
    CHANGED
    
    | 
         @@ -47,7 +47,7 @@ module Namira 
     | 
|
| 
       47 
47 
     | 
    
         
             
                    raise Errors::RedirectError, 'Request redirected but no location was supplied' if location.nil?
         
     | 
| 
       48 
48 
     | 
    
         
             
                    send_request(location, method, headers, max_redirect, timeout, body, auth)
         
     | 
| 
       49 
49 
     | 
    
         
             
                  else
         
     | 
| 
       50 
     | 
    
         
            -
                    raise Errors::HTTPError.new("http_error/#{response.status}", response.status)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    raise Errors::HTTPError.new("http_error/#{response.status}", response.status, Namira::Response.new(response))
         
     | 
| 
       51 
51 
     | 
    
         
             
                  end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                rescue HTTP::TimeoutError => e
         
     | 
    
        data/lib/namira/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: namira
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Skylar Schipper
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-08-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       142 
142 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       143 
143 
     | 
    
         
             
            requirements: []
         
     | 
| 
       144 
144 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       145 
     | 
    
         
            -
            rubygems_version: 2.5. 
     | 
| 
      
 145 
     | 
    
         
            +
            rubygems_version: 2.5.2
         
     | 
| 
       146 
146 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       147 
147 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       148 
148 
     | 
    
         
             
            summary: A simple wrapper around HTTP
         
     |