bigcommerce 0.9.0 → 0.10.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/LICENSE +1 -1
- data/README.md +52 -73
- data/bigcommerce.gemspec +53 -25
- data/lib/bigcommerce.rb +2 -0
- data/lib/bigcommerce/api.rb +139 -114
- data/lib/bigcommerce/connection.rb +100 -33
- data/lib/bigcommerce/product.rb +13 -0
- data/lib/bigcommerce/resource.rb +50 -0
- data/lib/bigcommerce/version.rb +1 -1
- data/spec/integration/orders_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/api_request_spec.rb +6 -6
- data/spec/unit/api_spec.rb +30 -3
- data/spec/unit/connection_spec.rb +1 -30
- metadata +148 -155
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: a54eb51eb08fb56817334d0725b0f58f7815e882
         | 
| 4 | 
            +
              data.tar.gz: 293bfd8af80d9a3ebdc19a0c5c49c39ed1f3b1ff
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 839f079c9d4f3aef25dbbf2faf5455c3496084784243b4cb92ed9df643968ff6acba952d71eebb2b43799cc6f0845611cde3315844ff56b9d01d0ec2c9f67624
         | 
| 7 | 
            +
              data.tar.gz: 19da39343bff9cd3f49a140478c5300f6dbfd071ed33d0ba894c2b44deceba26630fd13ecdba098be5a7c5e94b4d9abba9ba657e09386106b7452ba27cc51070
         | 
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
            -
            Bigcommerce API V2 - Ruby Client
         | 
| 2 | 
            -
            ================================
         | 
| 1 | 
            +
            # Bigcommerce API V2 - Ruby Client
         | 
