widgets_api_client 0.0.9.4 → 0.0.9.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/application_config.rb +17 -11
- data/lib/services/user_service.rb +1 -1
- data/lib/services/widget_service.rb +2 -2
- data/lib/widgets_api_client.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db0460ec465cc0dda6a95f45e2697ad1861d38d1d7b160e46fa08c9076dbc99
|
4
|
+
data.tar.gz: 6e84623b4658c8085a91f97c49943afff400546ffb438671ba993e45aaa169e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f07d58e7b7ab2e81452a2db3106886a5b597d89b191619e5b41503751823b75658ef1ae02e6685a12b8bd421ed03e0191242b8d2fee218a08c6ed6cea60d3b
|
7
|
+
data.tar.gz: 410512aae3f34b3a0785477e1c10a2e4af8bd1b24d972094aa61979425b4ebe7a1dee2b68391205f870da47c2ff3c1f108cf6f078a86e035e015b4662520ab05
|
@@ -4,10 +4,16 @@ require 'yaml'
|
|
4
4
|
# Sets Application Configurations
|
5
5
|
#
|
6
6
|
class ApplicationConfig
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
class << self
|
8
|
+
attr_accessor :client_id
|
9
|
+
attr_accessor :client_secret
|
10
|
+
attr_accessor :base_url
|
11
|
+
attr_accessor :config
|
12
|
+
end
|
13
|
+
#@@client_id = ''
|
14
|
+
#@@client_secret = ''
|
15
|
+
#@@base_url = ''
|
16
|
+
#@@config = {}
|
11
17
|
|
12
18
|
#
|
13
19
|
# Sets Application Configuration
|
@@ -17,10 +23,10 @@ class ApplicationConfig
|
|
17
23
|
# @param [String] base_url
|
18
24
|
#
|
19
25
|
def self.set_config(client_id, client_secret, base_url)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
26
|
+
@client_id = client_id
|
27
|
+
@client_secret = client_secret
|
28
|
+
@base_url = base_url
|
29
|
+
@config = YAML.load_file(File.join(File.dirname(File.dirname(__FILE__)), 'config.yml'))
|
24
30
|
end
|
25
31
|
|
26
32
|
#
|
@@ -29,7 +35,7 @@ class ApplicationConfig
|
|
29
35
|
# @return [String]
|
30
36
|
#
|
31
37
|
def self.client_id
|
32
|
-
|
38
|
+
@client_id
|
33
39
|
end
|
34
40
|
|
35
41
|
#
|
@@ -38,7 +44,7 @@ class ApplicationConfig
|
|
38
44
|
# @return [String]
|
39
45
|
#
|
40
46
|
def self.client_secret
|
41
|
-
|
47
|
+
@client_secret
|
42
48
|
end
|
43
49
|
|
44
50
|
#
|
@@ -47,7 +53,7 @@ class ApplicationConfig
|
|
47
53
|
# @return [String]
|
48
54
|
#
|
49
55
|
def self.get_url(key)
|
50
|
-
url =
|
56
|
+
url = @base_url + @config[key]
|
51
57
|
url
|
52
58
|
end
|
53
59
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'json'
|
3
|
+
require_relative '../domain/application_config.rb'
|
3
4
|
require_relative '../domain/client_info_base.rb'
|
4
5
|
require_relative '../domain/user.rb'
|
5
6
|
require_relative '../domain/user_base.rb'
|
6
|
-
require_relative '../domain/application_config.rb'
|
7
7
|
|
8
8
|
#
|
9
9
|
# User Service for CRUD operation related to user
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'json'
|
3
|
+
require_relative '../domain/application_config.rb'
|
3
4
|
require_relative '../domain/widget_base.rb'
|
4
5
|
require_relative '../domain/widget.rb'
|
5
|
-
require_relative '../domain/application_config.rb'
|
6
6
|
|
7
7
|
#
|
8
8
|
# Widget Service for CRUD operation related to widget
|
@@ -35,9 +35,9 @@ class WidgetService
|
|
35
35
|
# @return [Json] Response of update widget
|
36
36
|
#
|
37
37
|
def self.update_widget(widget, widget_id, bearer_token)
|
38
|
-
update_url_with_widget_id = ApplicationConfig.get_url('create_widget_path') + '/' + widget_id.to_s
|
39
38
|
widget_data = get_widget(widget)
|
40
39
|
update_widget_payload = Widget.get_payload(widget_data)
|
40
|
+
update_url_with_widget_id = ApplicationConfig.get_url('update_widget_path') + '/' + widget_id.to_s
|
41
41
|
RestClient::Request.execute(method: :put, url: update_url_with_widget_id,
|
42
42
|
payload: update_widget_payload,
|
43
43
|
headers: { 'Content-Type': 'application/json',
|
data/lib/widgets_api_client.rb
CHANGED
@@ -196,3 +196,16 @@ class WidgetsApiClient
|
|
196
196
|
WidgetService.get_public_widgets_with_search_term(search_term, bearer_token)
|
197
197
|
end
|
198
198
|
end
|
199
|
+
|
200
|
+
#WidgetsApiClient.set_config("277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe", "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352", "https://showoff-rails-react-production.herokuapp.com")
|
201
|
+
#user = User.new
|
202
|
+
#user.email ='sachinmurthy93@gmail.com'
|
203
|
+
#puts WidgetsApiClient.reset_password(user)
|
204
|
+
|
205
|
+
#WidgetsApiClient.set_config("277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe", "d6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352", "https://showoff-rails-react-production.herokuapp.com")
|
206
|
+
#puts WidgetsApiClient.client_id
|
207
|
+
#widget = Widget.new
|
208
|
+
#widget.name ='test123'
|
209
|
+
#puts WidgetsApiClient.update_widget(widget, "201", "Bearer 8b80d74b6cbb3fd10288432be2e1e5c9dcfdf781dbabf45cea59e925538dcd9e")
|
210
|
+
|
211
|
+
|