octobat 0.0.10 → 0.0.11
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/Gemfile.lock +1 -1
 - data/VERSION +1 -1
 - data/lib/octobat/api_operations/list.rb +18 -10
 - data/lib/octobat/credit_note_numbering_sequence.rb +1 -1
 - data/lib/octobat/customer.rb +1 -1
 - data/lib/octobat/invoice.rb +1 -1
 - data/lib/octobat/list_object.rb +34 -6
 - data/lib/octobat/numbering_sequence.rb +1 -1
 - data/lib/octobat/payment_mode.rb +1 -1
 - data/lib/octobat/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 13b23c6576b35201a486ec9872311bd2858a1b64
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f1a6871a5e86bd4eff0db246d1c43cd74cdb5bc2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 24bf2a0ad0294d35d50b966f2eb11791521f43c3677d7f35ce12e2f265bb873b6465c822862599033fd84150064f94cb5e9df834bcea7758cbc82a827a6076b9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 981c7c5611340661a0aec31549c8e71deab45887344bc79de429bbec2b4713b9de7e5079e8be124f91e7175d3b2068d94431017d30871f13957aa99fa5b5dc16
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.11
         
     | 
| 
         @@ -1,17 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Octobat
         
     | 
| 
       2 
2 
     | 
    
         
             
              module APIOperations
         
     | 
| 
       3 
3 
     | 
    
         
             
                module List
         
     | 
| 
       4 
     | 
    
         
            -
                   
     | 
| 
       5 
     | 
    
         
            -
                     
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                     
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                     
     | 
| 
      
 4 
     | 
    
         
            +
                  def list(filters={}, opts={})
         
     | 
| 
      
 5 
     | 
    
         
            +
                    api_key, headers = Util.parse_opts(opts)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    api_key ||= @api_key
         
     | 
| 
      
 7 
     | 
    
         
            +
                    
         
     | 
| 
      
 8 
     | 
    
         
            +
                    #opts = Util.normalize_opts(opts)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #opts = @opts.merge(opts) if @opts
         
     | 
| 
      
 10 
     | 
    
         
            +
                    
         
     | 
| 
      
 11 
     | 
    
         
            +
                    response, api_key = Octobat.request(:get, url, api_key, filters, headers)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    obj = ListObject.construct_from(response, api_key)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    
         
     | 
| 
      
 14 
     | 
    
         
            +
                    obj.filters = filters.dup
         
     | 
| 
      
 15 
     | 
    
         
            +
                    obj.cursors[:ending_before] = obj.filters.delete(:ending_before)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    obj.cursors[:starting_after] = obj.filters.delete(:starting_after)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    
         
     | 
| 
      
 18 
     | 
    
         
            +
                    
         
     | 
| 
      
 19 
     | 
    
         
            +
                    obj
         
     | 
| 
       14 
20 
     | 
    
         
             
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  
         
     | 
| 
      
 22 
     | 
    
         
            +
                  alias :all :list
         
     | 
| 
       15 
23 
     | 
    
         
             
                end
         
     | 
| 
       16 
24 
     | 
    
         
             
              end
         
     | 
| 
       17 
25 
     | 
    
         
             
            end
         
     | 
    
        data/lib/octobat/customer.rb
    CHANGED
    
    
    
        data/lib/octobat/invoice.rb
    CHANGED
    
    
    
        data/lib/octobat/list_object.rb
    CHANGED
    
    | 
         @@ -1,5 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Octobat
         
     | 
| 
       2 
2 
     | 
    
         
             
              class ListObject < OctobatObject
         
     | 
| 
      
 3 
     | 
    
         
            +
                include Enumerable
         
     | 
| 
      
 4 
     | 
    
         
            +
                include Octobat::APIOperations::List
         
     | 
| 
      
 5 
     | 
    
         
            +
                
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :filters, :cursors
         
     | 
| 
      
 7 
     | 
    
         
            +
                
         
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(*args)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  super
         
     | 
| 
      
 10 
     | 
    
         
            +
                  self.filters = {}
         
     | 
| 
      
 11 
     | 
    
         
            +
                  self.cursors = {}
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
       3 
13 
     | 
    
         | 
| 
       4 
14 
     | 
    
         
             
                def [](k)
         
     | 
| 
       5 
15 
     | 
    
         
             
                  case k
         
     | 
| 
         @@ -13,10 +23,14 @@ module Octobat 
     | 
|
| 
       13 
23 
     | 
    
         
             
                def each(&blk)
         
     | 
| 
       14 
24 
     | 
    
         
             
                  self.data.each(&blk)
         
     | 
| 
       15 
25 
     | 
    
         
             
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                def empty?
         
     | 
| 
      
 28 
     | 
    
         
            +
                  self.data.empty?
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
       16 
30 
     | 
    
         | 
| 
       17 
31 
     | 
    
         
             
                def retrieve(id, api_key=nil)
         
     | 
| 
       18 
32 
     | 
    
         
             
                  api_key ||= @api_key
         
     | 
| 
       19 
     | 
    
         
            -
                  response, api_key = Octobat.request(:get,"#{url}/#{CGI.escape(id)}", api_key)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  response, api_key = Octobat.request(:get, "#{url}/#{CGI.escape(id)}", api_key)
         
     | 
| 
       20 
34 
     | 
    
         
             
                  Util.convert_to_octobat_object(response, api_key)
         
     | 
| 
       21 
35 
     | 
    
         
             
                end
         
     | 
| 
       22 
36 
     | 
    
         | 
| 
         @@ -27,11 +41,25 @@ module Octobat 
     | 
|
| 
       27 
41 
     | 
    
         
             
                  Util.convert_to_octobat_object(response, api_key)
         
     | 
| 
       28 
42 
     | 
    
         
             
                end
         
     | 
| 
       29 
43 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                 
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                   
     | 
| 
       33 
     | 
    
         
            -
                   
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                def next_page_params(params={}, opts={})
         
     | 
| 
      
 46 
     | 
    
         
            +
                  return nil if !has_more
         
     | 
| 
      
 47 
     | 
    
         
            +
                  last_id = data.last.id
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  params = filters.merge({
         
     | 
| 
      
 50 
     | 
    
         
            +
                    starting_after: last_id
         
     | 
| 
      
 51 
     | 
    
         
            +
                  }).merge(params)
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                def previous_page_params(params={}, opts={})
         
     | 
| 
      
 56 
     | 
    
         
            +
                  return nil if cursors[:starting_after].nil? || cursors[:starting_after].empty?
         
     | 
| 
      
 57 
     | 
    
         
            +
                  first_id = data.first.id
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  params = filters.merge({
         
     | 
| 
      
 60 
     | 
    
         
            +
                    ending_before: first_id
         
     | 
| 
      
 61 
     | 
    
         
            +
                  }).merge(params)
         
     | 
| 
       35 
62 
     | 
    
         
             
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
                
         
     | 
| 
       36 
64 
     | 
    
         
             
              end
         
     | 
| 
       37 
65 
     | 
    
         
             
            end
         
     | 
    
        data/lib/octobat/payment_mode.rb
    CHANGED
    
    
    
        data/lib/octobat/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: octobat
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.11
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Gaultier Laperche
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-04-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rest-client
         
     |