wrapi 0.4.0 → 0.4.1
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/CHANGELOG.md +3 -0
 - data/lib/wrapi/connection.rb +1 -1
 - data/lib/wrapi/request.rb +11 -3
 - data/lib/wrapi/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d7a1a27203e141d7bbc0f20e3e65f18dafc255c33a051d3e03786cdb88fefa6f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b9cb8227c911fcb9ef133c8816c41e5dee626f3c0ea9ee4f1d5538f7c48f61cd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 65296ac28b6371f30ef67d7c6c4736d7a1a75820f5c33488acd9eaa370eecb63e5407dad016484e13e05b184faf99b853cac0c4c2f0e6ccd1e527cadb5a9212e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 18ab1a6603f10c89191c3fdf5345b7dbf22a2862bf251e1477b8d0da092679bdc8a1698f87b65e8e9cae68e69f8ff111e758822cb1ddb2560da594d4472cf56b
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/wrapi/connection.rb
    CHANGED
    
    | 
         @@ -38,7 +38,7 @@ module WrAPI 
     | 
|
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                # callback method to setup api authorization
         
     | 
| 
       40 
40 
     | 
    
         
             
                def setup_authorization(connection)
         
     | 
| 
       41 
     | 
    
         
            -
                  connection. 
     | 
| 
      
 41 
     | 
    
         
            +
                  connection.headers['Authorization'] = "Bearer #{access_token}" if access_token
         
     | 
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                # callback method to setup api headers
         
     | 
    
        data/lib/wrapi/request.rb
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ module WrAPI 
     | 
|
| 
       19 
19 
     | 
    
         
             
                #  @return nil if block given, otherwise complete concatenated json result set
         
     | 
| 
       20 
20 
     | 
    
         
             
                def get_paged(path, options = {}, request_labda = nil)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  raise ArgumentError,
         
     | 
| 
       22 
     | 
    
         
            -
                        "Pages requests should be json formatted (given format '#{format}')" unless  
     | 
| 
      
 22 
     | 
    
         
            +
                        "Pages requests should be json formatted (given format '#{format}')" unless is_json?
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  result = []
         
     | 
| 
       25 
25 
     | 
    
         
             
                  pager = create_pager
         
     | 
| 
         @@ -70,6 +70,10 @@ module WrAPI 
     | 
|
| 
       70 
70 
     | 
    
         
             
                  end
         
     | 
| 
       71 
71 
     | 
    
         
             
                  entity_response(response, raw)
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                
         
     | 
| 
      
 74 
     | 
    
         
            +
                def is_json?
         
     | 
| 
      
 75 
     | 
    
         
            +
                  format && 'json'.eql?(format.to_s)
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
       73 
77 
     | 
    
         | 
| 
       74 
78 
     | 
    
         
             
                private
         
     | 
| 
       75 
79 
     | 
    
         | 
| 
         @@ -88,14 +92,18 @@ module WrAPI 
     | 
|
| 
       88 
92 
     | 
    
         
             
                    when :post, :put
         
     | 
| 
       89 
93 
     | 
    
         
             
                      request.headers['Content-Type'] = "application/#{format}"
         
     | 
| 
       90 
94 
     | 
    
         
             
                      request.path = uri.escape(path)
         
     | 
| 
       91 
     | 
    
         
            -
                       
     | 
| 
      
 95 
     | 
    
         
            +
                      if is_json? && !options.empty?
         
     | 
| 
      
 96 
     | 
    
         
            +
                        request.body = options.to_json
         
     | 
| 
      
 97 
     | 
    
         
            +
                      else
         
     | 
| 
      
 98 
     | 
    
         
            +
                        request.body = URI.encode_www_form(options) unless options.empty?
         
     | 
| 
      
 99 
     | 
    
         
            +
                      end
         
     | 
| 
       92 
100 
     | 
    
         
             
                    end
         
     | 
| 
       93 
101 
     | 
    
         
             
                  end
         
     | 
| 
       94 
102 
     | 
    
         
             
                  response
         
     | 
| 
       95 
103 
     | 
    
         
             
                end
         
     | 
| 
       96 
104 
     | 
    
         | 
| 
       97 
105 
     | 
    
         
             
                def entity_response(response, raw=false)
         
     | 
| 
       98 
     | 
    
         
            -
                  if  
     | 
| 
      
 106 
     | 
    
         
            +
                  if is_json? && !raw
         
     | 
| 
       99 
107 
     | 
    
         
             
                    Entity.create(pagination_class.data(response.body))
         
     | 
| 
       100 
108 
     | 
    
         
             
                  else
         
     | 
| 
       101 
109 
     | 
    
         
             
                    response
         
     | 
    
        data/lib/wrapi/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: wrapi
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Janco Tanis
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-02-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     |