stytch 0.1.8 → 0.1.14

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: f78c9a111464963c4c5720743961c8fa40109900c867e0771b06e009f3940ade
4
- data.tar.gz: 9594ec5391ab2679511291c8057945008afeb9e3b2012d1bf28e9cb41179c701
3
+ metadata.gz: c8b8368ac805dc6fab37019952fb4212d253f02c178fd1252d2495acc9bef967
4
+ data.tar.gz: 51eb55471aca49aff3f30415fecda9911f79f3c390ccc9e9f8129a82084ae94d
5
5
  SHA512:
6
- metadata.gz: fbf40c48a6fd68f8cf86b1b6f0e3362baa66c7354477f146fbd3bbab2ddf9b83882470b39ef1a76dcd786ce87435ce8e059f575622323f9fd664ce87ccbd6c15
7
- data.tar.gz: 1337d3a4020bed0a65c847d2b92717895bb1059336c85f40648d4d65973d4223e76cad8995242502bc6dd0169bb000f88dca5205de2ff5ff94a011c4f4cca9b0
6
+ metadata.gz: d7b3b92df95967d07997421b29f2dd53cff3be399c1daa5db4f1207cfcd99ae59394b2b4b436baea556fa6e6e5545b32abd86399d0a46d65ee7ca50bcb7006f2
7
+ data.tar.gz: 53bc8fc1a34c9afeec90296935e48ab79438761b2f09e34e75c6bd06dc9c46c92665988f123bd91bc1cba896a0f81c835b18c078ef44e2426416c10585f1fa6a
@@ -1,11 +1,9 @@
1
1
  require_relative 'endpoints/user'
2
- require_relative 'endpoints/email'
3
2
  require_relative 'endpoints/magic'
4
3
 
5
4
  module Stytch
6
5
  class Client
7
6
  include Stytch::Endpoints::User
8
- include Stytch::Endpoints::Email
9
7
  include Stytch::Endpoints::Magic
10
8
 
11
9
  ENVIRONMENTS = %i[live test].freeze
@@ -72,4 +70,4 @@ module Stytch
72
70
  ).body
73
71
  end
74
72
  end
75
- end
73
+ end
@@ -8,7 +8,6 @@ module Stytch
8
8
  user_id:,
9
9
  magic_link_url:,
10
10
  expiration_minutes:,
11
- template_id: nil,
12
11
  attributes: {}
13
12
  )
14
13
  request = {
@@ -18,7 +17,6 @@ module Stytch
18
17
  expiration_minutes: expiration_minutes,
19
18
  }
20
19
 
21
- request[:template_id] = template_id if template_id != nil
22
20
  request[:attributes] = attributes if attributes != {}
23
21
 
24
22
  post("#{PATH}/send", request)
@@ -28,7 +26,6 @@ module Stytch
28
26
  email:,
29
27
  magic_link_url:,
30
28
  expiration_minutes:,
31
- template_id: nil,
32
29
  attributes: {}
33
30
  )
34
31
  request = {
@@ -37,7 +34,6 @@ module Stytch
37
34
  expiration_minutes: expiration_minutes,
38
35
  }
39
36
 
40
- request[:template_id] = template_id if template_id != nil
41
37
  request[:attributes] = attributes if attributes != {}
42
38
 
43
39
  post("#{PATH}/send_by_email", request)
@@ -49,8 +45,6 @@ module Stytch
49
45
  signup_magic_link_url:,
50
46
  login_expiration_minutes: nil,
51
47
  signup_expiration_minutes: nil,
52
- login_template_id: nil,
53
- signup_template_id: nil,
54
48
  attributes: {}
55
49
  )
56
50
 
@@ -60,9 +54,7 @@ module Stytch
60
54
  signup_magic_link_url: signup_magic_link_url,
61
55
  }
62
56
 
63
- request[:login_template_id] = login_template_id if login_template_id != nil
64
57
  request[:login_expiration_minutes] = login_expiration_minutes if login_expiration_minutes != nil
65
- request[:signup_template_id] = signup_template_id if signup_template_id != nil
66
58
  request[:signup_expiration_minutes] = signup_expiration_minutes if signup_expiration_minutes != nil
67
59
  request[:attributes] = attributes if attributes != {}
68
60
 
@@ -75,8 +67,6 @@ module Stytch
75
67
  invite_magic_link_url:,
76
68
  login_expiration_minutes: nil,
77
69
  invite_expiration_minutes: nil,
78
- login_template_id: nil,
79
- signup_template_id: nil,
80
70
  attributes: {}
81
71
  )
82
72
 
@@ -86,15 +76,42 @@ module Stytch
86
76
  invite_magic_link_url: invite_magic_link_url,
87
77
  }
88
78
 
89
- request[:login_template_id] = login_template_id if login_template_id != nil
90
79
  request[:login_expiration_minutes] = login_expiration_minutes if login_expiration_minutes != nil
