rdstation-ruby-client 2.5.0 → 2.5.2

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
  SHA256:
3
- metadata.gz: 5df3763feda5bcb841946b403695b54933c0fcc9b0b9da1c907146454e5311ff
4
- data.tar.gz: 63cd80564336415bc361c3dfce276611d1b1a6b61c68554e4f1a212c73fd9c7e
3
+ metadata.gz: 17ec6b63514d59fdb9636ddb0b47fd90e05e748a9b24178f752759517f488f80
4
+ data.tar.gz: a595c4bbb8072465e682c0984d2ed325a02d765f9580608657e0f7801f6af5a7
5
5
  SHA512:
6
- metadata.gz: 60eded16372c0d970d67b5f456a28d8adb9e7f013f8551e56b72598752ea9a0c24f99fdf4f3c943f040872d71a837279d769b43ac7b2e36d2c0c5eaa8ae9f405
7
- data.tar.gz: 1107d1405d1984cd36de905403f3a53a6275505e55ff4c4d5661f7914d268f11031d81c5602464ca2f573b61831d5516a437abe9501a1fd8a34549ec3a36753f
6
+ metadata.gz: 0c79824e536efc20f694d6a2b13fe1a4f1456db6aff0a3f2172320e67a2d18196fab72b5e8057b9f8b3e72e9bbf19d27dfa2363091e581a96a72c5dfdc38243f
7
+ data.tar.gz: 85990fc3fcc31d67424d7c59bb9cdeeb7d9519e5d170a27fcca6782e4f9165ec3cf77f4968622024c0a3fbe5a95af66f0690a07a18cef36c15d9d5e333629b49
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "06:00"
8
+ timezone: Etc/UCT
9
+ pull-request-branch-name:
10
+ separator: "-"
11
+ open-pull-requests-limit: 10
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.5.1
2
+
3
+ - Fixed checking `empty?` for nil values inside of InvalidRefreshToken class
4
+
1
5
  ## 2.5.0
2
6
 
3
7
  - InvalidRefreshToken error added. This error will be raised when the refresh token is invalid or it was revoked. When you get this error, you can safely disconnect the user from RD Station.
@@ -3,9 +3,9 @@ module RDStation
3
3
  class Authentication
4
4
  include HTTParty
5
5
 
6
- AUTH_TOKEN_URL = 'https://api.rd.services/auth/token'.freeze
6
+ AUTH_TOKEN_URL = "#{RDStation.host}/auth/token".freeze
7
7
  DEFAULT_HEADERS = { 'Content-Type' => 'application/json' }.freeze
8
- REVOKE_URL = 'https://api.rd.services/auth/revoke'.freeze
8
+ REVOKE_URL = "#{RDStation.host}/auth/revoke".freeze
9
9
 
10
10
  def initialize(client_id = nil, client_secret = nil)
11
11
  warn_deprecation if client_id || client_secret
@@ -19,7 +19,7 @@ module RDStation
19
19
  # after confirming application authorization
20
20
  #
21
21
  def auth_url(redirect_url)
22
- "https://api.rd.services/auth/dialog?client_id=#{@client_id}&redirect_url=#{redirect_url}"
22
+ "#{RDStation.host}/auth/dialog?client_id=#{@client_id}&redirect_url=#{redirect_url}"
23
23
  end
24
24
 
25
25
  # Public: Get the credentials from RD Station API
@@ -64,7 +64,7 @@ module RDStation
64
64
  private
65
65
 
66
66
  def base_url(path = '')
67
- "https://api.rd.services/platform/contacts/#{path}"
67
+ "#{RDStation.host}/platform/contacts/#{path}"
68
68
  end
69
69
  end
70
70
  end
@@ -10,7 +10,8 @@ module RDStation
10
10
  end
11
11
 
12
12
  def raise_error
13
- return if invalid_refresh_token_error.empty?
13
+ return unless invalid_refresh_token_error
14
+
14
15
  raise RDStation::Error::InvalidRefreshToken, invalid_refresh_token_error
15
16
  end
16
17
 
@@ -3,7 +3,7 @@ module RDStation
3
3
  include HTTParty
4
4
  include ::RDStation::RetryableRequest
5
5
 
6
- EVENTS_ENDPOINT = 'https://api.rd.services/platform/events'.freeze
6
+ EVENTS_ENDPOINT = "#{RDStation.host}/platform/events".freeze
7
7
 
8
8
  def initialize(authorization:)
9
9
  @authorization = authorization
