gocardless_pro 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +146 -0
  6. data/circle.yml +3 -0
  7. data/demo.rb +9 -0
  8. data/gocardless_pro.gemspec +26 -0
  9. data/lib/gocardless_pro.rb +73 -0
  10. data/lib/gocardless_pro/api_service.rb +58 -0
  11. data/lib/gocardless_pro/client.rb +135 -0
  12. data/lib/gocardless_pro/error.rb +42 -0
  13. data/lib/gocardless_pro/error/gocardless_error.rb +5 -0
  14. data/lib/gocardless_pro/error/invalid_api_usage_error.rb +5 -0
  15. data/lib/gocardless_pro/error/invalid_state_error.rb +5 -0
  16. data/lib/gocardless_pro/error/validation_error.rb +5 -0
  17. data/lib/gocardless_pro/list_response.rb +29 -0
  18. data/lib/gocardless_pro/paginator.rb +43 -0
  19. data/lib/gocardless_pro/request.rb +69 -0
  20. data/lib/gocardless_pro/resources/creditor.rb +84 -0
  21. data/lib/gocardless_pro/resources/creditor_bank_account.rb +78 -0
  22. data/lib/gocardless_pro/resources/customer.rb +75 -0
  23. data/lib/gocardless_pro/resources/customer_bank_account.rb +80 -0
  24. data/lib/gocardless_pro/resources/event.rb +75 -0
  25. data/lib/gocardless_pro/resources/helper.rb +29 -0
  26. data/lib/gocardless_pro/resources/mandate.rb +70 -0
  27. data/lib/gocardless_pro/resources/payment.rb +87 -0
  28. data/lib/gocardless_pro/resources/payout.rb +66 -0
  29. data/lib/gocardless_pro/resources/redirect_flow.rb +106 -0
  30. data/lib/gocardless_pro/resources/refund.rb +71 -0
  31. data/lib/gocardless_pro/resources/subscription.rb +155 -0
  32. data/lib/gocardless_pro/response.rb +77 -0
  33. data/lib/gocardless_pro/services/base_service.rb +28 -0
  34. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +119 -0
  35. data/lib/gocardless_pro/services/creditors_service.rb +113 -0
  36. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +154 -0
  37. data/lib/gocardless_pro/services/customers_service.rb +113 -0
  38. data/lib/gocardless_pro/services/events_service.rb +80 -0
  39. data/lib/gocardless_pro/services/helpers_service.rb +99 -0
  40. data/lib/gocardless_pro/services/mandates_service.rb +173 -0
  41. data/lib/gocardless_pro/services/payments_service.rb +168 -0
  42. data/lib/gocardless_pro/services/payouts_service.rb +82 -0
  43. data/lib/gocardless_pro/services/redirect_flows_service.rb +98 -0
  44. data/lib/gocardless_pro/services/refunds_service.rb +132 -0
  45. data/lib/gocardless_pro/services/subscriptions_service.rb +134 -0
  46. data/lib/gocardless_pro/version.rb +8 -0
  47. data/spec/api_service_spec.rb +73 -0
  48. data/spec/client_spec.rb +19 -0
  49. data/spec/error_spec.rb +44 -0
  50. data/spec/resources/creditor_bank_account_spec.rb +109 -0
  51. data/spec/resources/creditor_spec.rb +125 -0
  52. data/spec/resources/customer_bank_account_spec.rb +109 -0
  53. data/spec/resources/customer_spec.rb +135 -0
  54. data/spec/resources/event_spec.rb +113 -0
  55. data/spec/resources/helper_spec.rb +23 -0
  56. data/spec/resources/mandate_spec.rb +97 -0
  57. data/spec/resources/payment_spec.rb +129 -0
  58. data/spec/resources/payout_spec.rb +89 -0
  59. data/spec/resources/redirect_flow_spec.rb +97 -0
  60. data/spec/resources/refund_spec.rb +77 -0
  61. data/spec/resources/subscription_spec.rb +165 -0
  62. data/spec/response_spec.rb +89 -0
  63. data/spec/services/creditor_bank_accounts_service_spec.rb +413 -0
  64. data/spec/services/creditors_service_spec.rb +388 -0
  65. data/spec/services/customer_bank_accounts_service_spec.rb +452 -0
  66. data/spec/services/customers_service_spec.rb +429 -0
  67. data/spec/services/events_service_spec.rb +217 -0
  68. data/spec/services/helpers_service_spec.rb +122 -0
  69. data/spec/services/mandates_service_spec.rb +495 -0
  70. data/spec/services/payments_service_spec.rb +546 -0
  71. data/spec/services/payouts_service_spec.rb +217 -0
  72. data/spec/services/redirect_flows_service_spec.rb +254 -0
  73. data/spec/services/refunds_service_spec.rb +323 -0
  74. data/spec/services/subscriptions_service_spec.rb +557 -0
  75. data/spec/spec_helper.rb +91 -0
  76. metadata +224 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc56592c0c41639dd981845de276d9634b423c9c
4
+ data.tar.gz: 54d4dd9ed407bb39e3ce73de1fe0acfab24d3b61
5
+ SHA512:
6
+ metadata.gz: 48da3d84a089b8b8de211e397c21bdb8c4c495c743b22286a90f975a2858be91469f80e0d14be88efeb29592f4829ac69a371177daae2a918d7374bb85b5297b
7
+ data.tar.gz: c328b8e0cd31285c2979c80bf79854e65b672352d3f7fdc3c0df4f655de32f91a34cdbab950a164fccc5974ef1859790578919eafe210ff0a207b0e2ecb0a137
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 GoCardless
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # Ruby Client for GoCardless Pro API
2
+
3
+ - [YARD Docs](http://gocardless.github.io/pro-client-ruby/)
4
+ - [GoCardless Pro API Docs](https://developer.gocardless.com/pro/)
5
+ - [RubyGems](https://rubygems.org/gems/gocardless_pro)
6
+
7
+ This client is still in beta and is subject to change. Until a stable major version is released you should expect breaking changes.
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gocardless_pro'
13
+ ```
14
+
15
+ And then load it into your application:
16
+
17
+ ```ruby
18
+ require 'gocardless_pro'
19
+ ```
20
+
21
+ ## Usage Examples
22
+
23
+ - In the case of a single response, the client will return you an instance of the resource
24
+ - In the case of list responses, the client will return an instance of `ListResponse`, which is enumerable.
25
+ - You can also call `#all` to get a lazily paginated list of resource that will deal with making extra API requests to paginate through all the data
26
+
27
+ ### Initialising the client
28
+
29
+ The client is initialised with an Access Token.
30
+ You can also pass in `environment` as `:sandbox` to make requests to the sandbox environment rather than the live one.
31
+
32
+ ```rb
33
+ @client = GoCardlessPro::Client.new(
34
+ token: ENV["GOCARDLESS_TOKEN"]
35
+ )
36
+ ```
37
+
38
+ ### GET requests
39
+
40
+ You can make a request to get a list of resources using the `list` method:
41
+
42
+ ```rb
43
+ @client.customers.list
44
+ ```
45
+
46
+ This README will use `customers` throughout but each of the resources in the API is available in this library. They are defined in [`gocardless.rb`](https://github.com/gocardless/pro-client-ruby/blob/master/lib/gocardless_pro.rb#L87).
47
+
48
+ If you need to pass any options, the last (or in the absence of URL params, the only) argument is an options hash. This is used to pass query parameters for `GET` requests:
49
+
50
+ ```rb
51
+ @client.customers.list(params: { limit: 400 })
52
+ ```
53
+
54
+ A call to `list` returns an instance of `GoCardlessPro::ListResponse`. You can call `records` on this to iterate through results:
55
+
56
+ ```rb
57
+ @client.customers.list.records do |customer|
58
+ p customer.given_name
59
+ end
60
+ ```
61
+
62
+ In the case where a url parameter is needed, the method signature will contain required arguments:
63
+
64
+ ```rb
65
+ @client.customers.get(customers_id)
66
+ ```
67
+
68
+ As with list, the last argument can be an options hash, with any URL parameters given under the `params` key:
69
+
70
+ ```rb
71
+ @client.customers.get(customers_id, params: { limit: 200 })
72
+ ```
73
+
74
+ ### POST/PUT Requests
75
+
76
+ For POST and PUT requests you need to pass in the body in under the `params` key:
77
+
78
+ ```rb
79
+ @client.customers.create(
80
+ params: {
81
+ first_name: "Pete",
82
+ last_name: "Hamilton",
83
+ ...
84
+ }
85
+ )
86
+ ```
87
+
88
+ As with GET requests, if any parameters are required they come first:
89
+
90
+ ```rb
91
+ @client.customers.update(customer_id, {...})
92
+ ```
93
+
94
+ ### Custom Headers
95
+
96
+ If you need to pass in a custom header to an endpoint, you can pass in a `headers` object to the options hash:
97
+
98
+ ```rb
99
+ @client.helpers.mandate({
100
+ params: {
101
+ account_number: 200000,
102
+ ...
103
+ },
104
+ headers: {
105
+ 'Accept': 'application/pdf'
106
+ }
107
+ })
108
+ ```
109
+
110
+ There are very few endpoints in the API that require custom headers. Currently, the only ones that do are [helpers](https://developer.gocardless.com/pro/#api-endpoints-helpers).
111
+
112
+ ### Handling failures
113
+
114
+ When an API returns an error, the client __will raise__ an error that corresponds to the type of error. All errors subclass `GoCardless::Error`. There are four errors that could be thrown:
115
+
116
+ - `GoCardless::GoCardlessError`
117
+ - `GoCardless::InvalidApiUsageError`
118
+ - `GoCardless::InvalidStateError`
119
+ - `GoCardless::ValidationError`
120
+
121
+ These errors are fully documented in the [API documentation](https://developer.gocardless.com/pro/#overview-errors).
122
+
123
+ The error has the following methods to allow you to access the information from the API response:
124
+
125
+ - `#documentation_url`
126
+ - `#message`
127
+ - `#type`
128
+ - `#code`
129
+ - `#request_id`
130
+ - `#errors`
131
+
132
+ ## Supporting Ruby < 2.0.0
133
+ The client only supports Ruby >= 2.0.0 out of the box due to our use of
134
+ Enumerable::Lazy for lazy loading of paginated API resources.
135
+
136
+ However, support for previous ruby versions can be added using a gem such as
137
+ [backports](https://github.com/marcandre/backports).
138
+
139
+ 1. Add backports to your Gemfile
140
+ ```gem 'backports'```
141
+ 2. Require lazy enumerables
142
+ ```require 'backports/2.0.0/enumerable/lazy.rb'```
143
+
144
+ ## Contributing
145
+
146
+ This client is auto-generated from Crank, a toolchain that we hope to soon open source. Issues should for now be reported on this repository. __Please do not modify the source code yourself, your changes will be overriden!__
data/circle.yml ADDED
@@ -0,0 +1,3 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.0.0-p353
data/demo.rb ADDED
@@ -0,0 +1,9 @@
1
+ require_relative 'lib/gocardless_pro'
2
+
3
+ @client = GoCardlessPro::Client.new(
4
+ access_token: ENV["GOCARDLESS_TOKEN"],
5
+ environment: :sandbox
6
+ )
7
+
8
+ puts "Your first customer:"
9
+ puts "-> #{@client.customers.list.records.first.inspect}"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gocardless_pro/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gocardless_pro"
8
+ spec.version = GoCardlessPro::VERSION
9
+ spec.authors = %w(GoCardless)
10
+ spec.email = %w(engineering@gocardless.com)
11
+ spec.summary = %q{A gem for calling the GoCardless Pro API}
12
+ spec.homepage = "https://github.com/gocardless/gocardless-pro-ruby"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency 'rspec', '~> 3.1'
21
+ spec.add_development_dependency 'webmock', '~> 1.18'
22
+ spec.add_development_dependency 'rubocop', '~> 0.30.0'
23
+ spec.add_development_dependency 'yard', '~> 0.8.7.6'
24
+
25
+ spec.add_dependency 'faraday', ['>= 0.8.9', '< 0.10']
26
+ end
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+ #
3
+ # WARNING: Do not edit by hand, this file was generated by Crank:
4
+ #
5
+ # https://github.com/gocardless/crank
6
+ #
7
+
8
+ require 'json'
9
+ require 'zlib'
10
+ require 'faraday'
11
+ require 'time'
12
+
13
+ require 'uri'
14
+
15
+ module GoCardlessPro
16
+ end
17
+
18
+ version_file = 'gocardless_pro/version'
19
+
20
+ if File.file? File.expand_path("#{version_file}.rb", File.dirname(__FILE__))
21
+ require_relative version_file
22
+ else
23
+ GoCardlessPro::VERSION = ''
24
+ end
25
+
26
+ require_relative 'gocardless_pro/api_service'
27
+ require_relative 'gocardless_pro/list_response'
28
+ require_relative 'gocardless_pro/error'
29
+ require_relative 'gocardless_pro/error/validation_error'
30
+ require_relative 'gocardless_pro/error/gocardless_error'
31
+ require_relative 'gocardless_pro/error/invalid_api_usage_error'
32
+ require_relative 'gocardless_pro/error/invalid_state_error'
33
+ require_relative 'gocardless_pro/paginator'
34
+ require_relative 'gocardless_pro/request'
35
+ require_relative 'gocardless_pro/response'
36
+
37
+ require_relative 'gocardless_pro/resources/creditor'
38
+ require_relative 'gocardless_pro/services/creditors_service'
39
+
40
+ require_relative 'gocardless_pro/resources/creditor_bank_account'
41
+ require_relative 'gocardless_pro/services/creditor_bank_accounts_service'
42
+
43
+ require_relative 'gocardless_pro/resources/customer'
44
+ require_relative 'gocardless_pro/services/customers_service'
45
+
46
+ require_relative 'gocardless_pro/resources/customer_bank_account'
47
+ require_relative 'gocardless_pro/services/customer_bank_accounts_service'
48
+
49
+ require_relative 'gocardless_pro/resources/event'
50
+ require_relative 'gocardless_pro/services/events_service'
51
+
52
+ require_relative 'gocardless_pro/resources/helper'
53
+ require_relative 'gocardless_pro/services/helpers_service'
54
+
55
+ require_relative 'gocardless_pro/resources/mandate'
56
+ require_relative 'gocardless_pro/services/mandates_service'
57
+
58
+ require_relative 'gocardless_pro/resources/payment'
59
+ require_relative 'gocardless_pro/services/payments_service'
60
+
61
+ require_relative 'gocardless_pro/resources/payout'
62
+ require_relative 'gocardless_pro/services/payouts_service'
63
+
64
+ require_relative 'gocardless_pro/resources/redirect_flow'
65
+ require_relative 'gocardless_pro/services/redirect_flows_service'
66
+
67
+ require_relative 'gocardless_pro/resources/refund'
68
+ require_relative 'gocardless_pro/services/refunds_service'
69
+
70
+ require_relative 'gocardless_pro/resources/subscription'
71
+ require_relative 'gocardless_pro/services/subscriptions_service'
72
+
73
+ require_relative 'gocardless_pro/client.rb'
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+ #
3
+ # WARNING: Do not edit by hand, this file was generated by Crank:
4
+ #
5
+ # https://github.com/gocardless/crank
6
+ #
7
+ require 'uri'
8
+ require 'base64'
9
+
10
+ module GoCardlessPro
11
+ # GoCardless Pro API
12
+ class ApiService
13
+ # Initialize an APIService
14
+ #
15
+ # @param url [String] the URL to make requests to
16
+ # @param key [String] the API Key ID to use
17
+ # @param secret [String] the API key secret to use
18
+ # @param options [Hash] additional options to use when creating the service
19
+ def initialize(url, token, options = {})
20
+ @url = url
21
+ root_url, @path_prefix = unpack_url(url)
22
+ http_adapter = options[:http_adapter] || [:net_http]
23
+ @connection = Faraday.new(url: root_url) do |faraday|
24
+ faraday.adapter(*http_adapter)
25
+ end
26
+
27
+ @headers = options[:default_headers] || {}
28
+ @headers['Authorization'] = "Bearer #{token}"
29
+ end
30
+
31
+ # Make a request to the API
32
+ #
33
+ # @param method [Symbol] the method to use to make the request
34
+ # @param path [String] the URL (without the base domain) to make the request to
35
+ # @param options [Hash] the options hash
36
+ def make_request(method, path, options = {})
37
+ fail ArgumentError, 'options must be a hash' unless options.is_a?(Hash)
38
+ options[:headers] ||= {}
39
+ options[:headers] = @headers.merge(options[:headers])
40
+ Request.new(@connection, method, @path_prefix + path, options).request
41
+ end
42
+
43
+ # inspect the API Service
44
+ def inspect
45
+ url = URI.parse(@url)
46
+ url.password = 'REDACTED' unless url.password.nil?
47
+ "#<GoCardlessPro::Client url=\"#{url}\">"
48
+ end
49
+ alias_method :to_s, :inspect
50
+
51
+ private
52
+
53
+ def unpack_url(url)
54
+ path = URI.parse(url).path
55
+ [URI.join(url).to_s, path == '/' ? '' : path]
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,135 @@
1
+ module GoCardlessPro
2
+ # A class for working with and talking to the GoCardless API
3
+ class Client
4
+ extend Forwardable
5
+
6
+ # Access to the service for creditor to make API calls
7
+ def creditors
8
+ @creditors ||= Services::CreditorsService.new(@api_service)
9
+ end
10
+
11
+ # Access to the service for creditor_bank_account to make API calls
12
+ def creditor_bank_accounts
13
+ @creditor_bank_accounts ||= Services::CreditorBankAccountsService.new(@api_service)
14
+ end
15
+
16
+ # Access to the service for customer to make API calls
17
+ def customers
18
+ @customers ||= Services::CustomersService.new(@api_service)
19
+ end
20
+
21
+ # Access to the service for customer_bank_account to make API calls
22
+ def customer_bank_accounts
23
+ @customer_bank_accounts ||= Services::CustomerBankAccountsService.new(@api_service)
24
+ end
25
+
26
+ # Access to the service for event to make API calls
27
+ def events
28
+ @events ||= Services::EventsService.new(@api_service)
29
+ end
30
+
31
+ # Access to the service for helper to make API calls
32
+ def helpers
33
+ @helpers ||= Services::HelpersService.new(@api_service)
34
+ end
35
+
36
+ # Access to the service for mandate to make API calls
37
+ def mandates
38
+ @mandates ||= Services::MandatesService.new(@api_service)
39
+ end
40
+
41
+ # Access to the service for payment to make API calls
42
+ def payments
43
+ @payments ||= Services::PaymentsService.new(@api_service)
44
+ end
45
+
46
+ # Access to the service for payout to make API calls
47
+ def payouts
48
+ @payouts ||= Services::PayoutsService.new(@api_service)
49
+ end
50
+
51
+ # Access to the service for redirect_flow to make API calls
52
+ def redirect_flows
53
+ @redirect_flows ||= Services::RedirectFlowsService.new(@api_service)
54
+ end
55
+
56
+ # Access to the service for refund to make API calls
57
+ def refunds
58
+ @refunds ||= Services::RefundsService.new(@api_service)
59
+ end
60
+
61
+ # Access to the service for subscription to make API calls
62
+ def subscriptions
63
+ @subscriptions ||= Services::SubscriptionsService.new(@api_service)
64
+ end
65
+
66
+ # Get a Client configured to use HTTP Basic authentication with the GC Api
67
+ #
68
+ # @param options [Hash<Symbol,String>] configuration for creating the client
69
+ # @option options [Symbol] :environment the environment to connect to - one of `:live` or `:sandbox`.
70
+ # @option options [Symbol] :access_token the API token
71
+ # @option options [Symbol] :url the full URL used to make requests to. If you specify this, it will be used over the `environment` option.
72
+ # @return [Client] A client configured to use the API with HTTP Basic
73
+ # authentication.
74
+ #
75
+ def initialize(options)
76
+ access_token = options.delete(:access_token) || fail('No Access Token given to GoCardless Client')
77
+ environment = options.delete(:environment) || :live
78
+ url = options.delete(:url) || url_for_environment(environment)
79
+ options = custom_options(options)
80
+ @api_service = ApiService.new(url, access_token, options)
81
+ end
82
+
83
+ private
84
+
85
+ def url_for_environment(environment)
86
+ if environment === :live
87
+ 'https://api.gocardless.com'
88
+ elsif environment === :sandbox
89
+ 'https://api-sandbox.gocardless.com'
90
+ else
91
+ fail "Unknown environment key: #{environment}"
92
+ end
93
+ end
94
+
95
+ # Get customized options.
96
+ def custom_options(options)
97
+ return default_options if options.nil?
98
+
99
+ return default_options.merge(options) unless options[:default_headers]
100
+
101
+ opts = default_options.merge(options)
102
+ opts[:default_headers] = default_options[:default_headers].merge(options[:default_headers])
103
+
104
+ opts
105
+ end
106
+
107
+ # Get the default options.
108
+ def default_options
109
+ {
110
+ default_headers: {
111
+ 'GoCardless-Version' => '2015-04-29',
112
+ 'User-Agent' => "#{user_agent}",
113
+ 'Content-Type' => 'application/json'
114
+ }
115
+ }
116
+ end
117
+
118
+ def user_agent
119
+ @user_agent ||=
120
+ begin
121
+ gem_name = 'gocardless_pro'
122
+ gem_info = "#{gem_name}"
123
+ gem_info += "/v#{ GoCardlessPro::VERSION}" if defined?(GoCardlessPro::VERSION)
124
+ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
125
+ ruby_version = RUBY_VERSION
126
+ ruby_version += " p#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL)
127
+ comment = ["#{ruby_engine} #{ruby_version}"]
128
+ comment << "gocardless_pro v#{ GoCardlessPro::VERSION}"
129
+ comment << "faraday v#{Faraday::VERSION}"
130
+ comment << RUBY_PLATFORM if defined?(RUBY_PLATFORM)
131
+ "#{gem_info} (#{comment.join('; ')})"
132
+ end
133
+ end
134
+ end
135
+ end