91
- request[:invite_template_id] = invite_template_id if invite_template_id != nil
92
80
  request[:invite_expiration_minutes] = invite_expiration_minutes if invite_expiration_minutes != nil
93
81
  request[:attributes] = attributes if attributes != {}
94
82
 
95
83
  post("#{PATH}/login_or_invite", request)
96
84
  end
97
85
 
86
+ def invite_by_email(
87
+ email:,
88
+ magic_link_url:,
89
+ expiration_minutes: nil,
90
+ attributes: {}
91
+ )
92
+
93
+ request = {
94
+ email: email,
95
+ magic_link_url: magic_link_url,
96
+ }
97
+
98
+ request[:expiration_minutes] = expiration_minutes if expiration_minutes != nil
99
+ request[:attributes] = attributes if attributes != {}
100
+
101
+ post("#{PATH}/invite_by_email", request)
102
+ end
103
+
104
+ def revoke_invite_by_email(
105
+ email:
106
+ )
107
+
108
+ request = {
109
+ email: email,
110
+ }
111
+
112
+ post("#{PATH}/revoke_invite", request)
113
+ end
114
+
98
115
  def authenticate_magic(
99
116
  token:,
100
117
  attributes: {},
@@ -109,4 +126,4 @@ module Stytch
109
126
  end
110
127
  end
111
128
  end
112
- end
129
+ end
@@ -7,6 +7,10 @@ module Stytch
7
7
  get("#{PATH}/#{user_id}")
8
8
  end
9
9
 
10
+ def get_invited_users()
11
+ get("#{PATH}/invites")
12
+ end
13
+
10
14
  def create_user(
11
15
  email:,
12
16
  name: {},
@@ -24,15 +28,15 @@ module Stytch
24
28
 
25
29
  def update_user(
26
30
  user_id:,
27
- name: nil,
31
+ name: {},
28
32
  emails: [],
29
33
  attributes: {}
30
34
  )
31
35
  request = {
32
- name: name,
33
36
  emails: format_emails(emails),
34
37
  }
35
38
 
39
+ request[:name] = name if name != {}
36
40
  request[:attributes] = attributes if attributes != {}
37
41
 
38
42
  put("#{PATH}/#{user_id}", request)
@@ -42,6 +46,13 @@ module Stytch
42
46
  delete("#{PATH}/#{user_id}")
43
47
  end
44
48
 
49
+ def delete_user_email(
50
+ user_id:,
51
+ email:
52
+ )
53
+ delete("#{PATH}/#{user_id}/emails/#{email}")
54
+ end
55
+
45
56
  private
46
57
 
47
58
  def format_emails(emails)
@@ -51,4 +62,4 @@ module Stytch
51
62
  end
52
63
  end
53
64
  end
54
- end
65
+ end
@@ -13,4 +13,4 @@ module Stytch
13
13
 
14
14
  NETWORK_TIMEOUT = 300
15
15
  end
16
- end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Stytch
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.14"
3
3
  end
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency 'faraday', '~> 1.1.0'
27
- spec.add_dependency 'faraday_middleware', '~> 1.0.0'
26
+ spec.add_dependency 'faraday', '>= 0.17.0', '< 2.0'
27
+ spec.add_dependency 'faraday_middleware', '>= 0.14.0', '< 2.0'
28
28
  end
metadata CHANGED
@@ -1,43 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex-stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 0.17.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.17.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 1.1.0
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 1.0.0
39
+ version: 0.14.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.14.0
50
+ - - "<"
39
51
  - !ruby/object:Gem::Version
40
- version: 1.0.0
52
+ version: '2.0'
41
53
  description:
42
54
  email:
43
55
  - alex@stytch.com
@@ -57,7 +69,6 @@ files:
57
69
  - bin/setup
58
70
  - lib/stytch.rb
59
71
  - lib/stytch/client.rb
60
- - lib/stytch/endpoints/email.rb
61
72
  - lib/stytch/endpoints/magic.rb
62
73
  - lib/stytch/endpoints/user.rb
63
74
  - lib/stytch/middleware.rb
@@ -1,30 +0,0 @@
1
- module Stytch
2
- module Endpoints
3
- module Email
4
- PATH = "/v1/emails".freeze
5
-
6
- def send_email_verification(
7
- user_id:,
8
- email_id:,
9
- magic_link_url:,
10
- expiration_minutes:
11
- )
12
- request = {
13
- user_id: user_id,
14
- magic_link_url: magic_link_url,
15
- expiration_minutes: expiration_minutes
16
- }
17
-
18
- post("#{PATH}/#{email_id}/send_verification", request)
19
- end
20
-
21
- def verify_email(token:)
22
- post("#{PATH}/#{token}/verify", {})
23
- end
24
-
25
- def delete_email(user_id:, email_id:)
26
- delete("#{PATH}/#{email_id}/users/#{user_id}")
27
- end
28
- end
29
- end
30
- end