@@ -5,7 +5,7 @@ module RDStation
5
5
  include HTTParty
6
6
  include ::RDStation::RetryableRequest
7
7
 
8
- BASE_URL = 'https://api.rd.services/platform/contacts/fields'.freeze
8
+ BASE_URL = "#{RDStation.host}/platform/contacts/fields".freeze
9
9
 
10
10
  def initialize(authorization:)
11
11
  @authorization = authorization
@@ -1,3 +1,3 @@
1
1
  module RDStation
2
- VERSION = '2.5.0'.freeze
2
+ VERSION = '2.5.2'.freeze
3
3
  end
@@ -51,7 +51,7 @@ module RDStation
51
51
  end
52
52
 
53
53
  def base_url(path = '')
54
- "https://api.rd.services/integrations/webhooks/#{path}"
54
+ "#{RDStation.host}/integrations/webhooks/#{path}"
55
55
  end
56
56
  end
57
57
  end
data/lib/rdstation.rb CHANGED
@@ -2,14 +2,21 @@ module RDStation
2
2
  class << self
3
3
  attr_accessor :configuration
4
4
 
5
+ HOST = 'https://api.rd.services'.freeze
6
+
5
7
  def configure
6
8
  self.configuration ||= Configuration.new
9
+ self.configuration.base_host = HOST
7
10
  yield(configuration)
8
11
  end
12
+
13
+ def host
14
+ self.configuration&.base_host || HOST
15
+ end
9
16
  end
10
-
17
+
11
18
  class Configuration
12
- attr_accessor :client_id, :client_secret
19
+ attr_accessor :client_id, :client_secret, :base_host
13
20
  attr_reader :access_token_refresh_callback
14
21
 
15
22
  def on_access_token_refresh(&block)
@@ -1,18 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe RDStation do
4
- describe '.configure' do
5
- let(:client_id) { 'client_id' }
6
- let(:client_secret) { 'client_secret' }
4
+ let(:client_id) { 'client_id' }
5
+ let(:client_secret) { 'client_secret' }
6
+ let(:base_host) { 'https://test-api.rd.services' }
7
+
8
+ before do
9
+ RDStation.configure do |config|
10
+ config.client_id = client_id
11
+ config.client_secret = client_secret
12
+ config.base_host = base_host
13
+ end
14
+ end
15
+
16
+ after { RDStation.configure {} }
7
17
 
18
+ describe '.configure' do
8
19
  it 'sets the configuration' do
9
- RDStation.configure do |config|
10
- config.client_id = client_id
11
- config.client_secret = client_secret
20
+ expect(RDStation.configuration.client_id).to eq(client_id)
21
+ expect(RDStation.configuration.client_secret).to eq(client_secret)
22
+ expect(RDStation.configuration.base_host).to eq(base_host)
23
+ end
24
+ end
25
+
26
+ describe '.host' do
27
+ context 'when base_host is defined in configuration' do
28
+ it 'returns specified host' do
29
+ expect(RDStation.host).to eq(base_host)
12
30
  end
31
+ end
32
+
33
+ context 'when base_host is not defined in configuration' do
34
+ it 'returns default host' do
35
+ RDStation.configure {}
13
36
 
14
- expect(RDStation.configuration.client_id).to eq client_id
15
- expect(RDStation.configuration.client_secret).to eq client_secret
37
+ expect(RDStation.host).to eq('https://api.rd.services')
38
+ end
16
39
  end
17
40
  end
18
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdstation-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo L F Casaretto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ extra_rdoc_files: []
131
131
  files:
132
132
  - ".circleci/config.yml"
133
133
  - ".github/ISSUE_TEMPLATE/rdsm-ruby-client-issue-template.md"
134
+ - ".github/dependabot.yml"
134
135
  - ".gitignore"
135
136
  - ".rspec"
136
137
  - CHANGELOG.md
@@ -192,7 +193,7 @@ homepage: http://resultadosdigitais.com.br
192
193
  licenses:
193
194
  - MIT
194
195
  metadata: {}
195
- post_install_message:
196
+ post_install_message:
196
197
  rdoc_options: []
197
198
  require_paths:
198
199
  - lib
@@ -207,9 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  - !ruby/object:Gem::Version
208
209
  version: '0'
209
210
  requirements: []
210
- rubyforge_project:
211
- rubygems_version: 2.7.6.2
212
- signing_key:
211
+ rubygems_version: 3.2.32
212
+ signing_key:
213
213
  specification_version: 4
214
214
  summary: Ruby API wrapper for RD Station
215
215
  test_files: