gocardless 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/gocardless/client.rb +9 -9
- data/lib/gocardless/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/lib/gocardless/client.rb
CHANGED
@@ -22,10 +22,6 @@ module GoCardless
|
|
22
22
|
def base_url
|
23
23
|
@base_url || BASE_URLS[GoCardless.environment || :production]
|
24
24
|
end
|
25
|
-
|
26
|
-
def api_url
|
27
|
-
"#{base_url}#{API_PATH}"
|
28
|
-
end
|
29
25
|
end
|
30
26
|
|
31
27
|
def initialize(args = {})
|
@@ -36,7 +32,7 @@ module GoCardless
|
|
36
32
|
raise ClientError.new("You must provide an app_secret") unless @app_secret
|
37
33
|
|
38
34
|
@oauth_client = OAuth2::Client.new(@app_id, @app_secret,
|
39
|
-
:site => self.
|
35
|
+
:site => self.base_url,
|
40
36
|
:token_url => '/oauth/access_token')
|
41
37
|
|
42
38
|
self.access_token = args[:token] if args[:token]
|
@@ -237,8 +233,8 @@ module GoCardless
|
|
237
233
|
headers = {
|
238
234
|
'Authorization' => "Basic #{credentials}"
|
239
235
|
}
|
240
|
-
request(:post, "#{
|
241
|
-
|
236
|
+
request(:post, "#{api_url}/confirm", :data => data,
|
237
|
+
:headers => headers)
|
242
238
|
|
243
239
|
# Initialize the correct class according to the resource's type
|
244
240
|
klass = GoCardless.const_get(Utils.camelize(params[:resource_type]))
|
@@ -283,6 +279,10 @@ module GoCardless
|
|
283
279
|
@base_url || self.class.base_url
|
284
280
|
end
|
285
281
|
|
282
|
+
def api_url
|
283
|
+
"#{base_url}#{API_PATH}"
|
284
|
+
end
|
285
|
+
|
286
286
|
private
|
287
287
|
|
288
288
|
# Return the merchant id, throwing a proper error if it's missing.
|
@@ -312,7 +312,7 @@ module GoCardless
|
|
312
312
|
opts[:body] = MultiJson.encode(opts[:data]) if !opts[:data].nil?
|
313
313
|
|
314
314
|
# Reset the URL in case the environment / base URL has been changed.
|
315
|
-
@oauth_client.site =
|
315
|
+
@oauth_client.site = base_url
|
316
316
|
|
317
317
|
header_keys = opts[:headers].keys.map(&:to_s)
|
318
318
|
if header_keys.map(&:downcase).include?('authorization')
|
@@ -380,7 +380,7 @@ module GoCardless
|
|
380
380
|
# @param [Hash] params the bill parameters
|
381
381
|
# @return [String] the generated URL
|
382
382
|
def new_limit_url(type, limit_params)
|
383
|
-
url = URI.parse("#{
|
383
|
+
url = URI.parse("#{base_url}/connect/#{type}s/new")
|
384
384
|
|
385
385
|
limit_params[:merchant_id] = merchant_id
|
386
386
|
redirect_uri = limit_params.delete(:redirect_uri)
|
data/lib/gocardless/version.rb
CHANGED