widgit_accounts_sdk 0.0.4 → 0.0.5

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: 6fe71b03bed7f029020960beb4aaa6771657a0fb389509220bfced6287882309
4
- data.tar.gz: 54d13001c2c7628bbcb398ae0d0601cc2ad260513c3d57d9cea4215bdc1638f5
3
+ metadata.gz: 9a8700049f4e5290a4821b727174056d1caa889f3dafb1431734f879d36aea10
4
+ data.tar.gz: ae0399123fe9afe15bee081347e136e8085bf12e11466954fa168f5db8472520
5
5
  SHA512:
6
- metadata.gz: d24f4ffd0367201b05a641c50cb02811873f87757379e4a0dfa40c950e9ca7ab545c35f014770ff538e978d514d3c701da4ffe3fe74f702c3c038b6b858db28b
7
- data.tar.gz: cfbc0b2a8dcac71911f2ca9925b01294ba54351c9ef8f1279555fede66a7098c56f3384c543579235d586a7c7d641fd6555483135a568bdc8a70ed2ffacdb249
6
+ metadata.gz: ec09a895498c0410489c564dafdc809a36834691e69b809355943f926fc1e546d85491e8d29044dcd8f310491080155c461d66767b2263a059f3b316196f5271
7
+ data.tar.gz: 91403cee348a7c8dacc73e63bac01004903e895f248c32c6e073ec8315c8b207cd224ecd94f02ad08e84702f532caeee042ad86aff6006d9461e36ca3824adf2
@@ -7,25 +7,25 @@ module WidgitAccountsSdk
7
7
 
8
8
  def find_with_uid(uid)
9
9
  response = request("/api/v1/accounts?#{uid.to_query(:uid)}")
10
- return failed(response['error']) if response['status'] == 'failure'
10
+ return failed(response['error']) if response['status'] == 'failed'
11
11
  return success.merge('account' => response.dig('data', 0))
12
12
  end
13
13
 
14
14
  def find_with_email(email)
15
15
  response = request("/api/v1/accounts?#{email.to_query(:email)}")
16
- return failed(response['error']) if response['status'] == 'failure'
16
+ return failed(response['error']) if response['status'] == 'failed'
17
17
  return success.merge('account' => response.dig('data', 0))
18
18
  end
19
19
 
20
20
  def find_with_username(username)
21
21
  response = request("/api/v1/accounts?#{username.to_query(:username)}")
22
- return failed(response['error']) if response['status'] == 'failure'
22
+ return failed(response['error']) if response['status'] == 'failed'
23
23
  return success.merge('account' => response.dig('data', 0))
24
24
  end
25
25
 
26
26
  def exists?(email)
27
27
  response = request("/api/v1/accounts/check?#{email.to_query(:email)}")
28
- return failed(response['error']) if response['status'] == 'failure'
28
+ return failed(response['error']) if response['status'] == 'failed'
29
29
  return success.merge('exists' => response['exists'])
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ module WidgitAccountsSdk
34
34
  request_url += "&#{first_name.to_query(:first_name)}" if first_name
35
35
  request_url += "&#{last_name.to_query(:last_name)}" if last_name
36
36
  response = request(request_url, :post)
37
- return failed(response['error']) if response['status'] == 'failure'
37
+ return failed(response['error']) if response['status'] == 'failed'
38
38
  return response
39
39
  end
40
40
 
@@ -46,20 +46,20 @@ module WidgitAccountsSdk
46
46
 
47
47
  def create_account(params)
48
48
  response = request("/api/v1/accounts", :post, params)
49
- return failed(response['error']) if response['status'] == 'failure'
49
+ return failed(response['error']) if response['status'] == 'failed'
50
50
  return response
51
51
  end
52
52
 
53
53
  def update_account(uid, params)
54
54
  response = request("/api/v1/accounts/#{uid}", :patch, params)
55
- return failed(response['error']) if response['status'] == 'failure'
55
+ return failed(response['error']) if response['status'] == 'failed'
56
56
  return response
57
57
  end
58
58
 
59
59
  def watch(uid, watcher_url = nil)
60
60
  watcher_url = watcher_url || WidgitAccountsSdk.configuration.watch_webhook_url
61
61
  response = request("/api/v1/accounts/#{uid}/watch?#{watcher_url.to_query(:address)}")
62
- return failed(response['error']) if response['status'] == 'failure'
62
+ return failed(response['error']) if response['status'] == 'failed'
63
63
  return response
64
64
  end
65
65
 
@@ -86,7 +86,7 @@ module WidgitAccountsSdk
86
86
  begin
87
87
  http.start do
88
88
  res = http.request(req)
89
- JSON.parse(res.body)
89
+ JSON.parse(res.body).merge('code' => res.code.to_i)
90
90
  end
91
91
  rescue => e
92
92
  return failed(e)
@@ -94,11 +94,11 @@ module WidgitAccountsSdk
94
94
  end
95
95
 
96
96
  def failed(e)
97
- { 'status' => 'failed', 'error' => e }
97
+ { 'status' => 'failed', 'error' => e, 'code' => 500 }
98
98
  end
99
99
 
100
100
  def success
101
- { 'status' => 'success' }
101
+ { 'status' => 'success', 'code' => 200 }
102
102
  end
103
103
  end
104
104
  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.4
4
+ version: 0.0.5
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-07-13 00:00:00.000000000 Z
12
+ date: 2023-08-02 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.26
41
+ rubygems_version: 3.3.7
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Widgit Accounts API Client Ruby Gem