shilpa20 1.2.4 → 1.2.5
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 +4 -4
- data/lib/domain/password.rb +43 -0
- data/lib/domain/user.rb +11 -18
- data/lib/shilpa20/authentication_service.rb +7 -3
- data/lib/shilpa20/user_service.rb +12 -9
- data/lib/shilpa20/user_widget_service.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c6986d45b58b2660143acc5de5807253198e6981314c40d9d081db6f52de9df
|
4
|
+
data.tar.gz: ea96ab114a0aa4a2cc211d658352e10b257f1f53db4018f23d947fa3fa091179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b2f9e7ee7e55af5b3d19a24381c7db70b9d68c46c4a6097de656d79bb1eb0e3d4ca544230775028fcae3d903cb6bb01faa56ab9ee6ad60a9a1c2537defeaf94
|
7
|
+
data.tar.gz: 02edc4fd36ab0832a28e5560e83aff3f8619c789a9990c4cc87a43aac1dfd6d834ce0e0e11fb4d3d4e9c491d4d3c8785bfe36ce8e52592b8d31c72224401c61c
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'json'
|
2
|
+
class Password
|
3
|
+
attr_accessor :current_password
|
4
|
+
attr_accessor :new_password
|
5
|
+
|
6
|
+
def initialize current_password: nil, new_password: nil
|
7
|
+
self.current_password, self.new_password = current_password, new_password
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_json(*a)
|
11
|
+
{
|
12
|
+
current_password: @current_password,
|
13
|
+
new_password: @new_password,
|
14
|
+
}.to_json(*a)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.json_create(o)
|
18
|
+
b_from_json = new
|
19
|
+
b_from_json.current_password = o['current_password']
|
20
|
+
b_from_json.new_password = o['new_password']
|
21
|
+
b_from_json
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.get_payload(password)
|
25
|
+
return password.to_json
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
class PasswordBase
|
31
|
+
attr_accessor :user
|
32
|
+
|
33
|
+
def to_json(*a)
|
34
|
+
{
|
35
|
+
user: @user
|
36
|
+
}.to_json(*a)
|
37
|
+
end
|
38
|
+
def self.json_create(o)
|
39
|
+
a_from_json = new
|
40
|
+
a_from_json.user = o['user']
|
41
|
+
a_from_json
|
42
|
+
end
|
43
|
+
end
|
data/lib/domain/user.rb
CHANGED
@@ -4,31 +4,26 @@ class User
|
|
4
4
|
attr_accessor :first_name
|
5
5
|
attr_accessor :last_name
|
6
6
|
attr_accessor :password
|
7
|
-
attr_accessor :current_password
|
8
|
-
attr_accessor :new_password
|
9
7
|
attr_accessor :date_of_birth
|
10
8
|
attr_accessor :email
|
11
9
|
attr_accessor :image_url
|
12
10
|
|
13
|
-
def initialize first_name: nil, last_name: nil, password: nil,
|
14
|
-
date_of_birth
|
15
|
-
|
16
|
-
self.date_of_birth, self.email, self.image_url =
|
17
|
-
first_name, last_name, password,current_password, new_password, date_of_birth, email, image_url
|
11
|
+
def initialize first_name: nil, last_name: nil, password: nil, date_of_birth:nil, email: nil, image_url: nil
|
12
|
+
self.first_name, self.last_name, self.password, self.date_of_birth, self.email, self.image_url =
|
13
|
+
first_name, last_name, password,date_of_birth, email, image_url
|
18
14
|
end
|
19
15
|
|
20
16
|
|
17
|
+
|
21
18
|
def to_json(*a)
|
22
19
|
{
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
image_url: @image_url
|
31
|
-
}.to_json(*a)
|
20
|
+
first_name: @first_name,
|
21
|
+
last_name: @last_name,
|
22
|
+
password: @password,
|
23
|
+
date_of_birth: @date_of_birth,
|
24
|
+
email: @email,
|
25
|
+
image_url: @image_url
|
26
|
+
}.to_json(*a)
|
32
27
|
end
|
33
28
|
|
34
29
|
def self.json_create(o)
|
@@ -36,8 +31,6 @@ class User
|
|
36
31
|
b_from_json.first_name = o['first_name']
|
37
32
|
b_from_json.last_name = o['last_name']
|
38
33
|
b_from_json.password = o['password']
|
39
|
-
b_from_json.current_password = o['current_password']
|
40
|
-
b_from_json.new_password = o['new_password']
|
41
34
|
b_from_json.date_of_birth = o['date_of_birth']
|
42
35
|
b_from_json.email = o['email']
|
43
36
|
b_from_json.image_url = o['image_url']
|
@@ -6,8 +6,6 @@ require_relative '../domain/application_config.rb'
|
|
6
6
|
class AuthenticationService
|
7
7
|
@@authentication_url = 'https://showoff-rails-react-production.herokuapp.com/oauth/token'
|
8
8
|
@@revoke_url = 'https://showoff-rails-react-production.herokuapp.com/oauth/revoke'
|
9
|
-
# @@client_id = ApplicationConfig.get_client_id
|
10
|
-
# @@client_secret = ApplicationConfig.get_client_secret
|
11
9
|
|
12
10
|
def self.create_authentication(auth_data)
|
13
11
|
auth_data = get_auth_with_client_info(auth_data)
|
@@ -41,7 +39,7 @@ class AuthenticationService
|
|
41
39
|
auth.grant_type = "password"
|
42
40
|
# auth.client_id = "277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe"
|
43
41
|
#auth.client_secret = "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352"
|
44
|
-
auth.username = "
|
42
|
+
auth.username = "sachinmurthy1000@gmail.com"
|
45
43
|
auth.password = "password"
|
46
44
|
return auth
|
47
45
|
end
|
@@ -67,6 +65,12 @@ class AuthenticationService
|
|
67
65
|
|
68
66
|
end
|
69
67
|
|
68
|
+
|
69
|
+
#ApplicationConfig.set_config("277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe", "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352")
|
70
|
+
#auth_data = AuthenticationService.create_auth_data
|
71
|
+
#puts AuthenticationService.create_authentication(auth_data)
|
72
|
+
|
73
|
+
|
70
74
|
# to remove once tested -test create auth
|
71
75
|
=begin
|
72
76
|
|
@@ -41,8 +41,8 @@ class UserService
|
|
41
41
|
headers: {'Content-Type': 'application/json'})
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.change_password(
|
45
|
-
change_password_payload =
|
44
|
+
def self.change_password(password, bearer_token)
|
45
|
+
change_password_payload = Password.get_payload(password)
|
46
46
|
return RestClient::Request.execute(method: :post, url: @@change_password_url,
|
47
47
|
payload: change_password_payload,
|
48
48
|
headers: {'Content-Type': 'application/json', 'Authorization': bearer_token})
|
@@ -70,13 +70,13 @@ class UserService
|
|
70
70
|
# to remove once tested
|
71
71
|
def self.create_user_with_client_info
|
72
72
|
user = User.new
|
73
|
-
user.first_name = "Sachin
|
73
|
+
user.first_name = "Sachin New1000"
|
74
74
|
user.last_name = "Murthy"
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
# user.password = "password"
|
76
|
+
# user.current_password = "password"
|
77
|
+
# user.new_password = "password123"
|
78
78
|
user.date_of_birth = 1464083530
|
79
|
-
user.email = "
|
79
|
+
#user.email = "sachinmurthy1000@gmail.com"
|
80
80
|
user.image_url = "https://static.thenounproject.com/png/961-200.png"
|
81
81
|
|
82
82
|
#user_with_client_info = ClientInfoBase.new
|
@@ -90,5 +90,8 @@ end
|
|
90
90
|
|
91
91
|
# to remove once tested
|
92
92
|
#ApplicationConfig.set_config("277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe", "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352")
|
93
|
-
#
|
94
|
-
#
|
93
|
+
#user = User.new
|
94
|
+
#user.email = "sachinmurthy93@gmail.com"
|
95
|
+
#puts userWithClientIfno = UserService.check_email(user)
|
96
|
+
#user = UserService.create_user_with_client_info
|
97
|
+
#puts UserService.update_user(user, "848c39c1796fbaeacd0691a7c044aaa93d43ea14fdfeed562800cb52a0242a1b")
|
@@ -7,7 +7,7 @@ require_relative '../domain/application_config.rb'
|
|
7
7
|
class UserWidgetService
|
8
8
|
@@own_widgets_url = 'https://showoff-rails-react-production.herokuapp.com/api/v1/users/me/widgets'
|
9
9
|
@@widgets_by_user_id_url ='https://showoff-rails-react-production.herokuapp.com/api/v1/users/'
|
10
|
-
|
10
|
+
#@@client_id = ApplicationConfig.get_client_id
|
11
11
|
#@@client_secret = ApplicationConfig.get_client_secret
|
12
12
|
|
13
13
|
def self.get_private_widgets(bearer_token)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shilpa20
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sachin Murthy
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/domain/application_config.rb
|
36
36
|
- lib/domain/authentication.rb
|
37
37
|
- lib/domain/client_info_base.rb
|
38
|
+
- lib/domain/password.rb
|
38
39
|
- lib/domain/user.rb
|
39
40
|
- lib/domain/widget.rb
|
40
41
|
- lib/domain/widget_base.rb
|