| 3 2 |  | 
| 4 3 | 
             
            [](https://rubygems.org/gems/bigcommerce)
         | 
| 5 4 | 
             
            [](https://travis-ci.org/bigcommerce/bigcommerce-api-ruby)
         | 
| @@ -10,121 +9,101 @@ Bigcommerce API V2 - Ruby Client | |
| 10 9 | 
             
            This library provides a wrapper around the Bigcommerce REST API for use within
         | 
| 11 10 | 
             
            Ruby apps or via the console.
         | 
| 12 11 |  | 
| 13 | 
            -
            Note
         | 
| 14 | 
            -
             | 
| 12 | 
            +
            ### Note
         | 
| 13 | 
            +
             | 
| 15 14 | 
             
            If you find anything that is missing or needs clean up, please feel free to fork
         | 
| 16 15 | 
             
            it and submit a changes with your pull request.
         | 
| 17 16 |  | 
| 18 | 
            -
            Requirements
         | 
| 19 | 
            -
            ------------
         | 
| 17 | 
            +
            ## Requirements
         | 
| 20 18 |  | 
| 21 19 | 
             
            - Ruby 1.9+
         | 
| 22 20 |  | 
| 23 21 | 
             
            To connect to the API, you need the following credentials:
         | 
| 24 22 |  | 
| 23 | 
            +
            For the OAuth API:
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            - Create and register an app at [developer.bigcommerce.com](https://developer.bigcommerce.com).
         | 
| 26 | 
            +
            - Have a callback URL defined
         | 
| 27 | 
            +
            - Prepare the `client_id` credential
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            For the Legacy API:
         | 
| 30 | 
            +
             | 
| 25 31 | 
             
            - Secure URL pointing to a Bigcommerce store
         | 
| 26 32 | 
             
            - Username of an authorized admin user of the store
         | 
| 27 33 | 
             
            - API key for the user
         | 
| 28 34 |  | 
| 29 | 
            -
            A valid API key is required to authenticate requests. To grant API access for a
         | 
| 30 | 
            -
            user, go to Control Panel > Users > Edit User and make sure that the
         | 
| 31 | 
            -
            'Enable API access?' checkbox is ticked.
         | 
| 35 | 
            +
            A valid API key is required to authenticate requests. To grant API access for a user, go to Control Panel > Users > Edit User and make sure that the 'Enable API access?' checkbox is ticked.
         | 
| 32 36 |  | 
| 33 | 
            -
            Installation
         | 
| 34 | 
            -
            ------------
         | 
| 37 | 
            +
            ## Installation
         | 
| 35 38 |  | 
| 36 39 | 
             
            Download the lib folder and copy it to a path accessible within your app, or
         | 
| 37 40 | 
             
            install the package directly from Rubygems:
         | 
| 38 41 |  | 
| 39 | 
            -
            ```
         | 
| 42 | 
            +
            ```sh
         | 
| 40 43 | 
             
            gem install bigcommerce
         | 
| 41 44 | 
             
            ```
         | 
| 42 45 |  | 
| 43 | 
            -
             | 
| 44 | 
            -
            gem directly from this repo. If you are using Rails, you can point your Gemfile
         | 
| 45 | 
            -
            to this git repo directly or do a local install of the gem by -
         | 
| 46 | 
            +
            ## Configuration
         | 
| 46 47 |  | 
| 47 | 
            -
             | 
| 48 | 
            -
            rake build
         | 
| 49 | 
            -
            gem install pkg/bigcommerce-*.gem
         | 
| 50 | 
            -
            ```
         | 
| 48 | 
            +
            #### OAuth Authentication
         | 
| 51 49 |  | 
| 52 | 
            -
             | 
| 53 | 
            -
            -------------
         | 
| 50 | 
            +
            In order to create a new Bigcommerce application, please visit [developer.bigcommerce.com](https://developer.bigcommerce.com). Its free to sign up and only takes a moment. Once you have created your app, you can get a `client_id`.
         | 
| 54 51 |  | 
| 55 52 | 
             
            To use the API client in your Ruby code, provide the required credentials as
         | 
| 56 53 | 
             
            follows:
         | 
| 57 54 |  | 
| 58 | 
            -
            ```
         | 
| 55 | 
            +
            ```rb
         | 
| 59 56 | 
             
            require 'bigcommerce'
         | 
| 60 57 |  | 
| 61 58 | 
             
            api = Bigcommerce::Api.new({
         | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
            })
         | 
| 66 | 
            -
            ```
         | 
| 67 | 
            -
             | 
| 68 | 
            -
            If you want to enable SSL certificates -
         | 
| 69 | 
            -
             | 
| 70 | 
            -
            ```
         | 
| 71 | 
            -
            require 'bigcommerce'
         | 
| 72 | 
            -
            api = Bigcommerce::Api.new({
         | 
| 73 | 
            -
            	:store_url => "https://store.mybigcommerce.com",
         | 
| 74 | 
            -
            	:username  => "admin",
         | 
| 75 | 
            -
            	:api_key   => "d81aada4c19c34d913e18f07fd7f36ca"
         | 
| 76 | 
            -
            	:ssl_client_cert  =>  OpenSSL::X509::Certificate.new(File.read("cert.pem")),
         | 
| 77 | 
            -
              	:ssl_client_key   =>  OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any"),
         | 
| 78 | 
            -
              	:ssl_ca_file      =>  "ca_certificate.pem",
         | 
| 79 | 
            -
              	:verify_ssl       =>  OpenSSL::SSL::VERIFY_PEER 
         | 
| 59 | 
            +
              :store_hash    => 'STORE_HASH',
         | 
| 60 | 
            +
              :client_id     => 'CLIENT_ID',
         | 
| 61 | 
            +
              :access_token  => 'ACCESS_TOKEN'
         | 
| 80 62 | 
             
            })
         | 
| 81 63 | 
             
            ```
         | 
| 82 | 
            -
            Remember that the fields `:ssl_client_cert`, `:ssl_client_key`, `:ssl_ca_file` 
         | 
| 83 | 
            -
            and `:verify_ssl` are all required when enabling SSL certificates.
         | 
| 84 | 
            -
             | 
| 85 | 
            -
            Connecting to the store
         | 
| 86 | 
            -
            -----------------------
         | 
| 87 64 |  | 
| 88 | 
            -
             | 
| 89 | 
            -
            can connect successfully to the store:
         | 
| 65 | 
            +
            __NOTE:__ You do not need extra SSL certificates when connecting to the OAuth version of the api.
         | 
| 90 66 |  | 
| 91 | 
            -
             | 
| 92 | 
            -
            ping = api.get_time
         | 
| 93 | 
            -
            ```
         | 
| 67 | 
            +
            #### Legacy Credentials
         | 
| 94 68 |  | 
| 95 | 
            -
             | 
| 96 | 
            -
            -----
         | 
| 69 | 
            +
            To use the API client with the legacy credentials you can visit the main store page and under the "Setup & Tools" dropdown, you will see a link for the legacy API credentials.
         | 
| 97 70 |  | 
| 98 | 
            -
             | 
| 71 | 
            +
            ```rb
         | 
| 72 | 
            +
            require 'bigcommerce'
         | 
| 99 73 |  | 
| 100 | 
            -
             | 
| 74 | 
            +
            api = Bigcommerce::Api.new({
         | 
| 75 | 
            +
              :store_url => "https://store.mybigcommerce.com",
         | 
| 76 | 
            +
              :username  => "username",
         | 
| 77 | 
            +
              :api_key   => "api_key"
         | 
| 78 | 
            +
            })
         | 
| 101 79 | 
             
            ```
         | 
| 102 | 
            -
            orders = api.get_orders
         | 
| 103 | 
            -
            orders = api.get_orders({:min_id=>100,:max_id=>101})
         | 
| 104 | 
            -
            orders = api.get_orders(:is_deleted => true)
         | 
| 105 80 |  | 
| 106 | 
            -
             | 
| 107 | 
            -
            products = api.get_products(:description=>"iphone", :condition=>"New")
         | 
| 81 | 
            +
            You can also enable SSL for the Legacy API.
         | 
| 108 82 |  | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
            ...
         | 
| 83 | 
            +
            ```rb
         | 
| 84 | 
            +
            require 'bigcommerce'
         | 
| 112 85 |  | 
| 86 | 
            +
            api = Bigcommerce::Api.new({
         | 
| 87 | 
            +
              :store_url => "https://store.mybigcommerce.com",
         | 
| 88 | 
            +
              :username  => "username",
         | 
| 89 | 
            +
              :api_key   => "api_key",
         | 
| 90 | 
            +
              :ssl_client_cert  =>  OpenSSL::X509::Certificate.new(File.read("cert.pem")),
         | 
| 91 | 
            +
              :ssl_client_key   =>  OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any"),
         | 
| 92 | 
            +
              :ssl_ca_file      =>  "ca_certificate.pem",
         | 
| 93 | 
            +
              :verify_ssl       =>  OpenSSL::SSL::VERIFY_PEER
         | 
| 94 | 
            +
            })
         | 
| 113 95 | 
             
            ```
         | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
            api.create_products({:name => "Spiderman - The best return",:price => 9.99,:categories => [17],:type =>"physical",:availability => "available", :weight => 1})
         | 
| 117 | 
            -
             | 
| 118 | 
            -
            api.update_products(31,{:name => "marvel comics spiderman",:sku => "marvel-spidey-1", :inventory_tracking => "simple", :inventory_level => 500})
         | 
| 96 | 
            +
            Remember that the fields `:ssl_client_cert`, `:ssl_client_key`, `:ssl_ca_file`
         | 
| 97 | 
            +
            and `:verify_ssl` are all required when enabling SSL certificates.
         | 
| 119 98 |  | 
| 120 | 
            -
             | 
| 99 | 
            +
            ## Connecting to the store
         | 
| 121 100 |  | 
| 122 | 
            -
             | 
| 123 | 
            -
            Update Data
         | 
| 101 | 
            +
            Once you have authenticated with the OAuth or Legacy credentials, ping the time method to check that your configuration is working and you can connect successfully to the store:
         | 
| 124 102 |  | 
| 103 | 
            +
            ```rb
         | 
| 104 | 
            +
            ping = api.time()
         | 
| 125 105 | 
             
            ```
         | 
| 126 | 
            -
            api.update_products(31,{:name => "marvel comics spiderman",:sku => "marvel-spidey-1", :inventory_tracking => "simple", :inventory_level => 500})
         | 
| 127 106 |  | 
| 128 | 
            -
             | 
| 107 | 
            +
            ## Reference
         | 
| 129 108 |  | 
| 130 | 
            -
             | 
| 109 | 
            +
            For full reference about the resources and supported endpoints, please see [developer.bigcommerce.com](https://developer.bigcommerce.com).
         | 
    
        data/bigcommerce.gemspec
    CHANGED
    
    | @@ -1,31 +1,59 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 | 
            -
             | 
| 2 | 
            +
            # stub: bigcommerce 0.9.0 ruby lib
         | 
| 3 3 |  | 
| 4 4 | 
             
            Gem::Specification.new do |s|
         | 
| 5 | 
            -
              s. | 
| 6 | 
            -
              s. | 
| 7 | 
            -
             | 
| 8 | 
            -
               | 
| 9 | 
            -
             | 
| 10 | 
            -
               | 
| 11 | 
            -
              s.add_development_dependency("ci_reporter")
         | 
| 12 | 
            -
              s.add_development_dependency("mocha")
         | 
| 13 | 
            -
              s.add_development_dependency("rake")
         | 
| 14 | 
            -
              s.add_development_dependency("rspec", '~> 2.11')
         | 
| 15 | 
            -
              s.add_development_dependency("vcr")
         | 
| 16 | 
            -
              s.add_development_dependency("webmock", '1.9')
         | 
| 17 | 
            -
              s.authors  = ["Mark Rickerby", "Rob Howard", "Saranyan Vigraham", "Sasha Gerrand"]
         | 
| 18 | 
            -
              s.date     = Time.now.strftime("%Y-%m-%d")
         | 
| 5 | 
            +
              s.name = "bigcommerce"
         | 
| 6 | 
            +
              s.version = "0.10.0"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 9 | 
            +
              s.authors = ["Mark Rickerby", "Rob Howard", "Saranyan Vigraham", "Sasha Gerrand"]
         | 
| 10 | 
            +
              s.date = "2015-01-27"
         | 
| 19 11 | 
             
              s.description = "Enables Ruby applications to communicate with the Bigcommerce API V2."
         | 
| 20 | 
            -
              s. | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
                            "sasha.gerrand@bigcommerce.com"]
         | 
| 24 | 
            -
              s.files = ["LICENSE", "Rakefile", "README.md", "bigcommerce.gemspec"] + Dir['./**/*.rb'] + Dir['./**/*.crt']
         | 
| 25 | 
            -
              s.has_rdoc = false
         | 
| 12 | 
            +
              s.license = 'MIT'
         | 
| 13 | 
            +
              s.email = ["mark.rickerby@bigcommerce.com", "rob.howard@bigcommerce.com", "saranyan.vigraham@bigcommerce.com", "sasha.gerrand@bigcommerce.com"]
         | 
| 14 | 
            +
              s.files = ["LICENSE", "Rakefile", "README.md", "bigcommerce.gemspec", "./lib/big_commerce.rb", "./lib/bigcommerce/api.rb", "./lib/bigcommerce/connection.rb", "./lib/bigcommerce/version.rb", "./lib/bigcommerce/resource.rb", "./lib/bigcommerce/product.rb", "./lib/bigcommerce.rb", "./spec/big_commerce_spec.rb", "./spec/integration/orders_spec.rb", "./spec/spec_helper.rb", "./spec/support/integration_context.rb", "./spec/support/mock_api_context.rb", "./spec/unit/api_request_spec.rb", "./spec/unit/api_spec.rb", "./spec/unit/connection_spec.rb", "./spec/unit/date_time_spec.rb", "./spec/unit/version_spec.rb", "spec/big_commerce_spec.rb", "spec/integration/orders_spec.rb", "spec/unit/api_request_spec.rb", "spec/unit/api_spec.rb", "spec/unit/connection_spec.rb", "spec/unit/date_time_spec.rb", "spec/unit/version_spec.rb"]
         | 
| 26 15 | 
             
              s.homepage = "http://github.com/bigcommerce/bigcommerce-api-ruby"
         | 
| 27 | 
            -
              s. | 
| 28 | 
            -
              s. | 
| 29 | 
            -
              s. | 
| 30 | 
            -
              s. | 
| 16 | 
            +
              s.require_paths = ["lib"]
         | 
| 17 | 
            +
              s.rubygems_version = "2.1.11"
         | 
| 18 | 
            +
              s.summary = "Enables Ruby applications to communicate with the Bigcommerce API"
         | 
| 19 | 
            +
              s.test_files = ["spec/big_commerce_spec.rb", "spec/integration/orders_spec.rb", "spec/unit/api_request_spec.rb", "spec/unit/api_spec.rb", "spec/unit/connection_spec.rb", "spec/unit/date_time_spec.rb", "spec/unit/version_spec.rb"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              if s.respond_to? :specification_version then
         | 
| 22 | 
            +
                s.specification_version = 4
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 25 | 
            +
                  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
         | 
| 26 | 
            +
                  s.add_runtime_dependency(%q<json>, [">= 0"])
         | 
| 27 | 
            +
                  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
         | 
| 28 | 
            +
                  s.add_development_dependency(%q<coveralls>, [">= 0"])
         | 
| 29 | 
            +
                  s.add_development_dependency(%q<ci_reporter_rspec>, [">= 0"])
         | 
| 30 | 
            +
                  s.add_development_dependency(%q<mocha>, [">= 0"])
         | 
| 31 | 
            +
                  s.add_development_dependency(%q<rake>, [">= 0"])
         | 
| 32 | 
            +
                  s.add_development_dependency(%q<rspec>, ["~> 2.11"])
         | 
| 33 | 
            +
                  s.add_development_dependency(%q<vcr>, [">= 0"])
         | 
| 34 | 
            +
                  s.add_development_dependency(%q<webmock>, ["= 1.9"])
         | 
| 35 | 
            +
                else
         | 
| 36 | 
            +
                  s.add_dependency(%q<activesupport>, [">= 0"])
         | 
| 37 | 
            +
                  s.add_dependency(%q<json>, [">= 0"])
         | 
| 38 | 
            +
                  s.add_dependency(%q<rest-client>, [">= 0"])
         | 
| 39 | 
            +
                  s.add_dependency(%q<coveralls>, [">= 0"])
         | 
| 40 | 
            +
                  s.add_dependency(%q<ci_reporter_rspec>, [">= 0"])
         | 
| 41 | 
            +
                  s.add_dependency(%q<mocha>, [">= 0"])
         | 
| 42 | 
            +
                  s.add_dependency(%q<rake>, [">= 0"])
         | 
| 43 | 
            +
                  s.add_dependency(%q<rspec>, ["~> 2.11"])
         | 
| 44 | 
            +
                  s.add_dependency(%q<vcr>, [">= 0"])
         | 
| 45 | 
            +
                  s.add_dependency(%q<webmock>, ["= 1.9"])
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              else
         | 
| 48 | 
            +
                s.add_dependency(%q<activesupport>, [">= 0"])
         | 
| 49 | 
            +
                s.add_dependency(%q<json>, [">= 0"])
         | 
| 50 | 
            +
                s.add_dependency(%q<rest-client>, [">= 0"])
         | 
| 51 | 
            +
                s.add_dependency(%q<coveralls>, [">= 0"])
         | 
| 52 | 
            +
                s.add_dependency(%q<ci_reporter_rspec>, [">= 0"])
         | 
| 53 | 
            +
                s.add_dependency(%q<mocha>, [">= 0"])
         | 
| 54 | 
            +
                s.add_dependency(%q<rake>, [">= 0"])
         | 
| 55 | 
            +
                s.add_dependency(%q<rspec>, ["~> 2.11"])
         | 
| 56 | 
            +
                s.add_dependency(%q<vcr>, [">= 0"])
         | 
| 57 | 
            +
                s.add_dependency(%q<webmock>, ["= 1.9"])
         | 
| 58 | 
            +
              end
         | 
| 31 59 | 
             
            end
         | 
    
        data/lib/bigcommerce.rb
    CHANGED
    
    
    
        data/lib/bigcommerce/api.rb
    CHANGED
    
    | @@ -1,8 +1,11 @@ | |
| 1 1 | 
             
            require 'date'
         | 
| 2 | 
            +
            require 'ostruct'
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Bigcommerce
         | 
| 4 5 | 
             
              class Api
         | 
| 5 6 |  | 
| 7 | 
            +
                attr_reader :page
         | 
| 8 | 
            +
             | 
| 6 9 | 
             
                def initialize(configuration={})
         | 
| 7 10 | 
             
                  @connection = Connection.new(configuration)
         | 
| 8 11 | 
             
                end
         | 
| @@ -35,19 +38,23 @@ module Bigcommerce | |
| 35 38 | 
             
                  datetime.strftime("%a, %d %b %Y %H:%M:%S %z")
         | 
| 36 39 | 
             
                end
         | 
| 37 40 |  | 
| 38 | 
            -
                def  | 
| 41 | 
            +
                def time
         | 
| 39 42 | 
             
                  @connection.get '/time'
         | 
| 40 43 | 
             
                end
         | 
| 41 44 |  | 
| 42 | 
            -
                def  | 
| 45 | 
            +
                def store_information
         | 
| 46 | 
            +
                  @connection.get '/store'
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                def brands(options={})
         | 
| 43 50 | 
             
                  @connection.get("/brands", options)
         | 
| 44 51 | 
             
                end
         | 
| 45 52 |  | 
| 46 | 
            -
                def  | 
| 53 | 
            +
                def brands_count
         | 
| 47 54 | 
             
                  @connection.get '/brands/count'
         | 
| 48 55 | 
             
                end
         | 
| 49 56 |  | 
| 50 | 
            -
                def  | 
| 57 | 
            +
                def brand(id)
         | 
| 51 58 | 
             
                  @connection.get("/brands/#{id}", {})
         | 
| 52 59 | 
             
                end
         | 
| 53 60 |  | 
| @@ -63,7 +70,7 @@ module Bigcommerce | |
| 63 70 | 
             
                   @connection.delete("/brands/#{id}")
         | 
| 64 71 | 
             
                end
         | 
| 65 72 |  | 
| 66 | 
            -
                def  | 
| 73 | 
            +
                def coupons(options={})
         | 
| 67 74 | 
             
                  @connection.get("/coupons", options)
         | 
| 68 75 | 
             
                end
         | 
| 69 76 |  | 
| @@ -75,15 +82,15 @@ module Bigcommerce | |
| 75 82 | 
             
                   @connection.put("/coupons/#{id}", options)
         | 
| 76 83 | 
             
                end
         | 
| 77 84 |  | 
| 78 | 
            -
                def  | 
| 85 | 
            +
                def categories(options={})
         | 
| 79 86 | 
             
                   @connection.get("/categories", options)
         | 
| 80 87 | 
             
                end
         | 
| 81 88 |  | 
| 82 | 
            -
                def  | 
| 89 | 
            +
                def categories_count
         | 
| 83 90 | 
             
                  @connection.get '/categories/count'
         | 
| 84 91 | 
             
                end
         | 
| 85 92 |  | 
| 86 | 
            -
                def  | 
| 93 | 
            +
                def category(id)
         | 
| 87 94 | 
             
                  @connection.get("/categories/#{id}", {})
         | 
| 88 95 | 
             
                end
         | 
| 89 96 |  | 
| @@ -99,47 +106,47 @@ module Bigcommerce | |
| 99 106 | 
             
                   @connection.delete("/categories/#{id}")
         | 
| 100 107 | 
             
                end
         | 
| 101 108 |  | 
| 102 | 
            -
                def  | 
| 109 | 
            +
                def countries(options={})
         | 
| 103 110 | 
             
                  @connection.get("/countries", options)
         | 
| 104 111 | 
             
                end
         | 
| 105 112 |  | 
| 106 | 
            -
                def  | 
| 113 | 
            +
                def country(id)
         | 
| 107 114 | 
             
                  @connection.get("/countries/#{id}", {})
         | 
| 108 115 | 
             
                end
         | 
| 109 116 |  | 
| 110 | 
            -
                def  | 
| 117 | 
            +
                def countries_states(options={})
         | 
| 111 118 | 
             
                  @connection.get("/countries/states", options)
         | 
| 112 119 | 
             
                end
         | 
| 113 120 |  | 
| 114 | 
            -
                def  | 
| 121 | 
            +
                def countries_state(id, options={})
         | 
| 115 122 | 
             
                  @connection.get("/countries/#{id}/states", {})
         | 
| 116 123 | 
             
                end
         | 
| 117 124 |  | 
| 118 | 
            -
                def  | 
| 125 | 
            +
                def customers(options = {})
         | 
| 119 126 | 
             
                  @connection.get("/customers", options)
         | 
| 120 127 | 
             
                end
         | 
| 121 128 |  | 
| 122 | 
            -
                def  | 
| 129 | 
            +
                def customer(id)
         | 
| 123 130 | 
             
                  @connection.get('/customers/' + id.to_s, {})
         | 
| 124 131 | 
             
                end
         | 
| 125 132 |  | 
| 126 | 
            -
                def  | 
| 133 | 
            +
                def customer_addresses(id, options = {})
         | 
| 127 134 | 
             
                  @connection.get("/customers/#{id}/addresses", options)
         | 
| 128 135 | 
             
                end
         | 
| 129 136 |  | 
| 130 | 
            -
                def  | 
| 137 | 
            +
                def customer_address(customer_id, address_id)
         | 
| 131 138 | 
             
                  @connection.get("/customers/#{customer_id}/addresses/#{address_id}",{})
         | 
| 132 139 | 
             
                end
         | 
| 133 140 |  | 
| 134 | 
            -
                def  | 
| 141 | 
            +
                def options(options={})
         | 
| 135 142 | 
             
                   @connection.get("/options", options)
         | 
| 136 143 | 
             
                end
         | 
| 137 144 |  | 
| 138 | 
            -
                def  | 
| 145 | 
            +
                def options_count
         | 
| 139 146 | 
             
                   @connection.get '/options/count'
         | 
| 140 147 | 
             
                end
         | 
| 141 148 |  | 
| 142 | 
            -
                def  | 
| 149 | 
            +
                def option(id)
         | 
| 143 150 | 
             
                  @connection.get("/options/#{id}",{})
         | 
| 144 151 | 
             
                end
         | 
| 145 152 |  | 
| @@ -155,12 +162,12 @@ module Bigcommerce | |
| 155 162 | 
             
                  @connection.delete("/options/#{id}")
         | 
| 156 163 | 
             
                end
         | 
| 157 164 |  | 
| 158 | 
            -
                def  | 
| 165 | 
            +
                def options_values(options={})
         | 
| 159 166 | 
             
                   @connection.get("/options/values", options)
         | 
| 160 167 | 
             
                end
         | 
| 161 168 |  | 
| 162 | 
            -
                def  | 
| 163 | 
            -
                  @connection.get("/options/#{id}/values", | 
| 169 | 
            +
                def options_value(id, options={})
         | 
| 170 | 
            +
                  @connection.get("/options/#{id}/values", options)
         | 
| 164 171 | 
             
                end
         | 
| 165 172 |  | 
| 166 173 | 
             
                def create_options_values(options_id, options={})
         | 
| @@ -169,17 +176,17 @@ module Bigcommerce | |
| 169 176 |  | 
| 170 177 | 
             
                def update_options_value(options_id, values_id, options={})
         | 
| 171 178 | 
             
                  @connection.put("/options/#{options_id}/values/#{values_id}", options)
         | 
| 172 | 
            -
                end | 
| 179 | 
            +
                end
         | 
| 173 180 |  | 
| 174 | 
            -
                def  | 
| 181 | 
            +
                def optionsets(options={})
         | 
| 175 182 | 
             
                   @connection.get("/optionsets", options)
         | 
| 176 183 | 
             
                end
         | 
| 177 184 |  | 
| 178 | 
            -
                def  | 
| 185 | 
            +
                def optionsets_count
         | 
| 179 186 | 
             
                   @connection.get '/optionsets/count'
         | 
| 180 187 | 
             
                end
         | 
| 181 188 |  | 
| 182 | 
            -
                def  | 
| 189 | 
            +
                def optionset(id)
         | 
| 183 190 | 
             
                  @connection.get("/optionsets/#{id}", {})
         | 
| 184 191 | 
             
                end
         | 
| 185 192 |  | 
| @@ -195,15 +202,15 @@ module Bigcommerce | |
| 195 202 | 
             
                  @connection.delete("/optionsets/#{id}")
         | 
| 196 203 | 
             
                end
         | 
| 197 204 |  | 
| 198 | 
            -
                def  | 
| 205 | 
            +
                def optionsets_options(options={})
         | 
| 199 206 | 
             
                   @connection.get("/optionsets/options", options)
         | 
| 200 207 | 
             
                end
         | 
| 201 208 |  | 
| 202 | 
            -
                def  | 
| 209 | 
            +
                def optionset_options(id)
         | 
| 203 210 | 
             
                  @connection.get("/optionsets/#{id}/options", {})
         | 
| 204 211 | 
             
                end
         | 
| 205 212 |  | 
| 206 | 
            -
                def  | 
| 213 | 
            +
                def optionsets_option(id)
         | 
| 207 214 | 
             
                  @connection.get("/optionsets/options/#{id}", {})
         | 
| 208 215 | 
             
                end
         | 
| 209 216 |  | 
| @@ -215,90 +222,90 @@ module Bigcommerce | |
| 215 222 | 
             
                  @connection.put("/optionsets/#{optionset_id}/options/#{option_id}", options)
         | 
| 216 223 | 
             
                end
         | 
| 217 224 |  | 
| 218 | 
            -
                def  | 
| 225 | 
            +
                def orders(options={})
         | 
| 219 226 | 
             
                  @connection.get("/orders", options)
         | 
| 220 227 | 
             
                end
         | 
| 221 228 |  | 
| 222 | 
            -
                def  | 
| 229 | 
            +
                def orders_by_date(date, options={})
         | 
| 223 230 | 
             
                  if date.is_a?(String)
         | 
| 224 231 | 
             
                    date = DateTime.parse(date)
         | 
| 225 232 | 
             
                  end
         | 
| 226 233 | 
             
                  @connection.get('/orders', options.merge!(:min_date_created => to_rfc2822(date)))
         | 
| 227 234 | 
             
                end
         | 
| 228 235 |  | 
| 229 | 
            -
                def  | 
| 236 | 
            +
                def orders_modified_since(date)
         | 
| 230 237 | 
             
                  @connection.get('/orders', {}, {'If-Modified-Since' => to_rfc2822(date)})
         | 
| 231 238 | 
             
                end
         | 
| 232 239 |  | 
| 233 | 
            -
                def  | 
| 234 | 
            -
                  @connection.get("/orders/#{id}",  | 
| 240 | 
            +
                def order(id,options={})
         | 
| 241 | 
            +
                  @connection.get("/orders/#{id}", options)
         | 
| 235 242 | 
             
                end
         | 
| 236 243 |  | 
| 237 244 | 
             
                def update_order(id,options={})
         | 
| 238 245 | 
             
                  @connection.put("/orders/#{id}", options)
         | 
| 239 246 | 
             
                end
         | 
| 240 247 |  | 
| 241 | 
            -
                def  | 
| 242 | 
            -
                  @connection.get("/orders/#{id}/coupons",  | 
| 248 | 
            +
                def orders_coupons(id,options={})
         | 
| 249 | 
            +
                  @connection.get("/orders/#{id}/coupons", options)
         | 
| 243 250 | 
             
                end
         | 
| 244 251 |  | 
| 245 | 
            -
                def  | 
| 246 | 
            -
                  @connection.get("/orders/#{order_id}/coupons/#{coupon_id}",  | 
| 252 | 
            +
                def orders_coupon(order_id,coupon_id,options={})
         | 
| 253 | 
            +
                  @connection.get("/orders/#{order_id}/coupons/#{coupon_id}", options)
         | 
| 247 254 | 
             
                end
         | 
| 248 255 |  | 
| 249 | 
            -
                def  | 
| 250 | 
            -
                  @connection.get("/orders/#{id}/products",  | 
| 256 | 
            +
                def orders_products(id,options={})
         | 
| 257 | 
            +
                  @connection.get("/orders/#{id}/products", options)
         | 
| 251 258 | 
             
                end
         | 
| 252 259 |  | 
| 253 | 
            -
                def  | 
| 254 | 
            -
                  @connection.get("/orders/#{order_id}/products/#{product_id}",  | 
| 260 | 
            +
                def orders_product(order_id,product_id,options={})
         | 
| 261 | 
            +
                  @connection.get("/orders/#{order_id}/products/#{product_id}", options)
         | 
| 255 262 | 
             
                end
         | 
| 256 263 |  | 
| 257 | 
            -
                def  | 
| 258 | 
            -
                  @connection.get("/orders/#{id}/shipments",  | 
| 264 | 
            +
                def orders_shipments(id,options={})
         | 
| 265 | 
            +
                  @connection.get("/orders/#{id}/shipments", options)
         | 
| 259 266 | 
             
                end
         | 
| 260 267 |  | 
| 261 | 
            -
                def create_orders_shipments(id)
         | 
| 262 | 
            -
                  @connection.post("/orders/#{id}/shipments",  | 
| 268 | 
            +
                def create_orders_shipments(id, options={})
         | 
| 269 | 
            +
                  @connection.post("/orders/#{id}/shipments", options)
         | 
| 263 270 | 
             
                end
         | 
| 264 271 |  | 
| 265 | 
            -
                def  | 
| 266 | 
            -
                  @connection.get("/orders/#{order_id}/shipments/#{shipment_id}",  | 
| 272 | 
            +
                def orders_shipment(order_id,shipment_id,options={})
         | 
| 273 | 
            +
                  @connection.get("/orders/#{order_id}/shipments/#{shipment_id}", options)
         | 
| 267 274 | 
             
                end
         | 
| 268 275 |  | 
| 269 276 | 
             
                def update_orders_shipment(order_id,shipment_id,options={})
         | 
| 270 277 | 
             
                  @connection.put("/orders/#{order_id}/shipments/#{shipment_id}", options)
         | 
| 271 278 | 
             
                end
         | 
| 272 279 |  | 
| 273 | 
            -
                def  | 
| 274 | 
            -
                  @connection.get("/orders/#{id}/shippingaddresses",  | 
| 280 | 
            +
                def orders_shippingaddresses(id,options={})
         | 
| 281 | 
            +
                  @connection.get("/orders/#{id}/shippingaddresses", options)
         | 
| 275 282 | 
             
                end
         | 
| 276 283 |  | 
| 277 | 
            -
                def  | 
| 278 | 
            -
                  @connection.get("/orders/#{order_id}/shippingaddresses/#{shippingaddress_id}",  | 
| 284 | 
            +
                def orders_shippingaddress(order_id,shippingaddress_id,options={})
         | 
| 285 | 
            +
                  @connection.get("/orders/#{order_id}/shippingaddresses/#{shippingaddress_id}", options)
         | 
| 279 286 | 
             
                end
         | 
| 280 287 |  | 
| 281 | 
            -
                def  | 
| 288 | 
            +
                def orderstatuses(options={})
         | 
| 282 289 | 
             
                  @connection.get("/orderstatuses", options)
         | 
| 283 290 | 
             
                end
         | 
| 284 291 |  | 
| 285 | 
            -
                def  | 
| 286 | 
            -
                  @connection.get("/orderstatuses/#{id}",  | 
| 292 | 
            +
                def orderstatus(id,options={})
         | 
| 293 | 
            +
                  @connection.get("/orderstatuses/#{id}", options)
         | 
| 287 294 | 
             
                end
         | 
| 288 295 |  | 
| 289 | 
            -
                def  | 
| 296 | 
            +
                def products(options={})
         | 
| 290 297 | 
             
                  @connection.get("/products", options)
         | 
| 291 298 | 
             
                end
         | 
| 292 299 |  | 
| 293 | 
            -
                def  | 
| 300 | 
            +
                def products_count
         | 
| 294 301 | 
             
                  @connection.get '/products/count'
         | 
| 295 302 | 
             
                end
         | 
| 296 303 |  | 
| 297 | 
            -
                def  | 
| 298 | 
            -
                  @connection.get("/products/#{id}",  | 
| 304 | 
            +
                def product(id,options={})
         | 
| 305 | 
            +
                  @connection.get("/products/#{id}", options)
         | 
| 299 306 | 
             
                end
         | 
| 300 307 |  | 
| 301 | 
            -
             | 
| 308 | 
            +
                def create_products(options={})
         | 
| 302 309 | 
             
                  @connection.post('/products', options)
         | 
| 303 310 | 
             
                end
         | 
| 304 311 |  | 
| @@ -306,43 +313,63 @@ module Bigcommerce | |
| 306 313 | 
             
                  @connection.put("/products/#{id}", options)
         | 
| 307 314 | 
             
                end
         | 
| 308 315 |  | 
| 309 | 
            -
                def  | 
| 316 | 
            +
                def delete_products(id)
         | 
| 317 | 
            +
                  @connection.delete("/products/#{id}")
         | 
| 318 | 
            +
                end
         | 
| 319 | 
            +
             | 
| 320 | 
            +
                def products_discountrules(options={})
         | 
| 310 321 | 
             
                  @connection.get("/products/discountrules", options)
         | 
| 311 322 | 
             
                end
         | 
| 312 323 |  | 
| 313 | 
            -
                def  | 
| 324 | 
            +
                def product_discountrules(product_id, options={})
         | 
| 314 325 | 
             
                  @connection.get("/products/#{product_id}/discountrules", options)
         | 
| 315 326 | 
             
                end
         | 
| 316 327 |  | 
| 317 | 
            -
                def  | 
| 318 | 
            -
                  @connection.get("/products/#{product_id}/discountrules/#{discountrule_id}",  | 
| 328 | 
            +
                def products_discountrule(product_id, discountrule_id,options={})
         | 
| 329 | 
            +
                  @connection.get("/products/#{product_id}/discountrules/#{discountrule_id}", options)
         | 
| 319 330 | 
             
                end
         | 
| 320 331 |  | 
| 321 | 
            -
                def  | 
| 332 | 
            +
                def products_configurablefields(options={})
         | 
| 322 333 | 
             
                  @connection.get("/products/configurablefields", options)
         | 
| 323 334 | 
             
                end
         | 
| 324 335 |  | 
| 325 | 
            -
                def  | 
| 336 | 
            +
                def product_configurablefields(product_id, options={})
         | 
| 326 337 | 
             
                  @connection.get("/products/#{product_id}/configurablefields", options)
         | 
| 327 338 | 
             
                end
         | 
| 328 339 |  | 
| 329 | 
            -
                def  | 
| 330 | 
            -
                  @connection.get("/products/#{product_id}/configurablefields/#{configurable_field_id}",  | 
| 340 | 
            +
                def products_configurablefield(product_id, configurable_field_id, options={})
         | 
| 341 | 
            +
                  @connection.get("/products/#{product_id}/configurablefields/#{configurable_field_id}", options)
         | 
| 331 342 | 
             
                end
         | 
| 332 343 |  | 
| 333 | 
            -
                def  | 
| 344 | 
            +
                def products_customfields(options={})
         | 
| 334 345 | 
             
                  @connection.get("/products/customfields", options)
         | 
| 335 346 | 
             
                end
         | 
| 336 347 |  | 
| 337 | 
            -
                def  | 
| 348 | 
            +
                def product_customfields(product_id, options={})
         | 
| 338 349 | 
             
                  @connection.get("/products/#{product_id}/customfields", options)
         | 
| 339 350 | 
             
                end
         | 
| 340 351 |  | 
| 341 | 
            -
                def  | 
| 342 | 
            -
                  @connection. | 
| 352 | 
            +
                def create_product_customfield(product_id, options={})
         | 
| 353 | 
            +
                  @connection.post("/products/#{product_id}/customfields", options)
         | 
| 354 | 
            +
                end
         | 
| 355 | 
            +
             | 
| 356 | 
            +
                def update_product_customfield(product_id, custom_field_id, options={})
         | 
| 357 | 
            +
                  @connection.put("/products/#{product_id}/customfields/#{custom_field_id}", options)
         | 
| 343 358 | 
             
                end
         | 
| 344 359 |  | 
| 345 | 
            -
                def  | 
| 360 | 
            +
                def delete_product_customfield(product_id, custom_field_id)
         | 
| 361 | 
            +
                  @connection.delete("/products/#{product_id}/customfields/#{custom_field_id}")
         | 
| 362 | 
            +
                end
         | 
| 363 | 
            +
             | 
| 364 | 
            +
                def delete_product_customfields(product_id)
         | 
| 365 | 
            +
                  @connection.delete("/products/#{product_id}/customfields")
         | 
| 366 | 
            +
                end
         | 
| 367 | 
            +
             | 
| 368 | 
            +
                def products_customfield(product_id, custom_field_id, options={})
         | 
| 369 | 
            +
                  @connection.get("/products/#{product_id}/customfields/#{custom_field_id}", options)
         | 
| 370 | 
            +
                end
         | 
| 371 | 
            +
             | 
| 372 | 
            +
                def product_images(product_id, options={})
         | 
| 346 373 | 
             
                  @connection.get("/products/#{product_id}/images", options)
         | 
| 347 374 | 
             
                end
         | 
| 348 375 |  | 
| @@ -350,39 +377,27 @@ module Bigcommerce | |
| 350 377 | 
             
                  @connection.post("/products/#{product_id}/images", options)
         | 
| 351 378 | 
             
                end
         | 
| 352 379 |  | 
| 353 | 
            -
                def get_products_images(options={})
         | 
| 354 | 
            -
                  @connection.get("/products/images", options)
         | 
| 355 | 
            -
                end
         | 
| 356 | 
            -
             | 
| 357 380 | 
             
                def create_products_images(options={})
         | 
| 358 381 | 
             
                  @connection.post("/products/images", options)
         | 
| 359 382 | 
             
                end
         | 
| 360 383 |  | 
| 361 | 
            -
                def  | 
| 362 | 
            -
                  @connection.get("/products/#{product_id}/images/#{image_id}",  | 
| 384 | 
            +
                def products_image(product_id, image_id, options={})
         | 
| 385 | 
            +
                  @connection.get("/products/#{product_id}/images/#{image_id}", options)
         | 
| 363 386 | 
             
                end
         | 
| 364 387 |  | 
| 365 388 | 
             
                def update_products_image(product_id,image_id,options={})
         | 
| 366 389 | 
             
                  @connection.put("/products/#{product_id}/images/#{image_id}", options)
         | 
| 367 390 | 
             
                end
         | 
| 368 391 |  | 
| 369 | 
            -
                def  | 
| 370 | 
            -
                  @connection.get("/products/options", options)
         | 
| 371 | 
            -
                end
         | 
| 372 | 
            -
             | 
| 373 | 
            -
                def get_product_options(product_id, options={})
         | 
| 392 | 
            +
                def product_options(product_id, options={})
         | 
| 374 393 | 
             
                  @connection.get("/products/#{product_id}/options", options)
         | 
| 375 394 | 
             
                end
         | 
| 376 395 |  | 
| 377 | 
            -
                def  | 
| 378 | 
            -
                  @connection.get("/products/#{product_id}/options/#{option_id}",  | 
| 396 | 
            +
                def products_option(product_id,option_id, options={})
         | 
| 397 | 
            +
                  @connection.get("/products/#{product_id}/options/#{option_id}", options)
         | 
| 379 398 | 
             
                end
         | 
| 380 399 |  | 
| 381 | 
            -
                def  | 
| 382 | 
            -
                  @connection.get("/products/rules", options)
         | 
| 383 | 
            -
                end
         | 
| 384 | 
            -
             | 
| 385 | 
            -
                def get_product_rules(product_id, options={})
         | 
| 400 | 
            +
                def product_rules(product_id, options={})
         | 
| 386 401 | 
             
                  @connection.get("/products/#{product_id}/rules", options)
         | 
| 387 402 | 
             
                end
         | 
| 388 403 |  | 
| @@ -390,19 +405,15 @@ module Bigcommerce | |
| 390 405 | 
             
                  @connection.post("/products/rules", options)
         | 
| 391 406 | 
             
                end
         | 
| 392 407 |  | 
| 393 | 
            -
                def  | 
| 394 | 
            -
                  @connection.get("/products/#{product_id}/rules/#{rule_id}",  | 
| 408 | 
            +
                def products_rule(product_id,rule_id,options={})
         | 
| 409 | 
            +
                  @connection.get("/products/#{product_id}/rules/#{rule_id}", options)
         | 
| 395 410 | 
             
                end
         | 
| 396 411 |  | 
| 397 412 | 
             
                def update_products_rule(product_id, rule_id, options={})
         | 
| 398 413 | 
             
                  @connection.put("/products/#{product_id}/rules/#{rule_id}", options)
         | 
| 399 414 | 
             
                end
         | 
| 400 415 |  | 
| 401 | 
            -
                def  | 
| 402 | 
            -
                  @connection.get("/products/skus", options)
         | 
| 403 | 
            -
                end
         | 
| 404 | 
            -
             | 
| 405 | 
            -
                def get_product_skus(product_id, options={})
         | 
| 416 | 
            +
                def product_skus(product_id, options={})
         | 
| 406 417 | 
             
                  @connection.get("/products/#{product_id}/skus", options)
         | 
| 407 418 | 
             
                end
         | 
| 408 419 |  | 
| @@ -410,39 +421,53 @@ module Bigcommerce | |
| 410 421 | 
             
                  @connection.post("/products/skus", options)
         | 
| 411 422 | 
             
                end
         | 
| 412 423 |  | 
| 413 | 
            -
                def  | 
| 414 | 
            -
                  @connection.get("/products/#{product_id}/skus/#{sku_id}",  | 
| 424 | 
            +
                def products_sku(product_id, sku_id, options={})
         | 
| 425 | 
            +
                  @connection.get("/products/#{product_id}/skus/#{sku_id}", options)
         | 
| 415 426 | 
             
                end
         | 
| 416 427 |  | 
| 417 428 | 
             
                def update_products_sku(product_id, sku_id, options={})
         | 
| 418 429 | 
             
                  @connection.put("/products/#{product_id}/skus/#{sku_id}", options)
         | 
| 419 430 | 
             
                end
         | 
| 420 431 |  | 
| 421 | 
            -
                def  | 
| 422 | 
            -
                  @connection.get("/products/videos", options)
         | 
| 423 | 
            -
                end
         | 
| 424 | 
            -
             | 
| 425 | 
            -
                def get_product_videos(product_id, options={})
         | 
| 432 | 
            +
                def product_videos(product_id, options={})
         | 
| 426 433 | 
             
                  @connection.get("/products/#{product_id}/videos", options)
         | 
| 427 434 | 
             
                end
         | 
| 428 435 |  | 
| 429 | 
            -
                def  | 
| 430 | 
            -
                  @connection.get("/products/#{product_id}/videos/#{video_id}",  | 
| 436 | 
            +
                def products_video(product_id, video_id, options={})
         | 
| 437 | 
            +
                  @connection.get("/products/#{product_id}/videos/#{video_id}", options)
         | 
| 431 438 | 
             
                end
         | 
| 432 439 |  | 
| 433 | 
            -
                 | 
| 434 | 
            -
             | 
| 435 | 
            -
                def get_count(result)
         | 
| 440 | 
            +
                def count(result)
         | 
| 436 441 | 
             
                  result["count"]
         | 
| 437 442 | 
             
                end
         | 
| 438 443 |  | 
| 439 | 
            -
                def  | 
| 440 | 
            -
                   | 
| 444 | 
            +
                def collection(resource_path, options={})
         | 
| 445 | 
            +
                  if (options["resource_class"])
         | 
| 446 | 
            +
                    klass = options["resource_class"]
         | 
| 447 | 
            +
                  else
         | 
| 448 | 
            +
                    klass = Resource
         | 
| 449 | 
            +
                  end
         | 
| 450 | 
            +
                  Enumerator.new do |yielder|
         | 
| 451 | 
            +
                    count = -1
         | 
| 452 | 
            +
                    if options[:starting_page]
         | 
| 453 | 
            +
                      @page = options[:starting_page]
         | 
| 454 | 
            +
                    else
         | 
| 455 | 
            +
                      @page = 1
         | 
| 456 | 
            +
                    end
         | 
| 457 | 
            +
                    until count == 0
         | 
| 458 | 
            +
                      buffer = @connection.get(resource_path, {page: page})
         | 
| 459 | 
            +
                      count = buffer.count
         | 
| 460 | 
            +
                      buffer.each do |item|
         | 
| 461 | 
            +
                        yielder << klass.new(item, @connection)
         | 
| 462 | 
            +
                        p @connection.remaining_rate_limit
         | 
| 463 | 
            +
                      end
         | 
| 464 | 
            +
                      @page += 1
         | 
| 465 | 
            +
                    end
         | 
| 466 | 
            +
                  end
         | 
| 441 467 | 
             
                end
         | 
| 442 468 |  | 
| 443 | 
            -
                def  | 
| 469 | 
            +
                def resource(result)
         | 
| 444 470 | 
             
                  result
         | 
| 445 471 | 
             
                end
         | 
| 446 | 
            -
             | 
| 447 472 | 
             
              end
         | 
| 448 473 | 
             
            end
         |