mollie-api-ruby 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1265236bec45e54b6a1e8a9b711fc31db8360eb9
4
- data.tar.gz: 8021d67a17f7b02c638827afbb48d2c0c2e01f0d
3
+ metadata.gz: b228303449f153b39e3ee2ce64035412d17a8b0e
4
+ data.tar.gz: 90fe25b682947ca412791365bf3dcfce87c64a47
5
5
  SHA512:
6
- metadata.gz: b04660c657ae6a7fb120c767f9387ac02687fd97f88553aa6f586631c1d96d14fab0072e3b136877dafc1b0e0f37baa3a0c8ec0dea1d46795e121d0a0d45ff1a
7
- data.tar.gz: 24ac333e52fbb08a0e90826516f1c4ab4bcc3821937196e26d6bf76c470d9ba2a63a47068aea7f1228938806ebc33c33c90742168348d7ad72b5ec51e377bc62
6
+ metadata.gz: d6ef48f0f3aeb0fb19ad136f0fc64c06512ae509676775cfe81062a97d7e988a8a26e689248b4e835b234b379a42c15a487992edd2ee440b10c5f0710e5cefa6
7
+ data.tar.gz: fd4dae4d7fd3ea510cb8890cf2ffcaf6dc1d478086b73b1810f0e4804f826de50a8718ccdb5614b16e66e001d20558bac7e8f56cbcc6898c4373298389dc4566
data/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  All notable changes to this project will be documented in this file.
6
6
 
7
+ #### 2.1.0 - 2017-02-06
8
+ - Add pagination support to resources ([#25](https://github.com/mollie/mollie-api-ruby/issues/25)).
9
+
7
10
  #### 2.0.1 - 2016-12-16
8
11
  - Update bundled cacert.pem file. Follows Mozilla's recommendations on invalid certificates.
9
12
 
@@ -63,8 +63,10 @@ module Mollie
63
63
  @version_strings << (version_string.gsub /\s+/, "-")
64
64
  end
65
65
 
66
- def perform_http_call(http_method, api_method, id = nil, http_body = {})
66
+ def perform_http_call(http_method, api_method, id = nil, http_body = {}, query = {})
67
67
  path = "/#{API_VERSION}/#{api_method}/#{id}".chomp('/')
68
+ path += "?#{URI.encode_www_form(query)}" if query.length > 0
69
+
68
70
  case http_method
69
71
  when 'GET'
70
72
  request = Net::HTTP::Get.new(path)
@@ -1,7 +1,7 @@
1
1
  module Mollie
2
2
  module API
3
3
  class Client
4
- VERSION = "2.0.1"
4
+ VERSION = "2.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -32,8 +32,8 @@ module Mollie
32
32
  request "DELETE", id, {}
33
33
  end
34
34
 
35
- def all
36
- request("GET", nil, {}) { |response|
35
+ def all(offset = 0, limit = 50)
36
+ request("GET", nil, {}, { offset: offset, count: limit }) { |response|
37
37
  Object::List.new response, resource_object
38
38
  }
39
39
  end
@@ -42,8 +42,8 @@ module Mollie
42
42
  resource_object.new response
43
43
  end
44
44
 
45
- def request(method, id = 0, data = {})
46
- response = @client.perform_http_call method, resource_name, id, data
45
+ def request(method, id = 0, data = {}, query = {})
46
+ response = @client.perform_http_call method, resource_name, id, data, query
47
47
 
48
48
  yield(response) if block_given?
49
49
  end
@@ -68,7 +68,7 @@ module Mollie
68
68
  end
69
69
 
70
70
  def test_all
71
- stub_request(:get, "https://api.mollie.nl/v1/testresource")
71
+ stub_request(:get, "https://api.mollie.nl/v1/testresource?count=50&offset=0")
72
72
  .to_return(:status => 200, :body => %{{"data":[{"id":"my-id"}]}}, :headers => {})
73
73
 
74
74
  client = Client.new("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake