convoy.rb 0.4.0 → 0.6.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: e8f15617864719123de4834de4b15ae72db7ab5015e9a58a5abd51e4d08dbdac
4
- data.tar.gz: 41e3736a899549a250bdfe9067e7b8c9d8cbbd24662c4eba4e6f2bebedabe3d0
3
+ metadata.gz: 55e874dfdeef131be14123cf5a802cf0af9e6e88ea68d893569a7b42fb996ebc
4
+ data.tar.gz: 577d6562282e9cfd73a9ef277e662379f90584bbc0f46003b3700568f948dc5b
5
5
  SHA512:
6
- metadata.gz: 65ec9158b0afd2ca52b44133f70aa9355ba515c520a78eddc95d1e2d576917c2a5e1bf9a40dae5caf6bc5e3f14a9b5798700a2c9928df03a10d9453198b30273
7
- data.tar.gz: a60f5bc98eef97a940fad99c84111c164f6948ce01c17929cea9c712ec1403084b293119895e88138f0284c1fc53419e797b5944cabcf55fc8159c312884a417
6
+ metadata.gz: 613b929f17244e46f02c84220176391fe3dccc697f9a315feb78306fe4ec23df077096ca5b641a1277e6a01651f4ac85723be8ea18bfbb92014b9a26d8b1433c
7
+ data.tar.gz: 78b53ef85b802110dd65ea674208cadbdee9fd8fee816f38b619976f0daf4288bdea86f747f43ce56cf0ff8738abb1321cfd35bdd54bca3670e9ca44156d94d5
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Convoy
2
- This is the official Convoy Ruby SDK. This SDK contains methods for easily interacting with Convoy's API. Below are examples to get you started. For additional examples, please see our official documentation at (https://convoy.readme.io/reference)
2
+ This is the official Convoy Ruby SDK. This SDK contains methods for easily interacting with Convoy's API. Below are examples to get you started. For the full API reference, please take a look at our [docs](https://getconvoy.io/docs).
3
3
 
4
4
  ## Installation
5
5
 
@@ -4,8 +4,8 @@ module Convoy
4
4
  module ApiOperations
5
5
  module List
6
6
  module ClassMethods
7
- def list(**kwargs)
8
- resource = self.new(**kwargs)
7
+ def list(*args, **kwargs)
8
+ resource = self.new(*args, **kwargs)
9
9
  resource.list
10
10
 
11
11
  resource
@@ -37,14 +37,7 @@ module Convoy
37
37
  end
38
38
 
39
39
  # Build HTTP Client.
40
- client = Net::HTTP.new(uri.host, uri.port)
41
- client.use_ssl = config.ssl
42
- client.open_timeout = 10
43
- client.read_timeout = 10
44
- client.continue_timeout = 10
45
- client.ssl_timeout = 10
46
-
47
- client.set_debug_output $stderr if config.debug
40
+ client = build_http_client(uri, config)
48
41
 
49
42
  # Make request.
50
43
  http_response = client.request(request)
@@ -53,6 +46,22 @@ module Convoy
53
46
  self
54
47
  # TODO: Perform err checks.
55
48
  end
49
+
50
+ private
51
+
52
+ def build_http_client(uri, config)
53
+ client = Net::HTTP.new(uri.host, uri.port)
54
+
55
+ client.use_ssl = config.ssl
56
+ client.open_timeout = config.http_open_timeout
57
+ client.read_timeout = config.http_read_timeout
58
+ client.continue_timeout = config.http_continue_timeout
59
+ client.ssl_timeout = config.http_ssl_timeout
60
+
61
+ client.set_debug_output $stderr if config.debug
62
+
63
+ client
64
+ end
56
65
  end
57
66
  end
58
67
  end
@@ -9,12 +9,20 @@ module Convoy
9
9
  attr_accessor :logger
10
10
  attr_accessor :log_level
11
11
  attr_accessor :project_id
12
+ attr_accessor :http_open_timeout
13
+ attr_accessor :http_read_timeout
14
+ attr_accessor :http_continue_timeout
15
+ attr_accessor :http_ssl_timeout
12
16
 
13
17
  def initialize
14
18
  @base_uri = "https://dashboard.getconvoy.io/api"
15
19
  @path_version = "/v1"
16
20
  @ssl = true
17
21
  @debug = false
22
+ @http_open_timeout = 10
23
+ @http_read_timeout = 10
24
+ @http_continue_timeout = 10
25
+ @http_ssl_timeout = 10
18
26
  end
19
27
 
20
28
  end
@@ -3,20 +3,20 @@ module Convoy
3
3
  include ApiOperations::Get
