qonto 0.1.2 → 0.2.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: 10feccb9d56b5987e598045cbf154a62484b0b1f
4
- data.tar.gz: 1d21d6b39e2da5a07f98ed617bf1c72f19ca3387
3
+ metadata.gz: 94826f445212489870421cdbc931d2be335464a1
4
+ data.tar.gz: c1108a0ddfcaae32d02f04afa503fc6de6e4fdb1
5
5
  SHA512:
6
- metadata.gz: 978cc080c45b0ecd528efbc762045369d3eff532f40412c8bc44d758b0929ae394ae0c31d932d4b765fe14522c58e6d173572521d43bcdebcfa27237e013d178
7
- data.tar.gz: 8eed8950545496adaa8936b57a8b4c12a0233b9f96eff5c0e3019510ce7f8038c893dac836a7cecefaeb461006e135b6d9a5d6c9be44b5b83e3918b1754f2b5c
6
+ metadata.gz: 454908ec5ed286c4fa1f1a3ce7e605a5e9017d9f1b338d882bed87757c2f0158ece0d86139c9e76fff0e7d5f52ae36260109a28f1dd7c787d7b2014b4dbb72aa
7
+ data.tar.gz: 61201d2ffedeee015af3f7de5e0559704c0eecee5221ce092376f47bae9842d96e25379d42a69bc75e9e3d35ddf8e89ca4b760622848e29115bc95cbe6c2092f
@@ -1,24 +1,24 @@
1
1
  module Qonto
2
2
  module Actions
3
3
  module Transactions
4
- def list_transactions(bank_account:, current_page: nil, per_page: nil)
5
- query = prepare_query_string(bank_account, current_page, per_page)
6
- response = get("/transactions?#{query}")
4
+ def list_transactions(bank_account:, status: nil, current_page: nil, per_page: nil)
5
+ query = prepare_query(bank_account, status, current_page, per_page)
6
+
7
+ response = get("/transactions", query: query)
7
8
 
8
9
  modelize_transactions(response.parsed_response['transactions'])
9
10
  end
10
11
 
11
12
  private
12
13
 
13
- def prepare_query_string(bank_account, current_page, per_page)
14
+ def prepare_query(bank_account, status, current_page, per_page)
14
15
  {
15
16
  slug: bank_account.slug,
16
17
  iban: bank_account.iban,
18
+ status: status,
17
19
  current_page: current_page,
18
20
  per_page: per_page
19
21
  }.delete_if { |key, value| value.nil? }
20
- .map { |(key, value)| "#{key}=#{value}" }
21
- .join('&')
22
22
  end
23
23
 
24
24
  def modelize_transactions(transactions)
@@ -8,7 +8,7 @@ module Qonto
8
8
  include Qonto::Actions::Organization
9
9
  include Qonto::Actions::Transactions
10
10
 
11
- API_VERSION = 'v1'.freeze
11
+ API_VERSION = 'v2'.freeze
12
12
  BASE_URL = 'https://thirdparty.qonto.eu/'.freeze
13
13
  USER_AGENT = "qonto-ruby/#{VERSION}".freeze
14
14
 
@@ -21,17 +21,17 @@ module Qonto
21
21
  "#{BASE_URL}#{API_VERSION}"
22
22
  end
23
23
 
24
- def get(path)
25
- execute :get, path
24
+ def get(path, options = {})
25
+ execute(:get, path, options)
26
26
  end
27
27
 
28
28
  private
29
29
 
30
30
  attr_reader :slug, :secret_key
31
31
 
32
- def execute(method, path)
32
+ def execute(method, path, options)
33
33
  begin
34
- response = request(method, path)
34
+ response = request(method, path, options)
35
35
  rescue *Error::NET_HTTP_ERRORS => err
36
36
  raise ConnectionError.new, err.message
37
37
  end
@@ -54,8 +54,8 @@ module Qonto
54
54
  end
55
55
  end
56
56
 
57
- def request(method, path)
58
- HTTParty.send(method, base_url + path, base_options)
57
+ def request(method, path, options)
58
+ HTTParty.send(method, base_url + path, base_options.merge(options))
59
59
  end
60
60
 
61
61
  def base_options
@@ -7,6 +7,8 @@ module Qonto
7
7
  attr_accessor :current
8
8
  attr_accessor :balance
9
9
  attr_accessor :balance_cents
10
+ attr_accessor :authorized_balance
11
+ attr_accessor :authorized_balance_cents
10
12
  end
11
13
  end
12
14
  end
@@ -11,6 +11,10 @@ module Qonto
11
11
  attr_accessor :local_currency
12
12
  attr_accessor :settled_at
13
13
  attr_accessor :label
14
+ attr_accessor :status
15
+ attr_accessor :transaction_id
16
+ attr_accessor :emitted_at
17
+ attr_accessor :note
14
18
  end
15
19
  end
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Qonto
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qonto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Charrier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-20 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty