widgit_accounts_sdk 0.0.2 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c0bc9dbe6869b14e497542ca5e4d4dea00a29d3301e19dbf2f26bc70e1deaa6
4
- data.tar.gz: 890fb807737d3e544db3590c573ab4587c8893980e2a50df94b7d58133ac089b
3
+ metadata.gz: 6fe71b03bed7f029020960beb4aaa6771657a0fb389509220bfced6287882309
4
+ data.tar.gz: 54d13001c2c7628bbcb398ae0d0601cc2ad260513c3d57d9cea4215bdc1638f5
5
5
  SHA512:
6
- metadata.gz: cff001a4a81b142573ff35d82bc89c2afdfc0051fad6da77c91361bb297c528d90a864c8f8ee1ad3b06aa3170453f8c4a163369dcf6edecb0a2e6fe608dbd44f
7
- data.tar.gz: b0e3d8912702ed1b55ce315ed2db0d4bba5829edcee7a55ac25d450a8830f12bd654b8da1197ac8de449b76bb50c5561aece4024c78f68fbd7ef539ce21e22be
6
+ metadata.gz: d24f4ffd0367201b05a641c50cb02811873f87757379e4a0dfa40c950e9ca7ab545c35f014770ff538e978d514d3c701da4ffe3fe74f702c3c038b6b858db28b
7
+ data.tar.gz: cfbc0b2a8dcac71911f2ca9925b01294ba54351c9ef8f1279555fede66a7098c56f3384c543579235d586a7c7d641fd6555483135a568bdc8a70ed2ffacdb249
@@ -6,40 +6,40 @@ module WidgitAccountsSdk
6
6
  extend self
7
7
 
8
8
  def find_with_uid(uid)
9
- response = request("/api/v1/accounts?uid=#{uid}")
9
+ response = request("/api/v1/accounts?#{uid.to_query(:uid)}")
10
10
  return failed(response['error']) if response['status'] == 'failure'
11
11
  return success.merge('account' => response.dig('data', 0))
12
12
  end
13
13
 
14
14
  def find_with_email(email)
15
- response = request("/api/v1/accounts?email=#{email}")
15
+ response = request("/api/v1/accounts?#{email.to_query(:email)}")
16
16
  return failed(response['error']) if response['status'] == 'failure'
17
17
  return success.merge('account' => response.dig('data', 0))
18
18
  end
19
19
 
20
20
  def find_with_username(username)
21
- response = request("/api/v1/accounts?username=#{username}")
21
+ response = request("/api/v1/accounts?#{username.to_query(:username)}")
22
22
  return failed(response['error']) if response['status'] == 'failure'
23
23
  return success.merge('account' => response.dig('data', 0))
24
24
  end
25
25
 
26
26
  def exists?(email)
27
- response = request("/api/v1/accounts/check?email=#{email}")
27
+ response = request("/api/v1/accounts/check?#{email.to_query(:email)}")
28
28
  return failed(response['error']) if response['status'] == 'failure'
29
29
  return success.merge('exists' => response['exists'])
30
30
  end
31
31
 
32
32
  def invite(email, first_name = nil, last_name = nil)
33
- request_url = "/api/v1/accounts/invite?email=#{email}"
34
- request_url += "&first_name=#{first_name}" if first_name
35
- request_url += "&last_name=#{last_name}" if last_name
33
+ request_url = "/api/v1/accounts/invite?#{email.to_query(:email)}"
34
+ request_url += "&#{first_name.to_query(:first_name)}" if first_name
35
+ request_url += "&#{last_name.to_query(:last_name)}" if last_name
36
36
  response = request(request_url, :post)
37
37
  return failed(response['error']) if response['status'] == 'failure'
38
38
  return response
39
39
  end
40
40
 
41
41
  def get_new_invite_token(email)
42
- response = request("/api/v1/accounts/invite?email=#{email}", :post)
42
+ response = request("/api/v1/accounts/invite?#{email.to_query(:email)}", :post)
43
43
  return response['data']['invitation_token'] if response['status'] == 'success'
44
44
  return nil
45
45
  end
@@ -56,8 +56,9 @@ module WidgitAccountsSdk
56
56
  return response
57
57
  end
58
58
 
59
- def watch(uid, watcher_url)
60
- response = request("/api/v1/accounts/#{uid}/watch?address=#{Rails.application.config.wa_webhooks_url}")
59
+ def watch(uid, watcher_url = nil)
60
+ watcher_url = watcher_url || WidgitAccountsSdk.configuration.watch_webhook_url
61
+ response = request("/api/v1/accounts/#{uid}/watch?#{watcher_url.to_query(:address)}")
61
62
  return failed(response['error']) if response['status'] == 'failure'
62
63
  return response
63
64
  end
@@ -2,10 +2,12 @@ module WidgitAccountsSdk
2
2
  class Configuration
3
3
  attr_accessor :host
4
4
  attr_accessor :api_key
5
+ attr_accessor :watch_webhook_url
5
6
 
6
7
  def initialize
7
8
  @api_key = nil
8
9
  @host = nil
10
+ @watch_webhook_url
9
11
  end
10
12
  end
11
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: widgit_accounts_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stu Wright
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-06-15 00:00:00.000000000 Z
12
+ date: 2023-07-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby client for interacting with the Widgit Accounts API
15
15
  email: james.sherriff@widgit.com
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
- rubygems_version: 3.3.7
41
+ rubygems_version: 3.3.26
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Widgit Accounts API Client Ruby Gem