convoy.rb 0.1.7 → 0.1.8

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: e4859252007849854b7c45c72d7d2e9a32eb2e8f627bc1a7c85e098bb1e37b38
4
- data.tar.gz: e2dfa339703c652c9df8bf901c084898435debbac17d8d6d4c62f5fdd965b3ea
3
+ metadata.gz: ee919edcdd707b9e06dc0106c3925878397766c114e7742475a7c87aee9db66d
4
+ data.tar.gz: 1cb0aab99274569dcba20195d43b93275bd555412f3c558040fd6b2d9cea8c34
5
5
  SHA512:
6
- metadata.gz: 220f5231cc5f405c781d3ef147125c1b967769183e7532751f2803cdd04597d15d729e0084696bf03e67e4e48e23104eab10202b2a1808717dad0bb20e540eb1
7
- data.tar.gz: 4eff66338f0f6ee4c00a519d278b5d173c6742dc369ec26038a31c2a60076f84046e7ec24b698db41d03e37a0eacd3fa7c421b1da428abb489a4bbd66ef9988e
6
+ metadata.gz: 6f9137bdef6d7894adacc0665a161cd437fcfcd2739b59b7867131b0655c1d63602f210d017494c8dd5197247328f7fb84f955bbf0b2c1e698fe1e8c134bd4d2
7
+ data.tar.gz: 4be077174a93871e7c9f9c38a0110709327aa7aa8590e5fd5924e672df84f0a13984bdf05ba7b2c63b6a144e302c272dc119a3070c0ffff8fd3e0b779b301714
@@ -11,7 +11,7 @@ module Convoy
11
11
  end
12
12
 
13
13
  def delete
14
- send_request(resource_url, :delete)
14
+ send_request(resource_url, :delete, params: @params)
15
15
  end
16
16
 
17
17
  def self.included(base)
@@ -11,7 +11,7 @@ module Convoy
11
11
  end
12
12
 
13
13
  def get
14
- send_request(resource_url, :get)
14
+ send_request(resource_url, :get, params: @params)
15
15
  @data = @response['data']
16
16
  end
17
17
 
@@ -13,7 +13,7 @@ module Convoy
13
13
  end
14
14
 
15
15
  def list
16
- send_request(resource_url, :get)
16
+ send_request(resource_url, :get, params: @params)
17
17
  @data = @response['data']
18
18
  end
19
19
 
@@ -32,8 +32,11 @@ module Convoy
32
32
  req
33
33
  end
34
34
 
35
- request.basic_auth config.username, config.password
36
-
35
+ if !config.api_key.nil?
36
+ request['Authorization'] = "Bearer #{config.api_key}"
37
+ else
38
+ request.basic_auth config.username, config.password
39
+ end
37
40
 
38
41
  # Build HTTP Client.
39
42
  client = Net::HTTP.new(uri.host, uri.port)
@@ -5,6 +5,7 @@ module Convoy
5
5
  attr_accessor :debug
6
6
  attr_accessor :username
7
7
  attr_accessor :password
8
+ attr_accessor :api_key
8
9
  attr_accessor :base_uri
9
10
  attr_accessor :path_version
10
11
  attr_accessor :logger
@@ -3,9 +3,10 @@ module Convoy
3
3
  include ApiOperations::Get
4
4
  include ApiOperations::List
5
5
 
6
- def initialize(eventId = nil, id = nil, config = Convoy.config)
6
+ def initialize(eventId = nil, id = nil, config = Convoy.config, **kwargs)
7
7
  @eventId = eventId
8
8
  @id = id
9
+ @params = kwargs[:params].nil? ? {} : kwargs[:params]
9
10
  @config = config
10
11
  end
11
12
 
@@ -10,6 +10,7 @@ module Convoy
10
10
  @app_id = app_id
11
11
  @id = id
12
12
  @data = kwargs[:data].nil? ? {} : kwargs[:data]
13
+ @params = kwargs[:params].nil? ? {} : kwargs[:params]
13
14
  @config = config
14
15
  end
15
16
 
@@ -3,8 +3,9 @@ module Convoy
3
3
  include ApiOperations::Get
4
4
  include ApiOperations::List
5
5
 
6
- def intialize(eventId = nil, id = nil, config = Convoy.config)
6
+ def intialize(eventId = nil, id = nil, config = Convoy.config, **kwargs)
7
7
  @eventId = eventId
8
+ @params = kwargs[:params].nil? ? {} : kwargs[:params]
8
9
  @id = id
9
10
  @config = config
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module Convoy
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/lib/convoy.rb CHANGED
@@ -20,10 +20,12 @@ module Convoy
20
20
  attr_reader :config
21
21
 
22
22
  # User configurable options
23
+ # Some of them have defaults
23
24
  def_delegators :@config, :ssl, :ssl=
24
25
  def_delegators :@config, :debug, :debug=
25
26
  def_delegators :@config, :username, :username=
26
27
  def_delegators :@config, :password, :password=
28
+ def_delegators :@config, :api_key, :api_key=
27
29
  def_delegators :@config, :base_uri, :base_uri=
28
30
  def_delegators :@config, :logger, :logger=
29
31
  def_delegators :@config, :log_level, :log_level=
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convoy.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subomi Oluwalana