stytch 1.0.0 → 2.0.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: f31f4c1727653f8dbdd402bb9e97d31ed7893f537c7f98923b3abfa6d1bbcc14
4
- data.tar.gz: a3cdadaa143fcfc4e0d72b1d0f0e35246a254ff8482c56627fa6d7cb6cb2e898
3
+ metadata.gz: c1f99d2093072e2e5ee91b23fa745105f56a4ae2b8abcd4ce01f76048d9bec42
4
+ data.tar.gz: 718a09bc69310b8e30627ebe66cdddb49713f9101dd06cfe13746c8ad88a0ff3
5
5
  SHA512:
6
- metadata.gz: 56aec4b2699da311092641a43150259a8315ff6c53a460377910dddebffb8c5f02986481a8ef9b8851bb40e25dfb46805b058055bef59b68d6a1d1b688c438fc
7
- data.tar.gz: 07c8003263f90593c7c9e86920b8d866621e2890fb477e4d3b05eeb80c56b23c2cfab5913db80b76fe0b4be8d6260e26ce877f2000e8e3686515fce6a5867e5b
6
+ metadata.gz: a90634d8f228fd2860f3674dc7fd522d0d14cf0c36928bc547cafcba1e428597de622e503d1e1758df2fe90e62d0ca6e6fcdb8ff73232b6ce73cdd7b77565591
7
+ data.tar.gz: 48117adc597da070fdd886e3bb30e9a27820913933dfe3636b1222a698ad135837debee40c4d71d04d984075a1d324659e25e9e5b7368452add397698027e60a
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in stytch.gemspec
4
- gemspec
6
+ gemspec
data/README.md CHANGED
@@ -32,7 +32,7 @@ client = Stytch::Client.new(
32
32
 
33
33
  Then make desired API call.
34
34
  ```
35
- client.get_user(user_id: user_id)
35
+ client.users.get(user_id: user_id)
36
36
  ```
37
37
 
38
38
  ## License
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "stytch"
4
+ require 'bundler/setup'
5
+ require 'stytch'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "stytch"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
data/lib/stytch.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'faraday_middleware'
3
5
 
data/lib/stytch/client.rb CHANGED
@@ -1,30 +1,35 @@
1
- require_relative 'endpoints/user'
2
- require_relative 'endpoints/magic'
3
- require_relative 'endpoints/otp'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'users'
4
+ require_relative 'magic_links'
5
+ require_relative 'otps'
4
6
 
5
7
  module Stytch
6
8
  class Client
7
- include Stytch::Endpoints::User
8
- include Stytch::Endpoints::Magic
9
- include Stytch::Endpoints::OTP
10
-
11
9
  ENVIRONMENTS = %i[live test].freeze
12
10
 
11
+ attr_reader :users, :magic_links, :otps
12
+
13
13
  def initialize(env:, project_id:, secret:, &block)
14
14
  @api_host = api_host(env)
15
- @project_id = project_id
15
+ @project_id = project_id
16
16
  @secret = secret
17
17
 
18
18
  create_connection(&block)
19
+
20
+ @users = Stytch::Users.new(@connection)
21
+ @magic_links = Stytch::MagicLinks.new(@connection)
22
+ @otps = Stytch::OTPs.new(@connection)
19
23
  end
20
24
 
21
25
  private
22
26
 
23
27
  def api_host(env)
24
- if env == :live
25
- "https://api.stytch.com"
26
- elsif env == :test
27
- "https://test.stytch.com"
28
+ case env
29
+ when :live
30
+ 'https://api.stytch.com'
31
+ when :test
32
+ 'https://test.stytch.com'
28
33
  else
29
34
  raise ArgumentError, "Invalid value for env (#{@env}): should be live or test"
30
35
  end
@@ -45,43 +50,5 @@ module Stytch
45
50
  builder.response :json, content_type: /\bjson$/
46
51
  builder.adapter Faraday.default_adapter
47
52
  end
48
-
49
- def get(path)
50
- @connection.get(
51
- path
52
- ).body
53
- end
54
-
55
- def post(path, payload)
56
- @connection.post(
57
- path,
58
- payload
59
- ).body
60
- end
61
-
62
- def put(path, payload)
63
- @connection.put(
64
- path,
65
- payload
66
- ).body
67
- end
68
-
69
- def delete(path)
70
- @connection.delete(
71
- path
72
- ).body
73
- end
74
-
75
- def request_with_query_params(path, params)
76
- request = path
77
- params.compact.each_with_index do |p, i|
78
- if i == 0
79
- request += "?#{p[0].to_s}=#{p[1]}"
80
- else
81
- request += "&#{p[0].to_s}=#{p[1]}"
82
- end
83
- end
84
- request
85
- end
86
53
  end
87
54
  end
@@ -1,9 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'request_helper'
4
+
1
5
  module Stytch
2
- module Endpoints
3
- module Magic
4
- PATH = "/v1/magic_links".freeze
6
+ class MagicLinks
7
+ include Stytch::RequestHelper
8
+
9
+ attr_reader :email
10
+
11
+ PATH = '/v1/magic_links'
12
+
13
+ def initialize(connection)
14
+ @connection = connection
15
+
16
+ @email = Stytch::MagicLinks::Email.new(@connection)
17
+ end
5
18
 
6
- def send_magic_by_email(
19
+ def authenticate(
20
+ token:,
21
+ attributes: {},
22
+ options: {}
23
+ )
24
+ request = {
25
+ token: token
26
+ }
27
+
28
+ request[:attributes] = attributes if attributes != {}
29
+ request[:options] = options if options != {}
30
+
31
+ post_request("#{PATH}/authenticate", request)
32
+ end
33
+
34
+ class Email
35
+ include Stytch::RequestHelper
36
+
37
+ PATH = "#{Stytch::MagicLinks::PATH}/email"
38
+
39
+ def initialize(connection)
40
+ @connection = connection
41
+ end
42
+
43
+ def send(
7
44
  email:,
8
45
  login_magic_link_url:,
9
46
  signup_magic_link_url:,
@@ -14,17 +51,17 @@ module Stytch
14
51
  request = {
15
52
  email: email,
16
53
  login_magic_link_url: login_magic_link_url,
17
- signup_magic_link_url: signup_magic_link_url,
54
+ signup_magic_link_url: signup_magic_link_url
18
55
  }
19
56
 
20
- request[:login_expiration_minutes] = login_expiration_minutes if login_expiration_minutes != nil
21
- request[:signup_expiration_minutes] = signup_expiration_minutes if signup_expiration_minutes != nil
57
+ request[:login_expiration_minutes] = login_expiration_minutes unless login_expiration_minutes.nil?
58
+ request[:signup_expiration_minutes] = signup_expiration_minutes unless signup_expiration_minutes.nil?
22
59
  request[:attributes] = attributes if attributes != {}
23
60
 
24
- post("#{PATH}/send_by_email", request)
61
+ post_request("#{PATH}/send", request)
25
62
  end
26
63
 
27
- def login_or_create_user(
64
+ def login_or_create(
28
65
  email:,
29
66
  login_magic_link_url:,
30
67
  signup_magic_link_url:,
@@ -33,63 +70,47 @@ module Stytch
33
70
  attributes: {},
34
71
  create_user_as_pending: false
35
72
  )
36
-
37
73
  request = {
38
74
  email: email,
39
75
  login_magic_link_url: login_magic_link_url,
40
76
  signup_magic_link_url: signup_magic_link_url,
41
- create_user_as_pending: create_user_as_pending,
77
+ create_user_as_pending: create_user_as_pending
42
78
  }
43
79
 
44
- request[:login_expiration_minutes] = login_expiration_minutes if login_expiration_minutes != nil
45
- request[:signup_expiration_minutes] = signup_expiration_minutes if signup_expiration_minutes != nil
80
+ request[:login_expiration_minutes] = login_expiration_minutes unless login_expiration_minutes.nil?
81
+ request[:signup_expiration_minutes] = signup_expiration_minutes unless signup_expiration_minutes.nil?
46
82
  request[:attributes] = attributes if attributes != {}
47
83
 
48
- post("#{PATH}/login_or_create", request)
84
+ post_request("#{PATH}/login_or_create", request)
49
85
  end
50
86
 
51
- def invite_by_email(
87
+ def invite(
52
88
  email:,
53
89
  invite_magic_link_url:,
54
90
  invite_expiration_minutes: nil,
55
91
  attributes: {},
56
92
  name: {}
57
93
  )
58
-
59
94
  request = {
60
95
  email: email,
61
- invite_magic_link_url: invite_magic_link_url,
96
+ invite_magic_link_url: invite_magic_link_url
62
97
  }
63
98
 
64
- request[:invite_expiration_minutes] = invite_expiration_minutes if invite_expiration_minutes != nil
99
+ request[:invite_expiration_minutes] = invite_expiration_minutes unless invite_expiration_minutes.nil?
65
100
  request[:attributes] = attributes if attributes != {}
66
101
  request[:name] = name if name != {}
67
102
 
68
- post("#{PATH}/invite_by_email", request)
103
+ post_request("#{PATH}/invite", request)
69
104
  end
70
105
 
71
- def revoke_invite_by_email(
106
+ def revoke_invite(
72
107
  email:
73
108
  )
74
-
75
109
  request = {
76
- email: email,
110
+ email: email
77
111
  }
78
112
 
79
- post("#{PATH}/revoke_invite", request)
80
- end
81
-
82
- def authenticate_magic(
83
- token:,
84
- attributes: {},
85
- options: {}
86
- )
87
- request = {}
88
-
89
- request[:attributes] = attributes if attributes != {}
90
- request[:options] = options if options != {}
91
-
92
- post("#{PATH}/#{token}/authenticate", request)
113
+ post_request("#{PATH}/revoke_invite", request)
93
114
  end
94
115
  end
95
116
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'net/http'
3
5
  require 'uri'
@@ -7,8 +9,8 @@ require_relative 'version'
7
9
  module Stytch
8
10
  class Middleware < ::Faraday::Response::Middleware
9
11
  NETWORK_HEADERS = {
10
- 'User-Agent' => "Stytch Ruby v#{Stytch::VERSION}",
11
- 'Content-Type' => 'application/json',
12
+ 'User-Agent' => "Stytch Ruby v#{Stytch::VERSION}",
13
+ 'Content-Type' => 'application/json'
12
14
  }.freeze
13
15
 
14
16
  NETWORK_TIMEOUT = 300
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'request_helper'
4
+
5
+ module Stytch
6
+ class OTPs
7
+ include Stytch::RequestHelper
8
+
9
+ attr_reader :sms
10
+
11
+ PATH = '/v1/otps'
12
+
13
+ def initialize(connection)
14
+ @connection = connection
15
+
16
+ @sms = Stytch::OTPs::SMS.new(@connection)
17
+ end
18
+
19
+ def authenticate(
20
+ method_id:,
21
+ code:,
22
+ attributes: {},
23
+ options: {}
24
+ )
25
+ request = {
26
+ method_id: method_id,
27
+ code: code
28
+ }
29
+
30
+ request[:attributes] = attributes if attributes != {}
31
+ request[:options] = options if options != {}
32
+
33
+ post_request("#{PATH}/authenticate", request)
34
+ end
35
+
36
+ class SMS
37
+ include Stytch::RequestHelper
38
+
39
+ PATH = "#{Stytch::OTPs::PATH}/sms"
40
+
41
+ def initialize(connection)
42
+ @connection = connection
43
+ end
44
+
45
+ def send(
46
+ phone_number:,
47
+ expiration_minutes: nil,
48
+ attributes: {}
49
+ )
50
+ request = {
51
+ phone_number: phone_number,
52
+ expiration_minutes: expiration_minutes
53
+ }
54
+
55
+ request[:attributes] = attributes if attributes != {}
56
+
57
+ post_request("#{PATH}/send", request)
58
+ end
59
+
60
+ def login_or_create(
61
+ phone_number:,
62
+ expiration_minutes: nil,
63
+ attributes: {},
64
+ create_user_as_pending: false
65
+ )
66
+ request = {
67
+ phone_number: phone_number,
68
+ expiration_minutes: expiration_minutes,
69
+ create_user_as_pending: create_user_as_pending
70
+ }
71
+
72
+ request[:attributes] = attributes if attributes != {}
73
+
74
+ post_request("#{PATH}/login_or_create", request)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stytch
4
+ module RequestHelper
5
+ def get_request(path)
6
+ @connection.get(
7
+ path
8
+ ).body
9
+ end
10
+
11
+ def post_request(path, payload)
12
+ @connection.post(
13
+ path,
14
+ payload
15
+ ).body
16
+ end
17
+
18
+ def put_request(path, payload)
19
+ @connection.put(
20
+ path,
21
+ payload
22
+ ).body
23
+ end
24
+
25
+ def delete_request(path)
26
+ @connection.delete(
27
+ path
28
+ ).body
29
+ end
30
+
31
+ def request_with_query_params(path, params)
32
+ request = path
33
+ params.compact.each_with_index do |p, i|
34
+ request += if i.zero?
35
+ "?#{p[0]}=#{p[1]}"
36
+ else
37
+ "&#{p[0]}=#{p[1]}"
38
+ end
39
+ end
40
+ request
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'request_helper'
4
+
5
+ module Stytch
6
+ class Users
7
+ include Stytch::RequestHelper
8
+
9
+ PATH = '/v1/users'
10
+
11
+ def initialize(connection)
12
+ @connection = connection
13
+ end
14
+
15
+ def get(user_id:)
16
+ get_request("#{PATH}/#{user_id}")
17
+ end
18
+
19
+ def get_pending(
20
+ limit: nil,
21
+ starting_after_id: nil
22
+ )
23
+ query_params = {
24
+ limit: limit,
25
+ starting_after_id: starting_after_id
26
+ }
27
+
28
+ request = request_with_query_params("#{PATH}/pending", query_params)
29
+
30
+ get_request(request)
31
+ end
32
+
33
+ def create(
34
+ email: nil,
35
+ phone_number: nil,
36
+ name: {},
37
+ create_user_as_pending: false,
38
+ attributes: {}
39
+ )
40
+ request = {
41
+ email: email,
42
+ phone_number: phone_number,
43
+ create_user_as_pending: create_user_as_pending
44
+ }
45
+
46
+ request[:name] = name if name != {}
47
+ request[:attributes] = attributes if attributes != {}
48
+
49
+ post_request(PATH, request)
50
+ end
51
+
52
+ def update(
53
+ user_id:,
54
+ name: {},
55
+ emails: [],
56
+ phone_numbers: [],
57
+ attributes: {}
58
+ )
59
+ request = {
60
+ emails: format_emails(emails),
61
+ phone_numbers: format_phone_numbers(phone_numbers)
62
+ }
63
+
64
+ request[:name] = name if name != {}
65
+ request[:attributes] = attributes if attributes != {}
66
+
67
+ put_request("#{PATH}/#{user_id}", request)
68
+ end
69
+
70
+ def delete(user_id:)
71
+ delete_request("#{PATH}/#{user_id}")
72
+ end
73
+
74
+ def delete_email(
75
+ email_id:
76
+ )
77
+ delete_request("#{PATH}/emails/#{email_id}")
78
+ end
79
+
80
+ def delete_phone_number(
81
+ phone_id:
82
+ )
83
+ delete_request("#{PATH}/phone_numbers/#{phone_id}")
84
+ end
85
+
86
+ private
87
+
88
+ def format_emails(emails)
89
+ e = []
90
+ emails.each { |email| e << { email: email } }
91
+ e
92
+ end
93
+
94
+ def format_phone_numbers(phone_numbers)
95
+ p = []
96
+ phone_numbers.each { |phone_number| p << { phone_number: phone_number } }
97
+ p
98
+ end
99
+ end
100
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stytch
2
- VERSION = "1.0.0"
4
+ VERSION = '2.0.0'
3
5
  end
data/stytch.gemspec CHANGED
@@ -1,27 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/stytch/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
4
- spec.name = "stytch"
6
+ spec.name = 'stytch'
5
7
  spec.version = Stytch::VERSION
6
- spec.authors = ["alex-stytch"]
7
- spec.email = ["alex@stytch.com"]
8
+ spec.authors = ['stytch']
9
+ spec.email = ['support@stytch.com']
8
10
 
9
- spec.summary = "Stytch Ruby Gem"
10
- spec.homepage = "https://stytch.com"
11
- spec.license = "MIT"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
+ spec.summary = 'Stytch Ruby Gem'
12
+ spec.homepage = 'https://stytch.com'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
13
15
 
14
- spec.metadata["homepage_uri"] = spec.homepage
15
- spec.metadata["source_code_uri"] = "https://github.com/stytchauth/stytch-ruby"
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/stytchauth/stytch-ruby'
16
18
 
17
19
  # Specify which files should be added to the gem when it is released.
18
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
23
  end
22
- spec.bindir = "exe"
24
+ spec.bindir = 'exe'
23
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
26
+ spec.require_paths = ['lib']
25
27
 
26
28
  spec.add_dependency 'faraday', '>= 0.17.0', '< 2.0'
27
29
  spec.add_dependency 'faraday_middleware', '>= 0.14.0', '< 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - alex-stytch
7
+ - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-01 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '2.0'
53
53
  description:
54
54
  email:
55
- - alex@stytch.com
55
+ - support@stytch.com
56
56
  executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
@@ -69,10 +69,11 @@ files:
69
69
  - bin/setup
70
70
  - lib/stytch.rb
71
71
  - lib/stytch/client.rb
72
- - lib/stytch/endpoints/magic.rb
73
- - lib/stytch/endpoints/otp.rb
74
- - lib/stytch/endpoints/user.rb
72
+ - lib/stytch/magic_links.rb
75
73
  - lib/stytch/middleware.rb
74
+ - lib/stytch/otps.rb
75
+ - lib/stytch/request_helper.rb
76
+ - lib/stytch/users.rb
76
77
  - lib/stytch/version.rb
77
78
  - stytch.gemspec
78
79
  homepage: https://stytch.com
@@ -1,56 +0,0 @@
1
- module Stytch
2
- module Endpoints
3
- module OTP
4
- PATH = "/v1/otp".freeze
5
-
6
- def send_otp_by_sms(
7
- phone_number:,
8
- expiration_minutes: nil,
9
- attributes: {}
10
- )
11
- request = {
12
- phone_number: phone_number,
13
- expiration_minutes: expiration_minutes,
14
- }
15
-
16
- request[:attributes] = attributes if attributes != {}
17
-
18
- post("#{PATH}/send_by_sms", request)
19
- end
20
-
21
- def login_or_create_user_by_sms(
22
- phone_number:,
23
- expiration_minutes: nil,
24
- attributes: {},
25
- create_user_as_pending: false
26
- )
27
- request = {
28
- phone_number: phone_number,
29
- expiration_minutes: expiration_minutes,
30
- create_user_as_pending: create_user_as_pending
31
- }
32
-
33
- request[:attributes] = attributes if attributes != {}
34
-
35
- post("#{PATH}/login_or_create", request)
36
- end
37
-
38
- def authenticate_otp(
39
- method_id:,
40
- code:,
41
- attributes: {},
42
- options: {}
43
- )
44
- request = {
45
- method_id: method_id,
46
- code: code,
47
- }
48
-
49
- request[:attributes] = attributes if attributes != {}
50
- request[:options] = options if options != {}
51
-
52
- post("#{PATH}/authenticate", request)
53
- end
54
- end
55
- end
56
- end
@@ -1,92 +0,0 @@
1
- module Stytch
2
- module Endpoints
3
- module User
4
- PATH = "/v1/users".freeze
5
-
6
- def get_user(user_id:)
7
- get("#{PATH}/#{user_id}")
8
- end
9
-
10
- def get_pending_users(
11
- limit: nil,
12
- starting_after_id: nil
13
- )
14
- query_params = {
15
- limit: limit,
16
- starting_after_id: starting_after_id,
17
- }
18
-
19
- request = request_with_query_params("#{PATH}/pending", query_params)
20
-
21
- get(request)
22
- end
23
-
24
- def create_user(
25
- email: nil,
26
- phone_number: nil,
27
- name: {},
28
- create_user_as_pending: false,
29
- attributes: {}
30
- )
31
- request = {
32
- email: email,
33
- phone_number: phone_number,
34
- create_user_as_pending: create_user_as_pending
35
- }
36
-
37
- request[:name] = name if name != {}
38
- request[:attributes] = attributes if attributes != {}
39
-
40
- post(PATH, request)
41
- end
42
-
43
- def update_user(
44
- user_id:,
45
- name: {},
46
- emails: [],
47
- phone_numbers: [],
48
- attributes: {}
49
- )
50
- request = {
51
- emails: format_emails(emails),
52
- phone_numbers: format_phone_numbers(phone_numbers),
53
- }
54
-
55
- request[:name] = name if name != {}
56
- request[:attributes] = attributes if attributes != {}
57
-
58
- put("#{PATH}/#{user_id}", request)
59
- end
60
-
61
- def delete_user(user_id:)
62
- delete("#{PATH}/#{user_id}")
63
- end
64
-
65
- def delete_user_email(
66
- email_id:
67
- )
68
- delete("#{PATH}/emails/#{email_id}")
69
- end
70
-
71
- def delete_user_phone_number(
72
- phone_id:
73
- )
74
- delete("#{PATH}/phone_numbers/#{phone_id}")
75
- end
76
-
77
- private
78
-
79
- def format_emails(emails)
80
- e = []
81
- emails.each { |email| e << { email: email} }
82
- e
83
- end
84
-
85
- def format_phone_numbers(phone_numbers)
86
- p = []
87
- phone_numbers.each { |phone_number| p << { phone_number: phone_number} }
88
- p
89
- end
90
- end
91
- end
92
- end