ZCRMSDK 2.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/ZCRMSDK.rb +87 -2
- data/src/com/zoho/api/authenticator/oauth_token.rb +86 -31
- data/src/com/zoho/api/authenticator/store/db_store.rb +71 -29
- data/src/com/zoho/api/authenticator/store/file_store.rb +91 -21
- data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
- data/src/com/zoho/api/logger/sdk_logger.rb +18 -9
- data/src/com/zoho/crm/api/assignment_rules/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rule.rb +215 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rules_operations.rb +61 -0
- data/src/com/zoho/crm/api/assignment_rules/default_user.rb +80 -0
- data/src/com/zoho/crm/api/assignment_rules/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/assignment_rules/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/attachments/attachment.rb +42 -4
- data/src/com/zoho/crm/api/attachments/attachments_operations.rb +6 -6
- data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +2 -2
- data/src/com/zoho/crm/api/blue_print/escalation.rb +80 -0
- data/src/com/zoho/crm/api/blue_print/field.rb +1127 -0
- data/src/com/zoho/crm/api/blue_print/next_transition.rb +38 -0
- data/src/com/zoho/crm/api/blue_print/process_info.rb +4 -4
- data/src/com/zoho/crm/api/blue_print/transition.rb +19 -1
- data/src/com/zoho/crm/api/blue_print/validation_error.rb +57 -0
- data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_read/criteria.rb +20 -0
- data/src/com/zoho/crm/api/bulk_read/query.rb +5 -4
- data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_write/resource.rb +24 -4
- data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +7 -7
- data/src/com/zoho/crm/api/currencies/currencies_operations.rb +7 -7
- data/src/com/zoho/crm/api/custom_views/criteria.rb +5 -4
- data/src/com/zoho/crm/api/custom_views/custom_view.rb +100 -41
- data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +2 -2
- data/src/com/zoho/crm/api/custom_views/{shared_details.rb → shared_to.rb} +2 -2
- data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
- data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/email_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/email_templates/attachment.rb +118 -0
- data/src/com/zoho/crm/api/email_templates/email_template.rb +390 -0
- data/src/com/zoho/crm/api/email_templates/email_templates_operations.rb +61 -0
- data/src/com/zoho/crm/api/email_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/email_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/field_attachments/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/field_attachments/body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/field_attachments/field_attachments_operations.rb +52 -0
- data/src/com/zoho/crm/api/field_attachments/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/field_attachments/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/fields/external.rb +99 -0
- data/src/com/zoho/crm/api/fields/field.rb +215 -61
- data/src/com/zoho/crm/api/fields/fields_operations.rb +2 -2
- data/src/com/zoho/crm/api/fields/history_tracking.rb +80 -0
- data/src/com/zoho/crm/api/fields/maps.rb +80 -0
- data/src/com/zoho/crm/api/fields/multi_module_lookup.rb +99 -0
- data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +19 -0
- data/src/com/zoho/crm/api/fields/multi_user_lookup.rb +175 -0
- data/src/com/zoho/crm/api/fields/pick_list_value.rb +19 -0
- data/src/com/zoho/crm/api/fields/related_details.rb +19 -0
- data/src/com/zoho/crm/api/files/file_operations.rb +2 -2
- data/src/com/zoho/crm/api/initializer.rb +45 -17
- data/src/com/zoho/crm/api/inventory_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_template.rb +352 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_templates_operations.rb +82 -0
- data/src/com/zoho/crm/api/inventory_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/inventory_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/layouts/layout.rb +38 -0
- data/src/com/zoho/crm/api/layouts/layouts_operations.rb +2 -2
- data/src/com/zoho/crm/api/layouts/section.rb +19 -0
- data/src/com/zoho/crm/api/modules/module.rb +57 -0
- data/src/com/zoho/crm/api/modules/modules_operations.rb +4 -4
- data/src/com/zoho/crm/api/notes/note.rb +19 -0
- data/src/com/zoho/crm/api/notes/notes_operations.rb +7 -7
- data/src/com/zoho/crm/api/notification/notification_operations.rb +6 -6
- data/src/com/zoho/crm/api/org/hierarchy_preference.rb +61 -0
- data/src/com/zoho/crm/api/org/org.rb +38 -0
- data/src/com/zoho/crm/api/org/org_operations.rb +2 -2
- data/src/com/zoho/crm/api/pipeline/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/api_exception.rb +129 -0
- data/src/com/zoho/crm/api/pipeline/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/forecast_category.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/pick_list_value.rb +175 -0
- data/src/com/zoho/crm/api/pipeline/pipeline.rb +213 -0
- data/src/com/zoho/crm/api/pipeline/pipeline_operations.rb +165 -0
- data/src/com/zoho/crm/api/pipeline/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/stage.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/success_response.rb +123 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/transfer_and_delete_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/transfer_pipe_line.rb +80 -0
- data/src/com/zoho/crm/api/profiles/category.rb +19 -0
- data/src/com/zoho/crm/api/profiles/default_view.rb +99 -0
- data/src/com/zoho/crm/api/profiles/profile.rb +49 -11
- data/src/com/zoho/crm/api/profiles/profiles_operations.rb +2 -2
- data/src/com/zoho/crm/api/query/query_operations.rb +1 -1
- data/src/com/zoho/crm/api/record/api_exception.rb +2 -0
- data/src/com/zoho/crm/api/record/body_wrapper.rb +0 -19
- data/src/com/zoho/crm/api/record/count_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/count_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/field.rb +17 -17
- data/src/com/zoho/crm/api/record/image_upload.rb +213 -0
- data/src/com/zoho/crm/api/record/line_tax.rb +19 -0
- data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +4 -4
- data/src/com/zoho/crm/api/record/mass_update_territory.rb +80 -0
- data/src/com/zoho/crm/api/record/multi_select_lookup.rb +99 -0
- data/src/com/zoho/crm/api/record/multi_select_picklist.rb +80 -0
- data/src/com/zoho/crm/api/record/price_book.rb +31 -0
- data/src/com/zoho/crm/api/record/record_operations.rb +196 -26
- data/src/com/zoho/crm/api/record/tax.rb +80 -0
- data/src/com/zoho/crm/api/record/territory.rb +70 -12
- data/src/com/zoho/crm/api/record/widget.rb +80 -0
- data/src/com/zoho/crm/api/record/wizard.rb +80 -0
- data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +2 -2
- data/src/com/zoho/crm/api/related_records/related_records_operations.rb +6 -6
- data/src/com/zoho/crm/api/request_proxy.rb +3 -4
- data/src/com/zoho/crm/api/roles/roles_operations.rb +2 -2
- data/src/com/zoho/crm/api/sdk_config.rb +2 -68
- data/src/com/zoho/crm/api/send_mail/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_response.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/send_mail/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/data_subject_request.rb +80 -0
- data/src/com/zoho/crm/api/send_mail/inventory_details.rb +100 -0
- data/src/com/zoho/crm/api/send_mail/mail.rb +423 -0
- data/src/com/zoho/crm/api/send_mail/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/send_mail_operations.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/success_response.rb +121 -0
- data/src/com/zoho/crm/api/send_mail/template.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/user_address.rb +137 -0
- data/src/com/zoho/crm/api/share_records/share_records_operations.rb +4 -4
- data/src/com/zoho/crm/api/tags/tag.rb +19 -0
- data/src/com/zoho/crm/api/tags/tags_operations.rb +11 -11
- data/src/com/zoho/crm/api/taxes/taxes_operations.rb +6 -6
- data/src/com/zoho/crm/api/territories/response_wrapper.rb +20 -0
- data/src/com/zoho/crm/api/territories/territories_operations.rb +2 -2
- data/src/com/zoho/crm/api/territories/territory.rb +61 -23
- data/src/com/zoho/crm/api/users/user.rb +34 -0
- data/src/com/zoho/crm/api/users/users_operations.rb +6 -6
- data/src/com/zoho/crm/api/util/api_http_connector.rb +6 -5
- data/src/com/zoho/crm/api/util/common_api_handler.rb +5 -3
- data/src/com/zoho/crm/api/util/constants.rb +140 -15
- data/src/com/zoho/crm/api/util/converter.rb +30 -7
- data/src/com/zoho/crm/api/util/data_type_converter.rb +8 -2
- data/src/com/zoho/crm/api/util/form_data_converter.rb +4 -15
- data/src/com/zoho/crm/api/util/json_converter.rb +7 -9
- data/src/com/zoho/crm/api/util/module_fields_handler.rb +1 -1
- data/src/com/zoho/crm/api/util/utility.rb +274 -87
- data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +3 -3
- data/src/com/zoho/crm/api/variables/variables_operations.rb +9 -9
- data/src/com/zoho/crm/api/wizards/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/wizards/button.rb +252 -0
- data/src/com/zoho/crm/api/wizards/chart_data.rb +118 -0
- data/src/com/zoho/crm/api/wizards/connection.rb +80 -0
- data/src/com/zoho/crm/api/wizards/container.rb +119 -0
- data/src/com/zoho/crm/api/wizards/node.rb +118 -0
- data/src/com/zoho/crm/api/wizards/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/wizards/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/wizards/screen.rb +99 -0
- data/src/com/zoho/crm/api/wizards/segment.rb +176 -0
- data/src/com/zoho/crm/api/wizards/transition.rb +80 -0
- data/src/com/zoho/crm/api/wizards/wizard.rb +273 -0
- data/src/com/zoho/crm/api/wizards/wizards_operations.rb +61 -0
- data/src/resources/JSONDetails.json +1 -1
- data/src/version.rb +1 -1
- metadata +92 -7
- data/src/com/zoho/crm/api/record/inventory_line_items.rb +0 -235
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bcdf0ada8fb38f6175f5b815b85ab52c0265934ed70fb67f285d8d517da63de
|
4
|
+
data.tar.gz: 0dad85314161407c0be51369ba40958b348510e6b84ff4738f61a61655f358b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5529c530fdcac691130683571766b079dea3635496269e96e47cebc0237eceff2c82428f8f52a112a49209e1d6502ff4f806fab8ecaf32c70c74a8ecea348527
|
7
|
+
data.tar.gz: 6bce9195c3135e567bbc635ad03f44fa9b544734bdac96a236a0af88cdb6228a7e23178a9b0c177a424034d1a51d52195e7b16ee86dcde3a1669fd7c7f9a411d
|
data/src/ZCRMSDK.rb
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
require 'version.rb'
|
2
2
|
require 'com/zoho/crm/api/request_proxy.rb'
|
3
|
+
require 'com/zoho/crm/api/pipeline/transfer_action_handler.rb'
|
4
|
+
require 'com/zoho/crm/api/pipeline/stage.rb'
|
5
|
+
require 'com/zoho/crm/api/pipeline/transfer_action_response.rb'
|
6
|
+
require 'com/zoho/crm/api/pipeline/body_wrapper.rb'
|
7
|
+
require 'com/zoho/crm/api/pipeline/transfer_action_wrapper.rb'
|
8
|
+
require 'com/zoho/crm/api/pipeline/pipeline.rb'
|
9
|
+
require 'com/zoho/crm/api/pipeline/action_handler.rb'
|
10
|
+
require 'com/zoho/crm/api/pipeline/pipeline_operations.rb'
|
11
|
+
require 'com/zoho/crm/api/pipeline/transfer_and_delete_wrapper.rb'
|
12
|
+
require 'com/zoho/crm/api/pipeline/pick_list_value.rb'
|
13
|
+
require 'com/zoho/crm/api/pipeline/action_wrapper.rb'
|
14
|
+
require 'com/zoho/crm/api/pipeline/forecast_category.rb'
|
15
|
+
require 'com/zoho/crm/api/pipeline/transfer_pipe_line.rb'
|
16
|
+
require 'com/zoho/crm/api/pipeline/response_wrapper.rb'
|
17
|
+
require 'com/zoho/crm/api/pipeline/api_exception.rb'
|
18
|
+
require 'com/zoho/crm/api/pipeline/success_response.rb'
|
19
|
+
require 'com/zoho/crm/api/pipeline/action_response.rb'
|
20
|
+
require 'com/zoho/crm/api/pipeline/response_handler.rb'
|
3
21
|
require 'com/zoho/crm/api/currencies/body_wrapper.rb'
|
4
22
|
require 'com/zoho/crm/api/currencies/currencies_operations.rb'
|
5
23
|
require 'com/zoho/crm/api/currencies/currency.rb'
|
@@ -22,7 +40,6 @@ require 'com/zoho/crm/api/territories/response_handler.rb'
|
|
22
40
|
require 'com/zoho/crm/api/record/consent.rb'
|
23
41
|
require 'com/zoho/crm/api/record/line_tax.rb'
|
24
42
|
require 'com/zoho/crm/api/record/reminder.rb'
|
25
|
-
require 'com/zoho/crm/api/record/inventory_line_items.rb'
|
26
43
|
require 'com/zoho/crm/api/record/body_wrapper.rb'
|
27
44
|
require 'com/zoho/crm/api/record/info.rb'
|
28
45
|
require 'com/zoho/crm/api/record/download_handler.rb'
|
@@ -35,17 +52,23 @@ require 'com/zoho/crm/api/record/participants.rb'
|
|
35
52
|
require 'com/zoho/crm/api/record/remind_at.rb'
|
36
53
|
require 'com/zoho/crm/api/record/carry_over_tags.rb'
|
37
54
|
require 'com/zoho/crm/api/record/record.rb'
|
55
|
+
require 'com/zoho/crm/api/record/wizard.rb'
|
38
56
|
require 'com/zoho/crm/api/record/convert_body_wrapper.rb'
|
57
|
+
require 'com/zoho/crm/api/record/price_book.rb'
|
39
58
|
require 'com/zoho/crm/api/record/file_details.rb'
|
40
59
|
require 'com/zoho/crm/api/record/action_wrapper.rb'
|
41
60
|
require 'com/zoho/crm/api/record/deleted_records_handler.rb'
|
42
61
|
require 'com/zoho/crm/api/record/convert_action_handler.rb'
|
62
|
+
require 'com/zoho/crm/api/record/mass_update_territory.rb'
|
63
|
+
require 'com/zoho/crm/api/record/multi_select_lookup.rb'
|
64
|
+
require 'com/zoho/crm/api/record/multi_select_picklist.rb'
|
43
65
|
require 'com/zoho/crm/api/record/mass_update.rb'
|
44
66
|
require 'com/zoho/crm/api/record/mass_update_action_response.rb'
|
45
67
|
require 'com/zoho/crm/api/record/deleted_record.rb'
|
46
68
|
require 'com/zoho/crm/api/record/convert_action_wrapper.rb'
|
47
69
|
require 'com/zoho/crm/api/record/territory.rb'
|
48
70
|
require 'com/zoho/crm/api/record/mass_update_response.rb'
|
71
|
+
require 'com/zoho/crm/api/record/widget.rb'
|
49
72
|
require 'com/zoho/crm/api/record/mass_update_body_wrapper.rb'
|
50
73
|
require 'com/zoho/crm/api/record/mass_update_success_response.rb'
|
51
74
|
require 'com/zoho/crm/api/record/response_wrapper.rb'
|
@@ -55,18 +78,27 @@ require 'com/zoho/crm/api/record/comment.rb'
|
|
55
78
|
require 'com/zoho/crm/api/record/file_handler.rb'
|
56
79
|
require 'com/zoho/crm/api/record/api_exception.rb'
|
57
80
|
require 'com/zoho/crm/api/record/mass_update_response_handler.rb'
|
81
|
+
require 'com/zoho/crm/api/record/count_handler.rb'
|
58
82
|
require 'com/zoho/crm/api/record/options.rb'
|
59
83
|
require 'com/zoho/crm/api/record/field.rb'
|
60
84
|
require 'com/zoho/crm/api/record/recurring_activity.rb'
|
85
|
+
require 'com/zoho/crm/api/record/tax.rb'
|
86
|
+
require 'com/zoho/crm/api/record/image_upload.rb'
|
61
87
|
require 'com/zoho/crm/api/record/criteria.rb'
|
62
88
|
require 'com/zoho/crm/api/record/mass_update_response_wrapper.rb'
|
63
89
|
require 'com/zoho/crm/api/record/success_response.rb'
|
90
|
+
require 'com/zoho/crm/api/record/count_wrapper.rb'
|
64
91
|
require 'com/zoho/crm/api/record/action_response.rb'
|
65
92
|
require 'com/zoho/crm/api/record/pricing_details.rb'
|
66
93
|
require 'com/zoho/crm/api/record/response_handler.rb'
|
67
94
|
require 'com/zoho/crm/api/record/successful_convert.rb'
|
68
95
|
require 'com/zoho/crm/api/record/line_item_product.rb'
|
69
96
|
require 'com/zoho/crm/api/record/mass_update_action_wrapper.rb'
|
97
|
+
require 'com/zoho/crm/api/field_attachments/body_wrapper.rb'
|
98
|
+
require 'com/zoho/crm/api/field_attachments/file_body_wrapper.rb'
|
99
|
+
require 'com/zoho/crm/api/field_attachments/api_exception.rb'
|
100
|
+
require 'com/zoho/crm/api/field_attachments/response_handler.rb'
|
101
|
+
require 'com/zoho/crm/api/field_attachments/field_attachments_operations.rb'
|
70
102
|
require 'com/zoho/crm/api/sdk_config.rb'
|
71
103
|
require 'com/zoho/crm/api/util/api_http_connector.rb'
|
72
104
|
require 'com/zoho/crm/api/util/form_data_converter.rb'
|
@@ -99,6 +131,7 @@ require 'com/zoho/crm/api/notification/api_exception.rb'
|
|
99
131
|
require 'com/zoho/crm/api/notification/success_response.rb'
|
100
132
|
require 'com/zoho/crm/api/notification/action_response.rb'
|
101
133
|
require 'com/zoho/crm/api/notification/response_handler.rb'
|
134
|
+
require 'com/zoho/crm/api/org/hierarchy_preference.rb'
|
102
135
|
require 'com/zoho/crm/api/org/org_operations.rb'
|
103
136
|
require 'com/zoho/crm/api/org/license_details.rb'
|
104
137
|
require 'com/zoho/crm/api/org/response_wrapper.rb'
|
@@ -108,18 +141,31 @@ require 'com/zoho/crm/api/org/success_response.rb'
|
|
108
141
|
require 'com/zoho/crm/api/org/action_response.rb'
|
109
142
|
require 'com/zoho/crm/api/org/response_handler.rb'
|
110
143
|
require 'com/zoho/crm/api/org/org.rb'
|
144
|
+
require 'com/zoho/crm/api/inventory_templates/inventory_templates_operations.rb'
|
145
|
+
require 'com/zoho/crm/api/inventory_templates/inventory_template.rb'
|
146
|
+
require 'com/zoho/crm/api/inventory_templates/response_wrapper.rb'
|
147
|
+
require 'com/zoho/crm/api/inventory_templates/api_exception.rb'
|
148
|
+
require 'com/zoho/crm/api/inventory_templates/response_handler.rb'
|
111
149
|
require 'com/zoho/crm/api/blue_print/body_wrapper.rb'
|
112
150
|
require 'com/zoho/crm/api/blue_print/next_transition.rb'
|
113
151
|
require 'com/zoho/crm/api/blue_print/blue_print_operations.rb'
|
114
152
|
require 'com/zoho/crm/api/blue_print/process_info.rb'
|
115
153
|
require 'com/zoho/crm/api/blue_print/blue_print.rb'
|
154
|
+
require 'com/zoho/crm/api/blue_print/escalation.rb'
|
116
155
|
require 'com/zoho/crm/api/blue_print/transition.rb'
|
117
156
|
require 'com/zoho/crm/api/blue_print/response_wrapper.rb'
|
118
157
|
require 'com/zoho/crm/api/blue_print/api_exception.rb'
|
119
158
|
require 'com/zoho/crm/api/blue_print/validation_error.rb'
|
159
|
+
require 'com/zoho/crm/api/blue_print/field.rb'
|
120
160
|
require 'com/zoho/crm/api/blue_print/success_response.rb'
|
121
161
|
require 'com/zoho/crm/api/blue_print/action_response.rb'
|
122
162
|
require 'com/zoho/crm/api/blue_print/response_handler.rb'
|
163
|
+
require 'com/zoho/crm/api/email_templates/email_template.rb'
|
164
|
+
require 'com/zoho/crm/api/email_templates/attachment.rb'
|
165
|
+
require 'com/zoho/crm/api/email_templates/response_wrapper.rb'
|
166
|
+
require 'com/zoho/crm/api/email_templates/email_templates_operations.rb'
|
167
|
+
require 'com/zoho/crm/api/email_templates/api_exception.rb'
|
168
|
+
require 'com/zoho/crm/api/email_templates/response_handler.rb'
|
123
169
|
require 'com/zoho/crm/api/related_records/body_wrapper.rb'
|
124
170
|
require 'com/zoho/crm/api/related_records/action_handler.rb'
|
125
171
|
require 'com/zoho/crm/api/related_records/related_records_operations.rb'
|
@@ -157,8 +203,8 @@ require 'com/zoho/crm/api/tags/action_response.rb'
|
|
157
203
|
require 'com/zoho/crm/api/tags/merge_wrapper.rb'
|
158
204
|
require 'com/zoho/crm/api/tags/response_handler.rb'
|
159
205
|
require 'com/zoho/crm/api/header_map.rb'
|
206
|
+
require 'com/zoho/crm/api/custom_views/shared_to.rb'
|
160
207
|
require 'com/zoho/crm/api/custom_views/info.rb'
|
161
|
-
require 'com/zoho/crm/api/custom_views/shared_details.rb'
|
162
208
|
require 'com/zoho/crm/api/custom_views/translation.rb'
|
163
209
|
require 'com/zoho/crm/api/custom_views/custom_view.rb'
|
164
210
|
require 'com/zoho/crm/api/custom_views/range.rb'
|
@@ -259,6 +305,12 @@ require 'com/zoho/crm/api/dc/au_datacenter.rb'
|
|
259
305
|
require 'com/zoho/crm/api/dc/cn_datacenter.rb'
|
260
306
|
require 'com/zoho/crm/api/dc/us_datacenter.rb'
|
261
307
|
require 'com/zoho/crm/api/dc/datacenter.rb'
|
308
|
+
require 'com/zoho/crm/api/assignment_rules/assignment_rules_operations.rb'
|
309
|
+
require 'com/zoho/crm/api/assignment_rules/assignment_rule.rb'
|
310
|
+
require 'com/zoho/crm/api/assignment_rules/response_wrapper.rb'
|
311
|
+
require 'com/zoho/crm/api/assignment_rules/api_exception.rb'
|
312
|
+
require 'com/zoho/crm/api/assignment_rules/default_user.rb'
|
313
|
+
require 'com/zoho/crm/api/assignment_rules/response_handler.rb'
|
262
314
|
require 'com/zoho/crm/api/files/file_operations.rb'
|
263
315
|
require 'com/zoho/crm/api/files/body_wrapper.rb'
|
264
316
|
require 'com/zoho/crm/api/files/action_handler.rb'
|
@@ -285,10 +337,13 @@ require 'com/zoho/crm/api/bulk_write/response_handler.rb'
|
|
285
337
|
require 'com/zoho/crm/api/fields/private.rb'
|
286
338
|
require 'com/zoho/crm/api/fields/association_details.rb'
|
287
339
|
require 'com/zoho/crm/api/fields/module.rb'
|
340
|
+
require 'com/zoho/crm/api/fields/external.rb'
|
288
341
|
require 'com/zoho/crm/api/fields/currency.rb'
|
342
|
+
require 'com/zoho/crm/api/fields/multi_module_lookup.rb'
|
289
343
|
require 'com/zoho/crm/api/fields/pick_list_value.rb'
|
290
344
|
require 'com/zoho/crm/api/fields/view_type.rb'
|
291
345
|
require 'com/zoho/crm/api/fields/lookup_field.rb'
|
346
|
+
require 'com/zoho/crm/api/fields/multi_user_lookup.rb'
|
292
347
|
require 'com/zoho/crm/api/fields/multi_select_lookup.rb'
|
293
348
|
require 'com/zoho/crm/api/fields/auto_number.rb'
|
294
349
|
require 'com/zoho/crm/api/fields/unique.rb'
|
@@ -301,9 +356,12 @@ require 'com/zoho/crm/api/fields/field.rb'
|
|
301
356
|
require 'com/zoho/crm/api/fields/crypt.rb'
|
302
357
|
require 'com/zoho/crm/api/fields/tool_tip.rb'
|
303
358
|
require 'com/zoho/crm/api/fields/response_handler.rb'
|
359
|
+
require 'com/zoho/crm/api/fields/history_tracking.rb'
|
360
|
+
require 'com/zoho/crm/api/fields/maps.rb'
|
304
361
|
require 'com/zoho/crm/api/parameter_map.rb'
|
305
362
|
require 'com/zoho/crm/api/profiles/category.rb'
|
306
363
|
require 'com/zoho/crm/api/profiles/permission_detail.rb'
|
364
|
+
require 'com/zoho/crm/api/profiles/default_view.rb'
|
307
365
|
require 'com/zoho/crm/api/profiles/section.rb'
|
308
366
|
require 'com/zoho/crm/api/profiles/profile.rb'
|
309
367
|
require 'com/zoho/crm/api/profiles/response_wrapper.rb'
|
@@ -324,6 +382,33 @@ require 'com/zoho/crm/api/share_records/api_exception.rb'
|
|
324
382
|
require 'com/zoho/crm/api/share_records/success_response.rb'
|
325
383
|
require 'com/zoho/crm/api/share_records/action_response.rb'
|
326
384
|
require 'com/zoho/crm/api/share_records/response_handler.rb'
|
385
|
+
require 'com/zoho/crm/api/send_mail/body_wrapper.rb'
|
386
|
+
require 'com/zoho/crm/api/send_mail/action_handler.rb'
|
387
|
+
require 'com/zoho/crm/api/send_mail/user_address.rb'
|
388
|
+
require 'com/zoho/crm/api/send_mail/inventory_details.rb'
|
389
|
+
require 'com/zoho/crm/api/send_mail/template.rb'
|
390
|
+
require 'com/zoho/crm/api/send_mail/action_wrapper.rb'
|
391
|
+
require 'com/zoho/crm/api/send_mail/data_subject_request.rb'
|
392
|
+
require 'com/zoho/crm/api/send_mail/send_mail_operations.rb'
|
393
|
+
require 'com/zoho/crm/api/send_mail/response_wrapper.rb'
|
394
|
+
require 'com/zoho/crm/api/send_mail/api_exception.rb'
|
395
|
+
require 'com/zoho/crm/api/send_mail/success_response.rb'
|
396
|
+
require 'com/zoho/crm/api/send_mail/mail.rb'
|
397
|
+
require 'com/zoho/crm/api/send_mail/action_response.rb'
|
398
|
+
require 'com/zoho/crm/api/send_mail/response_handler.rb'
|
399
|
+
require 'com/zoho/crm/api/wizards/node.rb'
|
400
|
+
require 'com/zoho/crm/api/wizards/segment.rb'
|
401
|
+
require 'com/zoho/crm/api/wizards/chart_data.rb'
|
402
|
+
require 'com/zoho/crm/api/wizards/wizard.rb'
|
403
|
+
require 'com/zoho/crm/api/wizards/connection.rb'
|
404
|
+
require 'com/zoho/crm/api/wizards/container.rb'
|
405
|
+
require 'com/zoho/crm/api/wizards/button.rb'
|
406
|
+
require 'com/zoho/crm/api/wizards/wizards_operations.rb'
|
407
|
+
require 'com/zoho/crm/api/wizards/transition.rb'
|
408
|
+
require 'com/zoho/crm/api/wizards/response_wrapper.rb'
|
409
|
+
require 'com/zoho/crm/api/wizards/api_exception.rb'
|
410
|
+
require 'com/zoho/crm/api/wizards/screen.rb'
|
411
|
+
require 'com/zoho/crm/api/wizards/response_handler.rb'
|
327
412
|
require 'com/zoho/crm/api/query/body_wrapper.rb'
|
328
413
|
require 'com/zoho/crm/api/query/response_wrapper.rb'
|
329
414
|
require 'com/zoho/crm/api/query/query_operations.rb'
|
@@ -11,19 +11,19 @@ require_relative '../../crm/api/exception/sdk_exception'
|
|
11
11
|
module Authenticator
|
12
12
|
# This class gets and refreshes the tokens based on the expiry time.
|
13
13
|
class OAuthToken < Token
|
14
|
+
attr_accessor :client_id , :client_secret ,:redirect_url ,:grant_token,:refresh_token, :access_token ,:user_mail ,:id ,:expires_in
|
14
15
|
@@sync_lock = Monitor.new
|
15
16
|
|
16
|
-
attr_accessor :client_id, :client_secret, :redirect_url, :grant_token, :refresh_token, :access_token, :expires_in, :user_mail, :id
|
17
|
-
|
18
17
|
# Creates an OAuthToken class instance with the specified parameters.
|
19
18
|
# @param client_id [string] A String containing the OAuth client id.
|
20
19
|
# @param client_secret [string] A String containing the OAuth client secret.
|
20
|
+
# @param grant_token [string] A String containing the grant token.
|
21
|
+
# @param refresh_token [string] A String containing the refresh token.
|
21
22
|
# @param redirect_url [string] A String containing the OAuth redirect URL.
|
22
|
-
# @param
|
23
|
-
|
24
|
-
def initialize(client_id
|
25
|
-
error =
|
26
|
-
|
23
|
+
# @param id [string] A String containing ID
|
24
|
+
|
25
|
+
def initialize(client_id:, client_secret:, grant_token: nil, refresh_token: nil, redirect_url: nil,id: nil)
|
26
|
+
error ={}
|
27
27
|
unless client_id.is_a?(String)
|
28
28
|
error[Constants::ERROR_HASH_FIELD] = Constants::CLIENT_ID
|
29
29
|
|
@@ -35,7 +35,7 @@ module Authenticator
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
-
unless client_secret.
|
38
|
+
unless client_secret.is_a?(String)
|
39
39
|
error[Constants::ERROR_HASH_FIELD] = Constants::CLIENT_SECRET
|
40
40
|
|
41
41
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = String
|
@@ -46,8 +46,30 @@ module Authenticator
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
error[Constants::ERROR_HASH_FIELD] = Constants::
|
49
|
+
if !grant_token.nil? && !grant_token.is_a?(String)
|
50
|
+
error[Constants::ERROR_HASH_FIELD] = Constants::GRANT_TOKEN
|
51
|
+
|
52
|
+
error[Constants::ERROR_HASH_EXPECTED_TYPE] = String
|
53
|
+
|
54
|
+
error[Constants::ERROR_HASH_CLASS] = OAuthToken.class
|
55
|
+
|
56
|
+
raise SDKException.new(Constants::INPUT_ERROR, nil, error, nil)
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
if !refresh_token.nil? && !refresh_token.is_a?(String)
|
61
|
+
error[Constants::ERROR_HASH_FIELD] = Constants::REFRESH_TOKEN
|
62
|
+
|
63
|
+
error[Constants::ERROR_HASH_EXPECTED_TYPE] = String
|
64
|
+
|
65
|
+
error[Constants::ERROR_HASH_CLASS] = OAuthToken.class
|
66
|
+
|
67
|
+
raise SDKException.new(Constants::INPUT_ERROR, nil, error, nil)
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
if !redirect_url.nil? && !redirect_url.is_a?(String)
|
72
|
+
error[Constants::ERROR_HASH_FIELD] = Constants::REDIRECT_URL
|
51
73
|
|
52
74
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = String
|
53
75
|
|
@@ -57,7 +79,18 @@ module Authenticator
|
|
57
79
|
|
58
80
|
end
|
59
81
|
|
60
|
-
|
82
|
+
if !id.nil? && !id.is_a?(String)
|
83
|
+
error[Constants::ERROR_HASH_FIELD] = Constants::ID
|
84
|
+
|
85
|
+
error[Constants::ERROR_HASH_EXPECTED_TYPE] = String
|
86
|
+
|
87
|
+
error[Constants::ERROR_HASH_CLASS] = OAuthToken.class
|
88
|
+
|
89
|
+
raise SDKException.new(Constants::INPUT_ERROR, nil, error, nil)
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
if grant_token.nil? && refresh_token.nil?
|
61
94
|
error[Constants::ERROR_HASH_FIELD] = Constants::TYPE
|
62
95
|
|
63
96
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = Constants::EXPECTED_TOKEN_TYPES
|
@@ -66,28 +99,39 @@ module Authenticator
|
|
66
99
|
|
67
100
|
raise SDKException.new(Constants::INPUT_ERROR, nil, error, nil)
|
68
101
|
end
|
69
|
-
|
70
102
|
@client_id = client_id
|
71
103
|
|
72
104
|
@client_secret = client_secret
|
73
105
|
|
74
106
|
@redirect_url = redirect_url
|
75
107
|
|
76
|
-
@refresh_token =
|
108
|
+
@refresh_token = refresh_token
|
77
109
|
|
78
|
-
@grant_token =
|
79
|
-
|
110
|
+
@grant_token = grant_token
|
111
|
+
|
112
|
+
@access_token = nil
|
113
|
+
|
114
|
+
@expires_in = nil
|
80
115
|
|
116
|
+
@user_mail = nil
|
117
|
+
|
118
|
+
@id = id
|
119
|
+
end
|
120
|
+
|
81
121
|
def authenticate(url_connection)
|
82
122
|
@@sync_lock.synchronize do
|
83
123
|
initializer = Initializer.get_initializer
|
84
124
|
store = initializer.store
|
85
|
-
|
86
125
|
user = initializer.user
|
87
126
|
|
88
|
-
oauth_token =
|
127
|
+
oauth_token = nil
|
128
|
+
if !@id.nil?
|
129
|
+
oauth_token = initializer.store.get_token_by_id(@id, self)
|
130
|
+
else
|
131
|
+
oauth_token = initializer.store.get_token(user, self)
|
132
|
+
end
|
89
133
|
|
90
|
-
token =
|
134
|
+
token = ""
|
91
135
|
|
92
136
|
if oauth_token.nil?
|
93
137
|
token = @refresh_token.nil? ? generate_access_token(user, store).access_token : refresh_access_token(user, store).access_token
|
@@ -115,8 +159,8 @@ module Authenticator
|
|
115
159
|
json_body[Constants::CLIENT_ID] = @client_id
|
116
160
|
|
117
161
|
json_body[Constants::CLIENT_SECRET] = @client_secret
|
118
|
-
|
119
|
-
json_body[Constants::REDIRECT_URI] = @redirect_url
|
162
|
+
|
163
|
+
json_body[Constants::REDIRECT_URI] = @redirect_url if !@redirect_url.nil?
|
120
164
|
|
121
165
|
json_body[Constants::GRANT_TYPE] = Constants::GRANT_TYPE_AUTH_CODE
|
122
166
|
|
@@ -125,7 +169,11 @@ module Authenticator
|
|
125
169
|
response = get_response_from_server(json_body)
|
126
170
|
|
127
171
|
begin
|
128
|
-
|
172
|
+
parse_response(response)
|
173
|
+
|
174
|
+
generate_id()
|
175
|
+
|
176
|
+
store.save_token(user,self)
|
129
177
|
rescue SDKException => e
|
130
178
|
raise e
|
131
179
|
rescue StandardError => e
|
@@ -141,7 +189,7 @@ module Authenticator
|
|
141
189
|
|
142
190
|
json_body[Constants::CLIENT_SECRET] = @client_secret
|
143
191
|
|
144
|
-
json_body[Constants::REDIRECT_URI] = @redirect_url
|
192
|
+
json_body[Constants::REDIRECT_URI] = @redirect_url if !@redirect_url.nil?
|
145
193
|
|
146
194
|
json_body[Constants::GRANT_TYPE] = Constants::REFRESH_TOKEN
|
147
195
|
|
@@ -150,7 +198,11 @@ module Authenticator
|
|
150
198
|
response = get_response_from_server(json_body)
|
151
199
|
|
152
200
|
begin
|
153
|
-
|
201
|
+
parse_response(response)
|
202
|
+
|
203
|
+
generate_id()
|
204
|
+
|
205
|
+
store.save_token(user,self)
|
154
206
|
rescue SDKException => e
|
155
207
|
raise e
|
156
208
|
rescue StandardError => e
|
@@ -184,7 +236,7 @@ module Authenticator
|
|
184
236
|
http.use_ssl = true
|
185
237
|
|
186
238
|
request = Net::HTTP::Post.new(url.request_uri)
|
187
|
-
|
239
|
+
request.add_field(Constants::USER_AGENT_KEY, Constants::USER_AGENT)
|
188
240
|
request.set_form(json_body, Constants::APPLICATION_FORM_URLENCODED)
|
189
241
|
|
190
242
|
response = http.request(request)
|
@@ -207,11 +259,14 @@ module Authenticator
|
|
207
259
|
def get_current_time_in_millis
|
208
260
|
(Time.now.to_f * 1000).to_i
|
209
261
|
end
|
210
|
-
end
|
211
|
-
end
|
212
262
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
263
|
+
def generate_id
|
264
|
+
id = ""
|
265
|
+
email = Initializer.get_initializer.user.email
|
266
|
+
environment = Initializer.get_initializer.environment.name
|
267
|
+
id = id + "ruby_" +email[0..email.index(Constants::AT) - 1] + Constants::UNDERSCORE
|
268
|
+
id = id + environment + Constants::UNDERSCORE + @refresh_token[@refresh_token.length-4..@refresh_token.length-1]
|
269
|
+
@id = id
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
@@ -6,24 +6,22 @@ require_relative '../../../crm/api/util/constants'
|
|
6
6
|
module Store
|
7
7
|
# This class stores the user token details to the MySQL DataBase.
|
8
8
|
class DBStore < TokenStore
|
9
|
-
|
9
|
+
attr_reader :user_name, :password, :port_number, :host, :database_name, :table_name
|
10
10
|
|
11
11
|
# Creates an DBStore class instance with the specified parameters.
|
12
12
|
# @param host [string] A String containing the DataBase host name.
|
13
13
|
# @param database_name A String containing the DataBase name.
|
14
|
+
# @param table_name A String containing the table name.
|
14
15
|
# @param user_name A String containing the DataBase user name.
|
15
16
|
# @param password A String containing the DataBase password.
|
16
17
|
# @param port_number A String containing the DataBase port number.
|
17
|
-
def initialize(host
|
18
|
-
@host = host
|
19
|
-
|
20
|
-
@
|
21
|
-
|
22
|
-
@
|
23
|
-
|
24
|
-
@password = password.nil? ? '' : password
|
25
|
-
|
26
|
-
@port_number = port_number.nil? ? Constants::MYSQL_PORT_NUMBER : port_number
|
18
|
+
def initialize(host: Constants::MYSQL_HOST, database_name: Constants::MYSQL_DATABASE_NAME ,table_name: Constants::MYSQL_TABLE_NAME,user_name: Constants::MYSQL_USER_NAME,password: '',port_number: Constants::MYSQL_PORT_NUMBER )
|
19
|
+
@host = host
|
20
|
+
@database_name = database_name
|
21
|
+
@table_name = table_name
|
22
|
+
@user_name = user_name
|
23
|
+
@password = password
|
24
|
+
@port_number = port_number
|
27
25
|
end
|
28
26
|
|
29
27
|
def get_token(user, token)
|
@@ -38,12 +36,24 @@ module Store
|
|
38
36
|
rs.each do |row|
|
39
37
|
oauthtoken = token
|
40
38
|
|
41
|
-
oauthtoken.
|
39
|
+
oauthtoken.client_id = row[Constants::CLIENT_ID]
|
42
40
|
|
43
|
-
oauthtoken.
|
41
|
+
oauthtoken.client_secret = row[Constants::CLIENT_SECRET]
|
42
|
+
|
43
|
+
oauthtoken.grant_token = row[Constants::GRANT_TOKEN]
|
44
|
+
|
45
|
+
oauthtoken.redirect_url = row[Constants::REDIRECT_URL]
|
44
46
|
|
45
47
|
oauthtoken.refresh_token = row[Constants::REFRESH_TOKEN]
|
46
48
|
|
49
|
+
oauthtoken.id = row[Constants::ID]
|
50
|
+
|
51
|
+
oauthtoken.user_mail = row[Constants::USER_MAIL]
|
52
|
+
|
53
|
+
oauthtoken.access_token = row[Constants::ACCESS_TOKEN]
|
54
|
+
|
55
|
+
oauthtoken.expires_in = row[Constants::EXPIRY_TIME]
|
56
|
+
|
47
57
|
return oauthtoken
|
48
58
|
end
|
49
59
|
nil
|
@@ -54,7 +64,7 @@ module Store
|
|
54
64
|
def save_token(user, token)
|
55
65
|
con = Mysql2::Client.new(host: @host, username: @user_name, password: @password, database: @database_name, port: @port_number)
|
56
66
|
if token.is_a? Authenticator::OAuthToken
|
57
|
-
query = "insert into
|
67
|
+
query = "insert into #{token.table_name}(id,user_mail,client_id,client_secret,refresh_token,access_token,grant_token,expiry_time,redirect_url) values ('#{token.id}','#{user.email}','#{token.client_id}','#{token.client_secret}','#{token.refresh_token}','#{token.access_token}','#{token.grant_token}','#{token.expires_in}','#{token.redirect_url}')"
|
58
68
|
token.user_mail = user.email
|
59
69
|
delete_token(token)
|
60
70
|
con.query(query)
|
@@ -81,7 +91,7 @@ module Store
|
|
81
91
|
def delete_tokens
|
82
92
|
con = Mysql2::Client.new(host: @host, username: @user_name, password: @password, database: @database_name, port: @port_number)
|
83
93
|
|
84
|
-
query =
|
94
|
+
query = "delete * from #{@table_name}"
|
85
95
|
|
86
96
|
con.query(query)
|
87
97
|
|
@@ -94,24 +104,16 @@ module Store
|
|
94
104
|
tokens = []
|
95
105
|
con = Mysql2::Client.new(host: @host, username: @user_name, password: @password, database: @database_name, port: @port_number)
|
96
106
|
|
97
|
-
query =
|
107
|
+
query = "select * from #{@table_name}"
|
98
108
|
|
99
109
|
rs = con.query(query)
|
100
110
|
|
101
111
|
con.close
|
102
112
|
|
103
113
|
rs.each do |row|
|
104
|
-
token_type = nil
|
105
|
-
token_value = nil
|
106
|
-
if !row[Constants::GRANT_TOKEN].nil? && row[Constants::GRANT_TOKEN].length.positive?
|
107
|
-
token_type = TokenType::GRANT
|
108
|
-
token_value = row[Constants::GRANT_TOKEN]
|
109
|
-
else
|
110
|
-
token_type = TokenType::REFRESH
|
111
|
-
token_value = row[Constants::REFRESH_TOKEN]
|
112
|
-
end
|
113
114
|
|
114
|
-
|
115
|
+
|
116
|
+
oauthtoken = Authenticator::OAuthToken.new(client_id: row[Constants::CLIENT_ID],client_secret: row[Constants::CLIENT_SECRET],grant_token: grant_token,refresh_token: row[Constants::REFRESH_TOKEN])
|
115
117
|
|
116
118
|
oauthtoken.id = row[Constants::ID]
|
117
119
|
|
@@ -119,9 +121,9 @@ module Store
|
|
119
121
|
|
120
122
|
oauthtoken.access_token = row[Constants::ACCESS_TOKEN]
|
121
123
|
|
122
|
-
oauthtoken.
|
124
|
+
oauthtoken.redirect_url = row[Constants::REDIRECT_URL]
|
123
125
|
|
124
|
-
oauthtoken.
|
126
|
+
oauthtoken.expires_in = row[Constants::EXPIRY_TIME]
|
125
127
|
|
126
128
|
tokens.push(oauthtoken)
|
127
129
|
end
|
@@ -135,7 +137,7 @@ module Store
|
|
135
137
|
|
136
138
|
query = is_delete ? 'delete from ' : 'select * from '
|
137
139
|
|
138
|
-
query +=
|
140
|
+
query += "#{@table_name} where user_mail='#{email}' and client_id='#{token.client_id}' and "
|
139
141
|
|
140
142
|
query += if token.grant_token.nil?
|
141
143
|
"refresh_token='#{token.refresh_token}'"
|
@@ -145,5 +147,45 @@ module Store
|
|
145
147
|
|
146
148
|
query
|
147
149
|
end
|
150
|
+
def get_token_by_id(id,token)
|
151
|
+
con = Mysql2::Client.new(host: @host, username: @user_name, password: @password, database: @database_name, port: @port_number)
|
152
|
+
|
153
|
+
if token.is_a? Authenticator::OAuthToken
|
154
|
+
query = "select * from #{@table_name} where id='#{id}'"
|
155
|
+
|
156
|
+
rs = con.query(query)
|
157
|
+
|
158
|
+
con.close
|
159
|
+
|
160
|
+
rs.each do |row|
|
161
|
+
if id == row[Constants::ID]
|
162
|
+
oauthtoken = token
|
163
|
+
|
164
|
+
oauthtoken.client_id = row[Constants::CLIENT_ID]
|
165
|
+
|
166
|
+
oauthtoken.client_secret = row[Constants::CLIENT_SECRET]
|
167
|
+
|
168
|
+
oauthtoken.grant_token = row[Constants::GRANT_TOKEN]
|
169
|
+
|
170
|
+
oauthtoken.redirect_url = row[Constants::REDIRECT_URL]
|
171
|
+
|
172
|
+
oauthtoken.refresh_token = row[Constants::REFRESH_TOKEN]
|
173
|
+
|
174
|
+
oauthtoken.id = row[Constants::ID]
|
175
|
+
|
176
|
+
oauthtoken.user_mail = row[Constants::USER_MAIL]
|
177
|
+
|
178
|
+
oauthtoken.access_token = row[Constants::ACCESS_TOKEN]
|
179
|
+
|
180
|
+
oauthtoken.expires_in = row[Constants::EXPIRY_TIME]
|
181
|
+
|
182
|
+
return oauthtoken
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
nil
|
187
|
+
rescue Mysql2::Error => e
|
188
|
+
raise SDKException.new(Constants::TOKEN_STORE, Constants::GET_TOKEN_BY_ID_DB_ERROR, nil, e)
|
189
|
+
end
|
148
190
|
end
|
149
191
|
end
|