streambird 1.0.3 → 1.0.4
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 +4 -4
- data/lib/streambird/api/magic_link.rb +1 -1
- data/lib/streambird/api/oauth_connection.rb +61 -0
- data/lib/streambird/api/user.rb +4 -4
- data/lib/streambird/api.rb +19 -1
- data/lib/streambird.rb +5 -0
- data/streambird-ruby.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa61092ff4d67dc8a847bd3853155cc4af1e2106fb48b606c7d69e4faf3a0e6c
|
4
|
+
data.tar.gz: 20f702acaaa95b4b0b195267bf967708244a5e2bc12ff073028e6a7747532060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2a514f4b385197f8e6fd74e8d2da494007d64a518bacecd22964a70bc3f6b2da1a3b52ca3cd2f33324c689444e961e6e89509a322b6ae06597acea2bdbd5b39
|
7
|
+
data.tar.gz: '068bacf35840a0b82386c83a503417b2f9d4fd75b98cb371a7e1ed1282d834a258fd07fbafe5674ca8dfd40666cd13f232b90201309658f2d543d023c3edb6c0'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class Streambird
|
2
|
+
class Api
|
3
|
+
class OAuthConnection < Struct.new(:client)
|
4
|
+
|
5
|
+
def create(provider:,
|
6
|
+
client_id:,
|
7
|
+
client_secret: nil,
|
8
|
+
team_id: nil,
|
9
|
+
key_id: nil,
|
10
|
+
private_key: nil,
|
11
|
+
domain: nil
|
12
|
+
)
|
13
|
+
req = {
|
14
|
+
'provider': provider,
|
15
|
+
'client_id': client_id,
|
16
|
+
}
|
17
|
+
|
18
|
+
req['client_secret'] = client_secret if !client_secret.nil?
|
19
|
+
req['team_id'] = team_id if !team_id.nil?
|
20
|
+
req['key_id'] = key_id if !key_id.nil?
|
21
|
+
req['private_key'] = private_key if !private_key.nil?
|
22
|
+
req['domain'] = domain if !domain.nil?
|
23
|
+
response = client.post('auth/oauth_connections/create', req)
|
24
|
+
json_body = JSON.parse(response.body, symbolize_names: true)
|
25
|
+
return json_body
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(oauth_connection_id:,
|
29
|
+
client_id: nil,
|
30
|
+
client_secret: nil,
|
31
|
+
team_id: nil,
|
32
|
+
key_id: nil,
|
33
|
+
private_key: nil,
|
34
|
+
domain: nil
|
35
|
+
)
|
36
|
+
req = {}
|
37
|
+
req['client_id'] = client_id if !client_id.nil?
|
38
|
+
req['client_secret'] = client_secret if !client_secret.nil?
|
39
|
+
req['team_id'] = team_id if !team_id.nil?
|
40
|
+
req['key_id'] = key_id if !key_id.nil?
|
41
|
+
req['private_key'] = private_key if !private_key.nil?
|
42
|
+
req['domain'] = domain if !domain.nil?
|
43
|
+
response = client.put("auth/oauth_connections/#{oauth_connection_id}/update", req)
|
44
|
+
json_body = JSON.parse(response.body, symbolize_names: true)
|
45
|
+
return json_body
|
46
|
+
end
|
47
|
+
|
48
|
+
def get(oauth_connection_id)
|
49
|
+
response = client.get("auth/oauth_connections/#{oauth_connection_id}")
|
50
|
+
json_body = JSON.parse(response.body, symbolize_names: true)
|
51
|
+
return json_body
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete(oauth_connection_id)
|
55
|
+
response = client.delete("auth/oauth_connections/#{oauth_connection_id}/delete")
|
56
|
+
json_body = JSON.parse(response.body, symbolize_names: true)
|
57
|
+
return json_body
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/streambird/api/user.rb
CHANGED
@@ -41,25 +41,25 @@ class Streambird
|
|
41
41
|
return json_body
|
42
42
|
end
|
43
43
|
|
44
|
-
def get(user_id
|
44
|
+
def get(user_id)
|
45
45
|
response = client.get("auth/users/#{user_id}")
|
46
46
|
json_body = JSON.parse(response.body, symbolize_names: true)
|
47
47
|
return json_body
|
48
48
|
end
|
49
49
|
|
50
|
-
def delete(user_id
|
50
|
+
def delete(user_id)
|
51
51
|
response = client.delete("auth/users/#{user_id}/delete")
|
52
52
|
json_body = JSON.parse(response.body, symbolize_names: true)
|
53
53
|
return json_body
|
54
54
|
end
|
55
55
|
|
56
|
-
def delete_email(email_id
|
56
|
+
def delete_email(email_id)
|
57
57
|
response = client.delete("auth/users/emails/#{email_id}/delete")
|
58
58
|
json_body = JSON.parse(response.body, symbolize_names: true)
|
59
59
|
return json_body
|
60
60
|
end
|
61
61
|
|
62
|
-
def delete_phone_number(phone_number_id
|
62
|
+
def delete_phone_number(phone_number_id)
|
63
63
|
response = client.delete("auth/users/phone_numbers/#{phone_number_id}/delete")
|
64
64
|
json_body = JSON.parse(response.body, symbolize_names: true)
|
65
65
|
return json_body
|
data/lib/streambird/api.rb
CHANGED
@@ -53,9 +53,27 @@ class Streambird
|
|
53
53
|
raise Streambird::Api::ConnectionError
|
54
54
|
end
|
55
55
|
|
56
|
+
def put(url, body = {})
|
57
|
+
body = default_request_params.merge(body)
|
58
|
+
response = connection.put do |req|
|
59
|
+
req.url "#{STREAMBIRD_API_URL}#{url}"
|
60
|
+
req.headers['Content-Type'] = 'application/json'
|
61
|
+
req.body = body.to_json
|
62
|
+
req.headers['X-API-Client'] = "Ruby"
|
63
|
+
req.headers["X-API-Client-Version"] = STREAMBIRD_RUBY_CLIENT_VERSION
|
64
|
+
end
|
65
|
+
|
66
|
+
if response.status != 200 and response.status != 201
|
67
|
+
return handle_error(response)
|
68
|
+
end
|
69
|
+
|
70
|
+
response
|
71
|
+
rescue Faraday::Error::ConnectionFailed
|
72
|
+
raise Streambird::Api::ConnectionError
|
73
|
+
end
|
74
|
+
|
56
75
|
|
57
76
|
def delete(url, body = {})
|
58
|
-
|
59
77
|
body = default_request_params.merge(body)
|
60
78
|
response = connection.delete do |req|
|
61
79
|
req.url "#{STREAMBIRD_API_URL}#{url}"
|
data/lib/streambird.rb
CHANGED
@@ -51,6 +51,10 @@ class Streambird
|
|
51
51
|
@wallets ||= Streambird::Api::Wallet.new(client)
|
52
52
|
end
|
53
53
|
|
54
|
+
def oauth_connections
|
55
|
+
@oauth_connections ||= Streambird::Api::OAuthConnection.new(client)
|
56
|
+
end
|
57
|
+
|
54
58
|
|
55
59
|
alias_method :live, :live?
|
56
60
|
alias_method :test, :test?
|
@@ -66,3 +70,4 @@ require 'streambird/api/user'
|
|
66
70
|
require 'streambird/api/oauth'
|
67
71
|
require 'streambird/api/session'
|
68
72
|
require 'streambird/api/wallet'
|
73
|
+
require 'streambird/api/oauth_connection'
|
data/streambird-ruby.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streambird
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- streambird
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/streambird/api/errors.rb
|
131
131
|
- lib/streambird/api/magic_link.rb
|
132
132
|
- lib/streambird/api/oauth.rb
|
133
|
+
- lib/streambird/api/oauth_connection.rb
|
133
134
|
- lib/streambird/api/otp.rb
|
134
135
|
- lib/streambird/api/session.rb
|
135
136
|
- lib/streambird/api/user.rb
|