4
4
  include ApiOperations::List
5
5
 
6
- def initialize(eventId = nil, id = nil, config = Convoy.config, **kwargs)
6
+ def initialize(event_delivery_id = nil, id = nil, config = Convoy.config, **kwargs)
7
+ @event_delivery_id = event_delivery_id
7
8
  @id = id
8
- @eventId = eventId
9
9
  @config = config
10
-
10
+
11
11
  super(**kwargs)
12
12
  end
13
13
 
14
14
  def resource_uri
15
15
  if @id.nil?
16
- return "#{project_base_uri}/events/#{@eventId}/deliveryattempts"
16
+ return "#{project_base_uri}/eventdeliveries/#{@event_delivery_id}/deliveryattempts"
17
17
  end
18
18
 
19
- "#{project_base_uri}/events/#{@eventId}/deliveryattempts/#{@id}"
19
+ "#{project_base_uri}/eventdeliveries/#{@event_delivery_id}/deliveryattempts/#{@id}"
20
20
  end
21
21
  end
22
22
  end
@@ -25,5 +25,10 @@ module Convoy
25
25
  fanout_uri = "#{resource_uri}/fanout"
26
26
  send_request(fanout_uri, :post, data: @data, params: @params)
27
27
  end
28
+
29
+ def dynamic
30
+ dynamic_uri = "#{resource_uri}/dynamic"
31
+ send_request(dynamic_uri, :post, data: @data, params: @params)
32
+ end
28
33
  end
29
34
  end
@@ -3,9 +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, **kwargs)
6
+ def initialize(event_id = nil, id = nil, config = Convoy.config, **kwargs)
7
+ @event_id = event_id
7
8
  @id = id
8
- @eventId = eventId
9
9
  @config = config
10
10
 
11
11
  super(**kwargs)
@@ -13,13 +13,12 @@ module Convoy
13
13
 
14
14
  def resource_uri
15
15
  if @id.nil?
16
- return "#{project_base_uri}/events/#{@eventId}/eventdelivery"
16
+ return "#{project_base_uri}/eventdeliveries"
17
17
  end
18
18
 
19
- "#{project_base_uri}/events/#{@eventId}/eventdelivery/#{@id}"
19
+ "#{project_base_uri}/eventdeliveries/#{@id}"
20
20
  end
21
21
 
22
-
23
22
  def retry
24
23
  retry_uri = "#{resource_uri}/resend"
25
24
  send_request(retry_uri, :put, data: @data, params: @params)
@@ -0,0 +1,28 @@
1
+ module Convoy
2
+ class EventType < ApiResource
3
+ include ApiOperations::Get
4
+ include ApiOperations::List
5
+ include ApiOperations::Save
6
+ include ApiOperations::Create
7
+
8
+ def initialize(id = nil, config = Convoy.config, **kwargs)
9
+ @id = id
10
+ @config = config
11
+
12
+ super(**kwargs)
13
+ end
14
+
15
+ def resource_uri
16
+ if @id.nil?
17
+ return "#{project_base_uri}/event-types"
18
+ end
19
+
20
+ "#{project_base_uri}/event-types/#{@id}"
21
+ end
22
+
23
+ def deprecate
24
+ deprecate_url = "#{resource_uri}/deprecate"
25
+ send_request(deprecate_url, :post, data: @data, params: @params)
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Convoy
2
- VERSION = "0.4.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/convoy.rb CHANGED
@@ -29,5 +29,9 @@ module Convoy
29
29
  def_delegators :@config, :log_level, :log_level=
30
30
  def_delegators :@config, :path_version, :path_version=
31
31
  def_delegators :@config, :project_id, :project_id=
32
+ def_delegators :@config, :http_open_timeout, :http_open_timeout=
33
+ def_delegators :@config, :http_read_timeout, :http_read_timeout=
34
+ def_delegators :@config, :http_continue_timeout, :http_continue_timeout=
35
+ def_delegators :@config, :http_ssl_timeout, :http_ssl_timeout=
32
36
  end
33
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convoy.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subomi Oluwalana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-21 00:00:00.000000000 Z
11
+ date: 2025-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -58,6 +58,7 @@ files:
58
58
  - lib/convoy/resources/endpoint.rb
59
59
  - lib/convoy/resources/event.rb
60
60
  - lib/convoy/resources/event_delivery.rb
61
+ - lib/convoy/resources/event_type.rb
61
62
  - lib/convoy/resources/portal_link.rb
62
63
  - lib/convoy/resources/project.rb
63
64
  - lib/convoy/resources/source.rb