convoy.rb 0.1.2 → 0.1.6

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: e2f73280f506ff144afd45f8efd2b04a13a137566db1d96e6b690c73ee9fe343
4
- data.tar.gz: 1a7eb1a48efb684e31f07b42134b1db0331f6a83cda8d7931c06c0df3d9faccc
3
+ metadata.gz: 679511eb7f64dc39761bb262a3f907a542bdfe389f66ec85dd57469a45187262
4
+ data.tar.gz: 321fa270104593343a6f86ea6ac0ba06790c8abdafa47a65736824b4726814dd
5
5
  SHA512:
6
- metadata.gz: 908ea5cfcd4fbe78fcc9e9169ded520ca72109cfb6d15ccd34bdfdaee105fdfdbdc560ffc1fe304e098fd82ae684e9e09b156704cc2abd024dbee4cdeaa8116a
7
- data.tar.gz: 3ea126e0dc28deea1b8b04d20e8fca3229454c85a3904591caa71437e19a3d7ab9be3afad1dd114ae7f442c27e6ccf67fa4b4235adbfed5cab3a276305d7b1e7
6
+ metadata.gz: dad8def0b41a90ad1197b24302da1076c05c3565cd15aa9c0955fba9c8d9237c0b4bd4c4865411290c8c0163d8a4cf8fae324c638effb2cebdc6c7c3d2f23e70
7
+ data.tar.gz: 320cd16a9063ba64763525484596b7fce8970827b6cc13a99faa0f6cbd8e353735a9df756d5e02e7171e0a4ce0b264096e6b2cdd47f625ea2d6f2ac40a4bd97f
@@ -11,10 +11,8 @@ module Convoy
11
11
  end
12
12
 
13
13
  def get
14
- response = send_request(resource_url, :get)
15
-
16
- data = JSON.parse(response.body)["data"]
17
- @data = data
14
+ send_request(resource_url, :get)
15
+ @data = @response['data']
18
16
  end
19
17
 
20
18
  def self.included(base)
@@ -13,10 +13,8 @@ module Convoy
13
13
  end
14
14
 
15
15
  def list
16
- response = send_request(resource_url, :get)
17
-
18
- data = JSON.parse(response.body)["data"]
19
- @data = data
16
+ send_request(resource_url, :get)
17
+ @data = @response['data']
20
18
  end
21
19
 
22
20
  def self.included(base)
@@ -43,13 +43,13 @@ module Convoy
43
43
  client.continue_timeout = 10
44
44
  client.ssl_timeout = 10
45
45
 
46
- # TODO: Make this configurable
47
- client.set_debug_output $stderr
46
+ client.set_debug_output $stderr if config.debug
48
47
 
49
48
  # Make request.
50
49
  http_response = client.request(request)
51
50
  @response = JSON.parse(http_response.body)
52
51
 
52
+ self
53
53
  # TODO: Perform err checks.
54
54
  end
55
55
  end
@@ -2,6 +2,7 @@ module Convoy
2
2
  class ConvoyConfiguration
3
3
 
4
4
  attr_accessor :ssl
5
+ attr_accessor :debug
5
6
  attr_accessor :username
6
7
  attr_accessor :password
7
8
  attr_accessor :base_uri
@@ -13,6 +14,7 @@ module Convoy
13
14
  @base_uri = "https://cloud.getconvoy.io"
14
15
  @path_version = "/v1"
15
16
  @ssl = true
17
+ @debug = false
16
18
  end
17
19
 
18
20
  end
@@ -0,0 +1,24 @@
1
+ module Convoy
2
+ class ApiKey < ApiResource
3
+ include ApiOperations::Get
4
+ include ApiOperations::Save
5
+ include ApiOperations::Delete
6
+ include ApiOperations::List
7
+ extend ApiOperations::Create
8
+
9
+ def initialize(id = nil, config = Convoy.config, **kwargs)
10
+ @id = id
11
+ @data = kwargs[:data].nil? ? {} : kwargs[:data]
12
+ @params = kwargs[:params].nil? ? {} : kwargs[:params]
13
+ @config = config
14
+ end
15
+
16
+ def resource_url
17
+ if @id.nil?
18
+ return "#{@config.base_uri}/#{@config.path_version}/security/keys"
19
+ end
20
+
21
+ "#{@config.base_uri}/#{@config.path_version}/security/keys" + "/#{@id}"
22
+ end
23
+ end
24
+ end
@@ -12,7 +12,6 @@ module Convoy
12
12
  @config = config
13
13
  end
14
14
 
15
-
16
15
  def resource_url
17
16
  if @id.nil?
18
17
  return "#{@config.base_uri}/#{@config.path_version}/applications"
@@ -1,3 +1,3 @@
1
1
  module Convoy
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/convoy.rb CHANGED
@@ -21,6 +21,7 @@ module Convoy
21
21
 
22
22
  # User configurable options
23
23
  def_delegators :@config, :ssl, :ssl=
24
+ def_delegators :@config, :debug, :debug=
24
25
  def_delegators :@config, :username, :username=
25
26
  def_delegators :@config, :password, :password=
26
27
  def_delegators :@config, :base_uri, :base_uri=
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.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subomi Oluwalana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk