tikkie-api 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55cfd884d7806c214f743001ae9630fe2c4c8f68299706b089bda175218f3e4f
4
- data.tar.gz: 3a85b046ec52e04e67bf17c7c5ba325bf519d86971b661d2e1982c353534ebc6
3
+ metadata.gz: 10c4a5614f612f5644d20fc71952d57c7104086e8a2ab377183fea972a9f21fd
4
+ data.tar.gz: 66e49070354bc7fff4dd78ca1da2b37e404e47ba324502ecf22b7a68f4644a9a
5
5
  SHA512:
6
- metadata.gz: 8bae92cd6c752733f04abf01c254228e724531c11c77d623cf955569034b8c8dd9d7ec4e58e28e0c06ce13d2093014605886f6fe75cab63ab079987a2f506f92
7
- data.tar.gz: f61d4b03695dc6741d0cac68dedf9b413e48be017a0c1e41a2b5cecf8e7215ff8b0c80f35ee1fc7a35c41da12edb6b77b7b21b5509807997f1a4d37d5c5551ed
6
+ metadata.gz: e0c1ff2ba7627421270620a60a8510d8958261e0239f3650fc7f6e82242d846bf712051b65d3c5c7ede981b91b46fbb8b970e85f5a4d6a870becc18eed77db84
7
+ data.tar.gz: b5ca9fed8e11d329c76f3d90ea877f77b3c376e9b7b04897868fb21adc2b007fd00b0681276713f81b81d15948d2311adf12b309059c9be98a27012fa2583400
data/.rubocop.yml CHANGED
@@ -26,6 +26,9 @@ Style/Documentation:
26
26
  Style/GuardClause:
27
27
  Enabled: false
28
28
 
29
+ Style/IfUnlessModifier:
30
+ Enabled: false
31
+
29
32
  Style/SafeNavigation:
30
33
  Enabled: false
31
34
 
data/.travis.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  sudo: false
2
2
  language: ruby
3
+ cache: bundler
4
+ before_install:
5
+ - gem update --system
6
+ - gem update bundler
3
7
  rvm:
4
- - 2.2.10
5
- - 2.3.7
6
- - 2.4.4
7
- - 2.5.1
8
- before_install: gem install bundler -v 1.16.1
8
+ - 2.3.8
9
+ - 2.4.5
10
+ - 2.5.3
11
+ - 2.6.1
data/Gemfile CHANGED
@@ -7,4 +7,4 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
7
  # Specify your gem's dependencies in tikkie-api.gemspec
8
8
  gemspec
9
9
 
10
- gem 'rubocop', '~> 0.52.0'
10
+ gem 'rubocop', '~> 0.63.1'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tikkie-api (0.1.1)
4
+ tikkie-api (0.2.0)
5
5
  jwt (>= 1.0)
6
6
 
7
7
  GEM
@@ -9,16 +9,17 @@ GEM
9
9
  specs:
10
10
  addressable (2.5.2)
11
11
  public_suffix (>= 2.0.2, < 4.0)
12
- ast (2.3.0)
12
+ ast (2.4.0)
13
13
  crack (0.4.3)
14
14
  safe_yaml (~> 1.0.0)
15
15
  diff-lcs (1.3)
16
16
  hashdiff (0.3.7)
17
+ jaro_winkler (1.5.2)
17
18
  jwt (2.1.0)
18
- parallel (1.12.1)
19
- parser (2.4.0.2)
20
- ast (~> 2.3)
21
- powerpack (0.1.1)
19
+ parallel (1.13.0)
20
+ parser (2.6.0.0)
21
+ ast (~> 2.4.0)
22
+ powerpack (0.1.2)
22
23
  public_suffix (3.0.1)
23
24
  rainbow (3.0.0)
24
25
  rake (10.5.0)
@@ -35,17 +36,18 @@ GEM
35
36
  diff-lcs (>= 1.2.0, < 2.0)
36
37
  rspec-support (~> 3.7.0)
37
38
  rspec-support (3.7.0)
38
- rubocop (0.52.1)
39
+ rubocop (0.63.1)
40
+ jaro_winkler (~> 1.5.1)
39
41
  parallel (~> 1.10)
40
- parser (>= 2.4.0.2, < 3.0)
42
+ parser (>= 2.5, != 2.5.1.1)
41
43
  powerpack (~> 0.1)
42
44
  rainbow (>= 2.2.2, < 4.0)
43
45
  ruby-progressbar (~> 1.7)
44
- unicode-display_width (~> 1.0, >= 1.0.1)
45
- ruby-progressbar (1.9.0)
46
+ unicode-display_width (~> 1.4.0)
47
+ ruby-progressbar (1.10.0)
46
48
  safe_yaml (1.0.4)
47
49
  timecop (0.9.1)
48
- unicode-display_width (1.3.0)
50
+ unicode-display_width (1.4.1)
49
51
  webmock (2.3.2)
50
52
  addressable (>= 2.3.6)
51
53
  crack (>= 0.3.2)
@@ -58,10 +60,10 @@ DEPENDENCIES
58
60
  bundler (~> 1.16)
59
61
  rake (~> 10.0)
60
62
  rspec (~> 3.0)
61
- rubocop (~> 0.52.0)
63
+ rubocop (~> 0.63.1)
62
64
  tikkie-api!
63
65
  timecop (~> 0.9)
64
66
  webmock (~> 2.3)
65
67
 
66
68
  BUNDLED WITH
67
- 1.16.1
69
+ 1.17.2
data/README.md CHANGED
@@ -113,20 +113,22 @@ To retrieve a single payment request:
113
113
  payment_request = client.payment_requests.get("platform_token", "user_token", "payment_request_token")
114
114
  ```
115
115
 
116
- Create a new payment request for an existing user:
116
+ Create a new payment request (i.e. Tikkie) for an existing user:
117
117
 
118
118
  ```ruby
119
119
  payment_request = client.payment_requests.create("platform_token", "user_token", "bank_account_token",
120
- amount: "5.00",
120
+ amount: "5.00", # optional
121
121
  currency: "EUR",
122
122
  description: "Test",
123
- external_id: "Invoice 12345" # optional
123
+ external_id: "Invoice 12345" # mandatory only when platform_usage is set to `FOR_MYSELF`
124
124
  )
125
125
 
126
126
  tikkie_url = payment_request.payment_request_url
127
127
  payment_request_token = payment_request.payment_request_token
128
128
  ```
129
129
 
130
+ The parameter `amount` is optional. When omitted, it will create a payment request with an open amount, where the payer can decide on the amount.
131
+
130
132
  ### Error handling
131
133
 
132
134
  All responses to an API request include the methods `success?` and `error?` to determine whether the API call was successful or not. When the API request was not successful, the method `errors` will return details about the error response.
@@ -33,11 +33,12 @@ module Tikkie
33
33
 
34
34
  def create(platform_token, user_token, bank_account_token, options = {})
35
35
  params = {
36
- amountInCents: to_cents(options.fetch(:amount)),
37
36
  currency: options.fetch(:currency),
38
- description: options.fetch(:description),
39
- externalId: options[:external_id]
37
+ description: options.fetch(:description)
40
38
  }
39
+ params[:amountInCents] = to_cents(options[:amount]) if options.key?(:amount)
40
+ params[:externalId] = options[:external_id] if options.key?(:external_id)
41
+
41
42
  response = @request.post("/tikkie/platforms/#{platform_token}/users/#{user_token}/bankaccounts/#{bank_account_token}/paymentrequests", params)
42
43
 
43
44
  Tikkie::Api::Responses::PaymentRequestCreated.new(response)
@@ -46,7 +47,7 @@ module Tikkie
46
47
  private
47
48
 
48
49
  def to_cents(amount)
49
- decimal = BigDecimal.new(amount.to_s)
50
+ decimal = BigDecimal(amount.to_s)
50
51
  decimal *= 100 # to cents
51
52
  decimal.to_i
52
53
  end
@@ -17,7 +17,7 @@ module Tikkie
17
17
  end
18
18
 
19
19
  def amount
20
- decimal = BigDecimal.new(data[:amountInCents])
20
+ decimal = BigDecimal(data[:amountInCents])
21
21
  decimal /= 100.0
22
22
  decimal
23
23
  end
@@ -13,7 +13,7 @@ module Tikkie
13
13
  end
14
14
 
15
15
  def amount
16
- decimal = BigDecimal.new(data[:amountInCents])
16
+ decimal = BigDecimal(data[:amountInCents])
17
17
  decimal /= 100.0
18
18
  decimal
19
19
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tikkie
4
4
  module Api
5
- VERSION = "0.1.1"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
data/tikkie-api.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "tikkie/api/version"
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tikkie-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaa BV
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -160,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.7.6
163
+ rubygems_version: 3.0.1
165
164
  signing_key:
166
165
  specification_version: 4
167
166
  summary: Ruby library for communicating with the Tikkie API