widgets_api_client 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 +7 -0
- data/Gemfile +5 -0
- data/Rakefile +5 -0
- data/lib/domain/application_config.rb +18 -0
- data/lib/domain/authentication.rb +46 -0
- data/lib/domain/client_info_base.rb +20 -0
- data/lib/domain/user.rb +51 -0
- data/lib/domain/user_base.rb +16 -0
- data/lib/domain/widget.rb +34 -0
- data/lib/domain/widget_base.rb +16 -0
- data/lib/services/authentication_service.rb +58 -0
- data/lib/services/user_service.rb +80 -0
- data/lib/services/user_widget_service.rb +36 -0
- data/lib/services/widget_service.rb +60 -0
- data/lib/widgets_api_client.rb +122 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a72ad88fbc67054ad4caad94b25f485507748318d9427cd61b7d31670186708
|
4
|
+
data.tar.gz: c66bdaea4ea234b2dfe02eb2f954e4bab784dacdbf526bdf9dbc157361ee614d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0ab25d3be655a52560c339d487c891133ed16ba9c007f29ba4273af10e15ab5694ec488a06b2c4d1afe811d46c4fc5ff912c940f0e0d1a0fdd5b21e6ffe4b23
|
7
|
+
data.tar.gz: b5266c114de9f5862f035b17ad86c243898934ed31e02a847e76fbac7e1d994122e1154d304bca08633c20ed6d95895e9eb3784f7cf24a57218e4114962d0758
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class ApplicationConfig
|
2
|
+
@@client_id =""
|
3
|
+
@@client_secret =""
|
4
|
+
|
5
|
+
def self.set_config(client_id, client_secret)
|
6
|
+
@@client_id = client_id
|
7
|
+
@@client_secret = client_secret
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_client_id
|
11
|
+
return @@client_id
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_client_secret
|
15
|
+
return @@client_secret
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'json'
|
2
|
+
class Authentication
|
3
|
+
attr_accessor :grant_type
|
4
|
+
attr_accessor :client_id
|
5
|
+
attr_accessor :client_secret
|
6
|
+
attr_accessor :username
|
7
|
+
attr_accessor :password
|
8
|
+
attr_accessor :token
|
9
|
+
attr_accessor :refresh_token
|
10
|
+
|
11
|
+
def initialize grant_type: nil, client_id: nil, client_secret: nil, username: nil, password: nil, token:nil, refresh_token:nil
|
12
|
+
self.grant_type, self.client_id, self.client_secret, self.username, self.password, self.token, self.refresh_token =
|
13
|
+
grant_type, client_id, client_secret, username, password, token, refresh_token
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def to_json(*a)
|
18
|
+
hash = {
|
19
|
+
grant_type: @grant_type,
|
20
|
+
client_id: @client_id,
|
21
|
+
client_secret: @client_secret,
|
22
|
+
username: @username,
|
23
|
+
password: @password,
|
24
|
+
token: @token,
|
25
|
+
refresh_token: @refresh_token
|
26
|
+
}
|
27
|
+
hash.delete_if { |k, v| v.nil? || v.empty? }
|
28
|
+
hash.to_json(*a)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.json_create(o)
|
32
|
+
b_from_json = new
|
33
|
+
b_from_json.grant_type = o['grant_type']
|
34
|
+
b_from_json.client_id = o['client_id']
|
35
|
+
b_from_json.client_secret = o['client_secret']
|
36
|
+
b_from_json.username = o['username']
|
37
|
+
b_from_json.password = o['password']
|
38
|
+
b_from_json.token = o['token']
|
39
|
+
b_from_json.refresh_token = o['refresh_token']
|
40
|
+
b_from_json
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.get_payload(auth_data)
|
44
|
+
return auth_data.to_json
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'json'
|
2
|
+
class ClientInfoBase
|
3
|
+
attr_accessor :client_id
|
4
|
+
attr_accessor :client_secret
|
5
|
+
attr_accessor :user
|
6
|
+
|
7
|
+
def to_json(*a)
|
8
|
+
{
|
9
|
+
client_id: @client_id, client_secret: @client_secret, user: @user
|
10
|
+
}.to_json(*a)
|
11
|
+
|
12
|
+
end
|
13
|
+
def self.json_create(o)
|
14
|
+
a_from_json = new
|
15
|
+
a_from_json.client_id = o['client_id']
|
16
|
+
a_from_json.client_secret = o['client_secret']
|
17
|
+
a_from_json.user = o['user']
|
18
|
+
a_from_json
|
19
|
+
end
|
20
|
+
end
|
data/lib/domain/user.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class User
|
4
|
+
attr_accessor :first_name
|
5
|
+
attr_accessor :last_name
|
6
|
+
attr_accessor :password
|
7
|
+
attr_accessor :current_password
|
8
|
+
attr_accessor :new_password
|
9
|
+
attr_accessor :date_of_birth
|
10
|
+
attr_accessor :email
|
11
|
+
attr_accessor :image_url
|
12
|
+
|
13
|
+
def initialize first_name: nil, last_name: nil, password: nil, date_of_birth:nil, email: nil, image_url: nil
|
14
|
+
self.first_name, self.last_name, self.password, self.current_password, self.new_password, self.date_of_birth, self.email, self.image_url =
|
15
|
+
first_name, last_name, password,current_password, new_password, date_of_birth, email, image_url
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
def to_json(*a)
|
21
|
+
hash = {
|
22
|
+
first_name: @first_name,
|
23
|
+
last_name: @last_name,
|
24
|
+
password: @password,
|
25
|
+
current_password: @current_password,
|
26
|
+
new_password: @new_password,
|
27
|
+
date_of_birth: @date_of_birth,
|
28
|
+
email: @email,
|
29
|
+
image_url: @image_url
|
30
|
+
}
|
31
|
+
hash.delete_if { |k, v| v.nil? }
|
32
|
+
hash.to_json(*a)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.json_create(o)
|
36
|
+
b_from_json = new
|
37
|
+
b_from_json.first_name = o['first_name']
|
38
|
+
b_from_json.last_name = o['last_name']
|
39
|
+
b_from_json.password = o['password']
|
40
|
+
b_from_json.current_password = o['current_password']
|
41
|
+
b_from_json.new_password = o['new_password']
|
42
|
+
b_from_json.date_of_birth = o['date_of_birth']
|
43
|
+
b_from_json.email = o['email']
|
44
|
+
b_from_json.image_url = o['image_url']
|
45
|
+
b_from_json
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.get_payload(userWithClientInfo)
|
49
|
+
return userWithClientInfo.to_json
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'json'
|
2
|
+
class Widget
|
3
|
+
attr_accessor :name
|
4
|
+
attr_accessor :description
|
5
|
+
attr_accessor :kind
|
6
|
+
|
7
|
+
def initialize name: nil, description: nil, kind: nil
|
8
|
+
self.name, self.description, self.kind =
|
9
|
+
name, description, kind
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_json(*a)
|
13
|
+
hash = {
|
14
|
+
name: @name,
|
15
|
+
description: @description,
|
16
|
+
kind: @kind
|
17
|
+
}
|
18
|
+
hash.delete_if { |k, v| v.nil? || v.empty? }
|
19
|
+
hash.to_json(*a)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.json_create(o)
|
23
|
+
b_from_json = new
|
24
|
+
b_from_json.name = o['name']
|
25
|
+
b_from_json.description = o['description']
|
26
|
+
b_from_json.kind = o['kind']
|
27
|
+
b_from_json
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_payload(widget)
|
31
|
+
return widget.to_json
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
require_relative '../domain/authentication.rb'
|
4
|
+
require_relative '../domain/application_config.rb'
|
5
|
+
|
6
|
+
class AuthenticationService
|
7
|
+
@@authentication_url = 'https://showoff-rails-react-production.herokuapp.com/oauth/token'
|
8
|
+
@@revoke_url = 'https://showoff-rails-react-production.herokuapp.com/oauth/revoke'
|
9
|
+
|
10
|
+
def self.create_authentication(auth_data)
|
11
|
+
auth_data = get_auth_with_client_info(auth_data)
|
12
|
+
auth_payload = Authentication.get_payload(auth_data)
|
13
|
+
return RestClient::Request.execute(method: :post, url: @@authentication_url,
|
14
|
+
payload: auth_payload, headers: {'Content-Type': 'application/json'})
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.refresh_authentication_token(auth_data, bearer_token)
|
18
|
+
auth_data = get_auth_with_client_info(auth_data)
|
19
|
+
auth_payload = Authentication.get_payload(auth_data)
|
20
|
+
return RestClient::Request.execute(method: :post, url: @@authentication_url,
|
21
|
+
payload: auth_payload, headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.revoke_authentication_token(auth_data, bearer_token)
|
25
|
+
auth_payload = Authentication.get_payload(auth_data)
|
26
|
+
return RestClient::Request.execute(method: :post, url: @@revoke_url,
|
27
|
+
payload: auth_payload, headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_auth_with_client_info(auth_data)
|
31
|
+
auth_data.client_id = ApplicationConfig.get_client_id
|
32
|
+
auth_data.client_secret = ApplicationConfig.get_client_secret
|
33
|
+
return auth_data
|
34
|
+
end
|
35
|
+
|
36
|
+
# to remove once tested
|
37
|
+
def self.create_auth_data
|
38
|
+
auth = Authentication.new
|
39
|
+
auth.grant_type = "password"
|
40
|
+
# auth.client_id = "277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe"
|
41
|
+
#auth.client_secret = "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352"
|
42
|
+
auth.username = "sachinmurthy56@gmail.com"
|
43
|
+
auth.password = "password"
|
44
|
+
return auth
|
45
|
+
end
|
46
|
+
|
47
|
+
#remove once tested
|
48
|
+
def self.get_access_token
|
49
|
+
auth_data = AuthenticationService.create_auth_data
|
50
|
+
authJson = AuthenticationService.create_authentication(auth_data)
|
51
|
+
res_data = JSON.parse(authJson)
|
52
|
+
access_token = res_data['data']['token']['access_token']
|
53
|
+
return access_token
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
require_relative '../domain/client_info_base.rb'
|
4
|
+
require_relative '../domain/user.rb'
|
5
|
+
require_relative '../domain/user_base.rb'
|
6
|
+
require_relative '../domain/application_config.rb'
|
7
|
+
|
8
|
+
|
9
|
+
class UserService
|
10
|
+
@@create_user_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users'
|
11
|
+
@@create_update_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/me'
|
12
|
+
@@check_email_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/email'
|
13
|
+
@@reset_password_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/reset_password'
|
14
|
+
@@change_password_url ='https://showoff-rails-react-production.herokuapp.com/api/v1/users/me/password'
|
15
|
+
@@show_logged_in_user_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/me'
|
16
|
+
@@show_user_id_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/'
|
17
|
+
|
18
|
+
def self.create_user(user)
|
19
|
+
user_with_client_info = get_user_with_client_info(user)
|
20
|
+
create_user_payload = User.get_payload(user_with_client_info)
|
21
|
+
return RestClient::Request.execute(method: :post, url: @@create_user_url,
|
22
|
+
payload: create_user_payload, headers: {'Content-Type': 'application/json'})
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.update_user(user, bearer_token)
|
26
|
+
user_data = get_user(user)
|
27
|
+
update_user_payload = User.get_payload(user_data)
|
28
|
+
return RestClient::Request.execute(method: :put, url: @@create_update_url,
|
29
|
+
payload: update_user_payload,
|
30
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.check_email(user)
|
34
|
+
return RestClient::Request.execute(method: :get, url: @@check_email_url,
|
35
|
+
headers: {'Content-Type': 'application/json', params: {:email => user.email , :client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret}})
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.reset_password(user)
|
39
|
+
user_with_client_info = get_user_with_client_info(user)
|
40
|
+
reset_password_payload = User.get_payload(user_with_client_info)
|
41
|
+
return RestClient::Request.execute(method: :post, url: @@reset_password_url,
|
42
|
+
payload: reset_password_payload,
|
43
|
+
headers: {'Content-Type': 'application/json'})
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.change_password(user, bearer_token)
|
47
|
+
user_data = get_user(user)
|
48
|
+
change_password_payload = User.get_payload(user_data)
|
49
|
+
return RestClient::Request.execute(method: :post, url: @@change_password_url,
|
50
|
+
payload: change_password_payload,
|
51
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.show_logged_in_user(bearer_token)
|
55
|
+
return RestClient::Request.execute(method: :get, url: @@show_logged_in_user_url,
|
56
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.show_user_id(user_id, bearer_token)
|
60
|
+
url_with_id = @@show_user_id_url + "#{user_id}"
|
61
|
+
return RestClient::Request.execute(method: :get, url: url_with_id,
|
62
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.get_user_with_client_info(user)
|
66
|
+
user_with_client_info = ClientInfoBase.new
|
67
|
+
user_with_client_info.client_id = ApplicationConfig.get_client_id
|
68
|
+
user_with_client_info.client_secret = ApplicationConfig.get_client_secret
|
69
|
+
user_with_client_info.user = user
|
70
|
+
return user_with_client_info
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.get_user(user)
|
74
|
+
user_data = UserBase.new
|
75
|
+
user_data.user = user
|
76
|
+
return user_data
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
require_relative '../domain/application_config.rb'
|
4
|
+
|
5
|
+
class UserWidgetService
|
6
|
+
@@own_widgets_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/me/widgets'
|
7
|
+
@@widgets_by_user_id_url ='https://showoff-rails-react-production.herokuapp.com/api/v1/users/'
|
8
|
+
|
9
|
+
def self.get_private_widgets(bearer_token)
|
10
|
+
return RestClient::Request.execute(method: :get, url: @@own_widgets_url,
|
11
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret},
|
12
|
+
'Authorization': bearer_token})
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get_private_widgets_with_search_term(search_term, bearer_token)
|
16
|
+
return RestClient::Request.execute(method: :get, url: @@own_widgets_url,
|
17
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret, :term => search_term},
|
18
|
+
'Authorization': bearer_token})
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.get_widgets_by_user_id(user_id, bearer_token)
|
22
|
+
url_with_id = @@widgets_by_user_id_url + "#{user_id}" + "/widgets"
|
23
|
+
return RestClient::Request.execute(method: :get, url: url_with_id,
|
24
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret},
|
25
|
+
'Authorization': bearer_token})
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.get_widgets_by_user_id_with_search_term(user_id, search_term, bearer_token)
|
29
|
+
url_with_id = @@widgets_by_user_id_url + "#{user_id}" + "/widgets"
|
30
|
+
return RestClient::Request.execute(method: :get, url: url_with_id,
|
31
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret, :term => search_term},
|
32
|
+
'Authorization': bearer_token})
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
require_relative '../domain/widget_base.rb'
|
4
|
+
require_relative '../domain/widget.rb'
|
5
|
+
require_relative '../domain/application_config.rb'
|
6
|
+
|
7
|
+
class WidgetService
|
8
|
+
@@create_widget_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/widgets'
|
9
|
+
@@update_destroy_widget_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/widgets/'
|
10
|
+
@@list_widget_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/widgets/visible'
|
11
|
+
|
12
|
+
|
13
|
+
def self.create_widget(widget, bearer_token)
|
14
|
+
widget_data = get_widget(widget)
|
15
|
+
create_widget_payload = Widget.get_payload(widget_data)
|
16
|
+
return RestClient::Request.execute(method: :post, url: @@create_widget_url,
|
17
|
+
payload: create_widget_payload,
|
18
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update_widget(widget, widget_id, bearer_token)
|
22
|
+
update_url_with_widget_id = @@update_destroy_widget_url + "#{widget_id}"
|
23
|
+
widget_data = get_widget(widget)
|
24
|
+
update_widget_payload = Widget.get_payload(widget_data)
|
25
|
+
return RestClient::Request.execute(method: :put, url: update_url_with_widget_id,
|
26
|
+
payload: update_widget_payload,
|
27
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.destroy_widget(widget_id, bearer_token)
|
31
|
+
destroy_url_with_widget_id = @@update_destroy_widget_url + "#{widget_id}"
|
32
|
+
return RestClient::Request.execute(method: :delete, url: destroy_url_with_widget_id,
|
33
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.get_private_widgets(bearer_token)
|
37
|
+
return RestClient::Request.execute(method: :get, url: @@create_widget_url,
|
38
|
+
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.get_public_widgets(bearer_token)
|
42
|
+
return RestClient::Request.execute(method: :get, url: @@list_widget_url,
|
43
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret},
|
44
|
+
'Authorization': bearer_token})
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.get_public_widgets_with_search_term(search_term, bearer_token)
|
48
|
+
return RestClient::Request.execute(method: :get, url: @@list_widget_url,
|
49
|
+
headers: {'Content-Type': 'application/json', params: {:client_id => ApplicationConfig.get_client_id, :client_secret => ApplicationConfig.get_client_secret, :term => search_term},
|
50
|
+
'Authorization': bearer_token})
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.get_widget(widget)
|
54
|
+
widget_data = WidgetBase.new
|
55
|
+
widget_data.widget = widget
|
56
|
+
return widget_data
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/services/authentication_service'
|
4
|
+
require File.dirname(__FILE__) + '/services/user_service'
|
5
|
+
require File.dirname(__FILE__) + '/services/widget_service'
|
6
|
+
require File.dirname(__FILE__) + '/services/user_widget_service'
|
7
|
+
require File.dirname(__FILE__) + '/domain/application_config'
|
8
|
+
|
9
|
+
class WidgetsApiClient
|
10
|
+
|
11
|
+
def self.set_config(client_id, client_secret)
|
12
|
+
ApplicationConfig.set_config(client_id, client_secret)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
#Create authentication token
|
17
|
+
def self.create_authentication_token(auth_data)
|
18
|
+
return AuthenticationService.create_authentication(auth_data)
|
19
|
+
end
|
20
|
+
|
21
|
+
#Refresh authentication token
|
22
|
+
def self.refresh_authentication_token(auth_data, bearer_token)
|
23
|
+
return AuthenticationService.refresh_authentication_token(auth_data, bearer_token)
|
24
|
+
end
|
25
|
+
|
26
|
+
#Revoke authentication token
|
27
|
+
def self.revoke_authentication_token(auth_data, bearer_token)
|
28
|
+
return AuthenticationService.revoke_authentication_token(auth_data, bearer_token)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
#Create user
|
33
|
+
def self.create_user(user_data)
|
34
|
+
return UserService.create_user(user_data)
|
35
|
+
end
|
36
|
+
|
37
|
+
#Update user
|
38
|
+
def self.update_user(user_data, bearer_token)
|
39
|
+
return UserService.update_user(user_data, bearer_token)
|
40
|
+
end
|
41
|
+
|
42
|
+
#Check email
|
43
|
+
def self.check_email(user_data)
|
44
|
+
return UserService.check_email(user_data)
|
45
|
+
end
|
46
|
+
|
47
|
+
#Reset password
|
48
|
+
def self.reset_password(user_data)
|
49
|
+
return UserService.reset_password(user_data)
|
50
|
+
end
|
51
|
+
|
52
|
+
#Change password
|
53
|
+
def self.change_password(user_data, bearer_token)
|
54
|
+
return UserService.change_password(user_data, bearer_token)
|
55
|
+
end
|
56
|
+
|
57
|
+
#Show logged in user
|
58
|
+
def self.show_logged_in_user(bearer_token)
|
59
|
+
return UserService.show_logged_in_user(bearer_token)
|
60
|
+
end
|
61
|
+
|
62
|
+
#Show user id
|
63
|
+
def self.show_user_id(user_id, bearer_token)
|
64
|
+
return UserService.show_user_id(user_id, bearer_token)
|
65
|
+
end
|
66
|
+
|
67
|
+
#Get private widgets
|
68
|
+
def self.get_private_widgets(bearer_token)
|
69
|
+
return UserWidgetService.get_private_widgets(bearer_token)
|
70
|
+
end
|
71
|
+
|
72
|
+
#Get private widgets with search term
|
73
|
+
def self.get_private_widgets_with_search_term(search_term, bearer_token)
|
74
|
+
return UserWidgetService.get_private_widgets_with_search_term(search_term, bearer_token)
|
75
|
+
end
|
76
|
+
|
77
|
+
#Get widgets by user id
|
78
|
+
def self.get_widgets_by_user_id(user_id, bearer_token)
|
79
|
+
return UserWidgetService.get_widgets_by_user_id(user_id, bearer_token)
|
80
|
+
end
|
81
|
+
|
82
|
+
#Get widgets by user id with search term
|
83
|
+
def self.get_widgets_by_user_id_with_search_term(user_id, search_term, bearer_token)
|
84
|
+
return UserWidgetService.get_widgets_by_user_id_with_search_term(user_id, search_term, bearer_token)
|
85
|
+
end
|
86
|
+
|
87
|
+
#Create widget
|
88
|
+
def self.create_widget(widget_data, bearer_token)
|
89
|
+
return WidgetService.create_widget(widget_data, bearer_token)
|
90
|
+
end
|
91
|
+
|
92
|
+
#Update widget
|
93
|
+
def self.update_widget(widget_data, widget_id, bearer_token)
|
94
|
+
return WidgetService.update_widget(widget_data, widget_id, bearer_token)
|
95
|
+
end
|
96
|
+
|
97
|
+
#Destroy widget
|
98
|
+
def self.destroy_widget(widget_id, bearer_token)
|
99
|
+
return WidgetService.destroy_widget(widget_id, bearer_token)
|
100
|
+
end
|
101
|
+
|
102
|
+
#Get private widgets
|
103
|
+
def self.get_private_widgets(bearer_token)
|
104
|
+
return WidgetService.get_private_widgets(bearer_token)
|
105
|
+
end
|
106
|
+
|
107
|
+
#Get public widgets
|
108
|
+
def self.get_public_widgets(bearer_token)
|
109
|
+
return WidgetService.get_public_widgets(bearer_token)
|
110
|
+
end
|
111
|
+
|
112
|
+
#Get public widgets with serach term
|
113
|
+
def self.get_public_widgets_with_search_term(search_term, bearer_token)
|
114
|
+
return WidgetService.get_public_widgets_with_search_term(search_term, bearer_token)
|
115
|
+
end
|
116
|
+
|
117
|
+
#Remove after tesing
|
118
|
+
def self.get_access_token
|
119
|
+
return ApplicationConfig.get_access_token
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: widgets_api_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sachin Murthy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.7'
|
27
|
+
description:
|
28
|
+
email: sachinmurthy93@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- lib/domain/application_config.rb
|
36
|
+
- lib/domain/authentication.rb
|
37
|
+
- lib/domain/client_info_base.rb
|
38
|
+
- lib/domain/user.rb
|
39
|
+
- lib/domain/user_base.rb
|
40
|
+
- lib/domain/widget.rb
|
41
|
+
- lib/domain/widget_base.rb
|
42
|
+
- lib/services/authentication_service.rb
|
43
|
+
- lib/services/user_service.rb
|
44
|
+
- lib/services/user_widget_service.rb
|
45
|
+
- lib/services/widget_service.rb
|
46
|
+
- lib/widgets_api_client.rb
|
47
|
+
homepage: http://rubygems.org/gems/widgets_api_client
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Wigets Api Client Wrapper
|
70
|
+
test_files: []
|