ZCRMSDK 1.0.1 → 2.0.0
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 +362 -0
- data/src/com/zoho/api/authenticator/oauth_token.rb +217 -0
- data/src/com/zoho/api/authenticator/store/db_store.rb +149 -0
- data/src/com/zoho/api/authenticator/store/file_store.rb +165 -0
- data/src/com/zoho/api/authenticator/store/token_store.rb +26 -0
- data/src/com/zoho/api/authenticator/token.rb +10 -0
- data/src/com/zoho/api/logger/sdk_logger.rb +69 -0
- data/src/com/zoho/crm/api/attachments/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/attachments/action_response.rb +10 -0
- data/src/com/zoho/crm/api/attachments/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/attachments/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/attachments/attachment.rb +367 -0
- data/src/com/zoho/crm/api/attachments/attachments_operations.rb +196 -0
- data/src/com/zoho/crm/api/attachments/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/attachments/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/attachments/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/attachments/success_response.rb +121 -0
- data/src/com/zoho/crm/api/blue_print/action_response.rb +10 -0
- data/src/com/zoho/crm/api/blue_print/api_exception.rb +123 -0
- data/src/com/zoho/crm/api/blue_print/blue_print.rb +119 -0
- data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +67 -0
- data/src/com/zoho/crm/api/blue_print/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/blue_print/next_transition.rb +80 -0
- data/src/com/zoho/crm/api/blue_print/process_info.rb +251 -0
- data/src/com/zoho/crm/api/blue_print/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/blue_print/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/blue_print/success_response.rb +121 -0
- data/src/com/zoho/crm/api/blue_print/transition.rb +253 -0
- data/src/com/zoho/crm/api/blue_print/validation_error.rb +80 -0
- data/src/com/zoho/crm/api/bulk_read/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/bulk_read/action_response.rb +10 -0
- data/src/com/zoho/crm/api/bulk_read/action_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/bulk_read/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +74 -0
- data/src/com/zoho/crm/api/bulk_read/call_back.rb +81 -0
- data/src/com/zoho/crm/api/bulk_read/criteria.rb +135 -0
- data/src/com/zoho/crm/api/bulk_read/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/bulk_read/job_detail.rb +196 -0
- data/src/com/zoho/crm/api/bulk_read/query.rb +137 -0
- data/src/com/zoho/crm/api/bulk_read/request_wrapper.rb +100 -0
- data/src/com/zoho/crm/api/bulk_read/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/bulk_read/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/bulk_read/result.rb +137 -0
- data/src/com/zoho/crm/api/bulk_read/success_response.rb +121 -0
- data/src/com/zoho/crm/api/bulk_write/action_response.rb +10 -0
- data/src/com/zoho/crm/api/bulk_write/api_exception.rb +239 -0
- data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +112 -0
- data/src/com/zoho/crm/api/bulk_write/bulk_write_response.rb +216 -0
- data/src/com/zoho/crm/api/bulk_write/call_back.rb +81 -0
- data/src/com/zoho/crm/api/bulk_write/field_mapping.rb +156 -0
- data/src/com/zoho/crm/api/bulk_write/file.rb +157 -0
- data/src/com/zoho/crm/api/bulk_write/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/bulk_write/request_wrapper.rb +119 -0
- data/src/com/zoho/crm/api/bulk_write/resource.rb +195 -0
- data/src/com/zoho/crm/api/bulk_write/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/bulk_write/response_wrapper.rb +10 -0
- data/src/com/zoho/crm/api/bulk_write/result.rb +61 -0
- data/src/com/zoho/crm/api/bulk_write/success_response.rb +121 -0
- data/src/com/zoho/crm/api/contact_roles/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/contact_roles/action_response.rb +10 -0
- data/src/com/zoho/crm/api/contact_roles/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/contact_roles/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/contact_roles/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/contact_roles/contact_role.rb +99 -0
- data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +161 -0
- data/src/com/zoho/crm/api/contact_roles/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/contact_roles/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/contact_roles/success_response.rb +121 -0
- data/src/com/zoho/crm/api/currencies/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/currencies/action_response.rb +10 -0
- data/src/com/zoho/crm/api/currencies/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/currencies/api_exception.rb +127 -0
- data/src/com/zoho/crm/api/currencies/base_currency_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/currencies/base_currency_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/currencies/base_currency_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/currencies/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/currencies/currencies_operations.rb +156 -0
- data/src/com/zoho/crm/api/currencies/currency.rb +290 -0
- data/src/com/zoho/crm/api/currencies/format.rb +100 -0
- data/src/com/zoho/crm/api/currencies/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/currencies/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/currencies/success_response.rb +121 -0
- data/src/com/zoho/crm/api/custom_views/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/custom_views/criteria.rb +135 -0
- data/src/com/zoho/crm/api/custom_views/custom_view.rb +327 -0
- data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +75 -0
- data/src/com/zoho/crm/api/custom_views/info.rb +156 -0
- data/src/com/zoho/crm/api/custom_views/range.rb +80 -0
- data/src/com/zoho/crm/api/custom_views/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/custom_views/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/custom_views/shared_details.rb +118 -0
- data/src/com/zoho/crm/api/custom_views/translation.rb +118 -0
- data/src/com/zoho/crm/api/dc/au_datacenter.rb +18 -0
- data/src/com/zoho/crm/api/dc/cn_datacenter.rb +18 -0
- data/src/com/zoho/crm/api/dc/datacenter.rb +20 -0
- data/src/com/zoho/crm/api/dc/eu_datacenter.rb +18 -0
- data/src/com/zoho/crm/api/dc/in_datacenter.rb +18 -0
- data/src/com/zoho/crm/api/dc/us_datacenter.rb +18 -0
- data/src/com/zoho/crm/api/exception/sdk_exception.rb +47 -0
- data/src/com/zoho/crm/api/fields/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/fields/association_details.rb +80 -0
- data/src/com/zoho/crm/api/fields/auto_number.rb +99 -0
- data/src/com/zoho/crm/api/fields/crypt.rb +156 -0
- data/src/com/zoho/crm/api/fields/currency.rb +80 -0
- data/src/com/zoho/crm/api/fields/field.rb +956 -0
- data/src/com/zoho/crm/api/fields/fields_operations.rb +71 -0
- data/src/com/zoho/crm/api/fields/formula.rb +80 -0
- data/src/com/zoho/crm/api/fields/lookup_field.rb +80 -0
- data/src/com/zoho/crm/api/fields/module.rb +157 -0
- data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +156 -0
- data/src/com/zoho/crm/api/fields/pick_list_value.rb +175 -0
- data/src/com/zoho/crm/api/fields/private.rb +99 -0
- data/src/com/zoho/crm/api/fields/related_details.rb +137 -0
- data/src/com/zoho/crm/api/fields/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/fields/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/fields/tool_tip.rb +80 -0
- data/src/com/zoho/crm/api/fields/unique.rb +61 -0
- data/src/com/zoho/crm/api/fields/view_type.rb +118 -0
- data/src/com/zoho/crm/api/files/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/files/action_response.rb +10 -0
- data/src/com/zoho/crm/api/files/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/files/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/files/body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/files/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/files/file_operations.rb +75 -0
- data/src/com/zoho/crm/api/files/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/files/success_response.rb +121 -0
- data/src/com/zoho/crm/api/header.rb +10 -0
- data/src/com/zoho/crm/api/header_map.rb +55 -0
- data/src/com/zoho/crm/api/initializer.rb +192 -0
- data/src/com/zoho/crm/api/layouts/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/layouts/layout.rb +272 -0
- data/src/com/zoho/crm/api/layouts/layouts_operations.rb +61 -0
- data/src/com/zoho/crm/api/layouts/properties.rb +100 -0
- data/src/com/zoho/crm/api/layouts/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/layouts/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/layouts/section.rb +233 -0
- data/src/com/zoho/crm/api/modules/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/modules/action_response.rb +10 -0
- data/src/com/zoho/crm/api/modules/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/modules/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/modules/argument.rb +80 -0
- data/src/com/zoho/crm/api/modules/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/modules/module.rb +882 -0
- data/src/com/zoho/crm/api/modules/modules_operations.rb +111 -0
- data/src/com/zoho/crm/api/modules/related_list_properties.rb +99 -0
- data/src/com/zoho/crm/api/modules/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/modules/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/modules/success_response.rb +121 -0
- data/src/com/zoho/crm/api/modules/territory.rb +99 -0
- data/src/com/zoho/crm/api/notes/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/notes/action_response.rb +10 -0
- data/src/com/zoho/crm/api/notes/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/notes/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/notes/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/notes/info.rb +118 -0
- data/src/com/zoho/crm/api/notes/note.rb +349 -0
- data/src/com/zoho/crm/api/notes/notes_operations.rb +219 -0
- data/src/com/zoho/crm/api/notes/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/notes/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/notes/success_response.rb +121 -0
- data/src/com/zoho/crm/api/notification/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/notification/action_response.rb +10 -0
- data/src/com/zoho/crm/api/notification/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/notification/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/notification/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/notification/info.rb +118 -0
- data/src/com/zoho/crm/api/notification/notification.rb +251 -0
- data/src/com/zoho/crm/api/notification/notification_operations.rb +164 -0
- data/src/com/zoho/crm/api/notification/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/notification/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/notification/success_response.rb +121 -0
- data/src/com/zoho/crm/api/org/action_response.rb +10 -0
- data/src/com/zoho/crm/api/org/api_exception.rb +123 -0
- data/src/com/zoho/crm/api/org/file_body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/org/license_details.rb +156 -0
- data/src/com/zoho/crm/api/org/org.rb +631 -0
- data/src/com/zoho/crm/api/org/org_operations.rb +49 -0
- data/src/com/zoho/crm/api/org/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/org/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/org/success_response.rb +121 -0
- data/src/com/zoho/crm/api/param.rb +10 -0
- data/src/com/zoho/crm/api/parameter_map.rb +54 -0
- data/src/com/zoho/crm/api/profiles/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/profiles/category.rb +99 -0
- data/src/com/zoho/crm/api/profiles/permission_detail.rb +137 -0
- data/src/com/zoho/crm/api/profiles/profile.rb +290 -0
- data/src/com/zoho/crm/api/profiles/profiles_operations.rb +61 -0
- data/src/com/zoho/crm/api/profiles/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/profiles/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/profiles/section.rb +80 -0
- data/src/com/zoho/crm/api/query/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/query/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/query/query_operations.rb +35 -0
- data/src/com/zoho/crm/api/query/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/query/response_wrapper.rb +84 -0
- data/src/com/zoho/crm/api/record/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/action_response.rb +10 -0
- data/src/com/zoho/crm/api/record/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/api_exception.rb +143 -0
- data/src/com/zoho/crm/api/record/body_wrapper.rb +156 -0
- data/src/com/zoho/crm/api/record/carry_over_tags.rb +99 -0
- data/src/com/zoho/crm/api/record/comment.rb +118 -0
- data/src/com/zoho/crm/api/record/consent.rb +185 -0
- data/src/com/zoho/crm/api/record/convert_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/convert_action_response.rb +10 -0
- data/src/com/zoho/crm/api/record/convert_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/convert_body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/record/criteria.rb +135 -0
- data/src/com/zoho/crm/api/record/deleted_record.rb +157 -0
- data/src/com/zoho/crm/api/record/deleted_records_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/deleted_records_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/record/download_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/field.rb +2109 -0
- data/src/com/zoho/crm/api/record/file_body_wrapper.rb +66 -0
- data/src/com/zoho/crm/api/record/file_details.rb +327 -0
- data/src/com/zoho/crm/api/record/file_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/info.rb +118 -0
- data/src/com/zoho/crm/api/record/inventory_line_items.rb +235 -0
- data/src/com/zoho/crm/api/record/lead_converter.rb +194 -0
- data/src/com/zoho/crm/api/record/line_item_product.rb +65 -0
- data/src/com/zoho/crm/api/record/line_tax.rb +118 -0
- data/src/com/zoho/crm/api/record/mass_update.rb +140 -0
- data/src/com/zoho/crm/api/record/mass_update_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/mass_update_action_response.rb +10 -0
- data/src/com/zoho/crm/api/record/mass_update_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +156 -0
- data/src/com/zoho/crm/api/record/mass_update_response.rb +10 -0
- data/src/com/zoho/crm/api/record/mass_update_response_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/mass_update_response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/mass_update_success_response.rb +121 -0
- data/src/com/zoho/crm/api/record/options.rb +10 -0
- data/src/com/zoho/crm/api/record/participants.rb +116 -0
- data/src/com/zoho/crm/api/record/pricing_details.rb +65 -0
- data/src/com/zoho/crm/api/record/record.rb +192 -0
- data/src/com/zoho/crm/api/record/record_operations.rb +677 -0
- data/src/com/zoho/crm/api/record/recurring_activity.rb +61 -0
- data/src/com/zoho/crm/api/record/remind_at.rb +61 -0
- data/src/com/zoho/crm/api/record/reminder.rb +80 -0
- data/src/com/zoho/crm/api/record/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/record/success_response.rb +161 -0
- data/src/com/zoho/crm/api/record/successful_convert.rb +101 -0
- data/src/com/zoho/crm/api/record/territory.rb +80 -0
- data/src/com/zoho/crm/api/related_lists/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/related_lists/related_list.rb +251 -0
- data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +61 -0
- data/src/com/zoho/crm/api/related_lists/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/related_lists/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/related_records/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/related_records/action_response.rb +10 -0
- data/src/com/zoho/crm/api/related_records/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/related_records/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/related_records/body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/related_records/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/related_records/related_records_operations.rb +235 -0
- data/src/com/zoho/crm/api/related_records/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/related_records/response_wrapper.rb +84 -0
- data/src/com/zoho/crm/api/related_records/success_response.rb +121 -0
- data/src/com/zoho/crm/api/request_proxy.rb +16 -0
- data/src/com/zoho/crm/api/roles/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/roles/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/roles/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/roles/role.rb +195 -0
- data/src/com/zoho/crm/api/roles/roles_operations.rb +47 -0
- data/src/com/zoho/crm/api/sdk_config.rb +78 -0
- data/src/com/zoho/crm/api/share_records/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/share_records/action_response.rb +10 -0
- data/src/com/zoho/crm/api/share_records/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/share_records/api_exception.rb +129 -0
- data/src/com/zoho/crm/api/share_records/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/share_records/delete_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/share_records/delete_action_response.rb +10 -0
- data/src/com/zoho/crm/api/share_records/delete_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/share_records/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/share_records/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/share_records/share_record.rb +157 -0
- data/src/com/zoho/crm/api/share_records/share_records_operations.rb +128 -0
- data/src/com/zoho/crm/api/share_records/shared_through.rb +100 -0
- data/src/com/zoho/crm/api/share_records/success_response.rb +123 -0
- data/src/com/zoho/crm/api/tags/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/tags/action_response.rb +10 -0
- data/src/com/zoho/crm/api/tags/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/tags/api_exception.rb +131 -0
- data/src/com/zoho/crm/api/tags/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/tags/conflict_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/tags/count_handler.rb +10 -0
- data/src/com/zoho/crm/api/tags/count_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/tags/info.rb +80 -0
- data/src/com/zoho/crm/api/tags/merge_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/tags/record_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/tags/record_action_response.rb +10 -0
- data/src/com/zoho/crm/api/tags/record_action_wrapper.rb +120 -0
- data/src/com/zoho/crm/api/tags/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/tags/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/tags/success_response.rb +123 -0
- data/src/com/zoho/crm/api/tags/tag.rb +157 -0
- data/src/com/zoho/crm/api/tags/tags_operations.rb +387 -0
- data/src/com/zoho/crm/api/taxes/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/taxes/action_response.rb +10 -0
- data/src/com/zoho/crm/api/taxes/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/taxes/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/taxes/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/taxes/preference.rb +80 -0
- data/src/com/zoho/crm/api/taxes/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/taxes/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/taxes/success_response.rb +121 -0
- data/src/com/zoho/crm/api/taxes/tax.rb +137 -0
- data/src/com/zoho/crm/api/taxes/taxes_operations.rb +136 -0
- data/src/com/zoho/crm/api/territories/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/territories/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/territories/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/territories/territories_operations.rb +47 -0
- data/src/com/zoho/crm/api/territories/territory.rb +234 -0
- data/src/com/zoho/crm/api/user_signature.rb +27 -0
- data/src/com/zoho/crm/api/users/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/users/action_response.rb +10 -0
- data/src/com/zoho/crm/api/users/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/users/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/users/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/users/customize_info.rb +156 -0
- data/src/com/zoho/crm/api/users/info.rb +118 -0
- data/src/com/zoho/crm/api/users/request_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/users/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/users/response_wrapper.rb +82 -0
- data/src/com/zoho/crm/api/users/shift.rb +80 -0
- data/src/com/zoho/crm/api/users/success_response.rb +121 -0
- data/src/com/zoho/crm/api/users/tab_theme.rb +80 -0
- data/src/com/zoho/crm/api/users/territory.rb +99 -0
- data/src/com/zoho/crm/api/users/theme.rb +156 -0
- data/src/com/zoho/crm/api/users/user.rb +696 -0
- data/src/com/zoho/crm/api/users/users_operations.rb +181 -0
- data/src/com/zoho/crm/api/util/api_http_connector.rb +111 -0
- data/src/com/zoho/crm/api/util/api_response.rb +16 -0
- data/src/com/zoho/crm/api/util/choice.rb +9 -0
- data/src/com/zoho/crm/api/util/common_api_handler.rb +235 -0
- data/src/com/zoho/crm/api/util/constants.rb +536 -0
- data/src/com/zoho/crm/api/util/converter.rb +213 -0
- data/src/com/zoho/crm/api/util/data_type_converter.rb +162 -0
- data/src/com/zoho/crm/api/util/downloader.rb +83 -0
- data/src/com/zoho/crm/api/util/form_data_converter.rb +167 -0
- data/src/com/zoho/crm/api/util/header_param_validator.rb +55 -0
- data/src/com/zoho/crm/api/util/json_converter.rb +726 -0
- data/src/com/zoho/crm/api/util/model.rb +5 -0
- data/src/com/zoho/crm/api/util/module_fields_handler.rb +78 -0
- data/src/com/zoho/crm/api/util/stream_wrapper.rb +37 -0
- data/src/com/zoho/crm/api/util/utility.rb +727 -0
- data/src/com/zoho/crm/api/variable_groups/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/variable_groups/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/variable_groups/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/variable_groups/variable_group.rb +137 -0
- data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +66 -0
- data/src/com/zoho/crm/api/variables/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/variables/action_response.rb +10 -0
- data/src/com/zoho/crm/api/variables/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/variables/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/variables/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/variables/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/variables/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/variables/success_response.rb +121 -0
- data/src/com/zoho/crm/api/variables/variable.rb +173 -0
- data/src/com/zoho/crm/api/variables/variables_operations.rb +241 -0
- data/src/resources/JSONDetails.json +1 -0
- data/src/version.rb +3 -0
- metadata +395 -45
- data/lib/ZCRMSDK.rb +0 -14
- data/lib/ZCRMSDK/handler.rb +0 -3290
- data/lib/ZCRMSDK/oauth_client.rb +0 -253
- data/lib/ZCRMSDK/oauth_utility.rb +0 -161
- data/lib/ZCRMSDK/operations.rb +0 -1091
- data/lib/ZCRMSDK/org.rb +0 -174
- data/lib/ZCRMSDK/persistence.rb +0 -127
- data/lib/ZCRMSDK/request.rb +0 -83
- data/lib/ZCRMSDK/response.rb +0 -216
- data/lib/ZCRMSDK/restclient.rb +0 -65
- data/lib/ZCRMSDK/test.rb +0 -5748
- data/lib/ZCRMSDK/utility.rb +0 -309
- data/lib/ZCRMSDK/version.rb +0 -5
data/lib/ZCRMSDK.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ZCRMSDK/oauth_utility'
|
4
|
-
require 'ZCRMSDK/operations'
|
5
|
-
require 'ZCRMSDK/handler'
|
6
|
-
require 'ZCRMSDK/oauth_client'
|
7
|
-
require 'ZCRMSDK/operations'
|
8
|
-
require 'ZCRMSDK/org'
|
9
|
-
require 'ZCRMSDK/persistence'
|
10
|
-
require 'ZCRMSDK/request'
|
11
|
-
require 'ZCRMSDK/response'
|
12
|
-
require 'ZCRMSDK/utility'
|
13
|
-
require 'ZCRMSDK/restclient'
|
14
|
-
require 'ZCRMSDK/version'
|
data/lib/ZCRMSDK/handler.rb
DELETED
@@ -1,3290 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'utility'
|
4
|
-
require_relative 'operations'
|
5
|
-
require_relative 'request'
|
6
|
-
require_relative 'org'
|
7
|
-
require 'json'
|
8
|
-
module ZCRMSDK
|
9
|
-
module Handler
|
10
|
-
# THIS CLASS SERVES AS A PARENT CLASS TO OTHER HANDLER CLASSES
|
11
|
-
class APIHandler
|
12
|
-
attr_accessor :request_url_path, :request_body, :request_headers, :request_params, :request_method, :request_api_key
|
13
|
-
def initialize
|
14
|
-
@request_url_path = nil
|
15
|
-
@request_body = nil
|
16
|
-
@request_headers = nil
|
17
|
-
@request_params = nil
|
18
|
-
@request_method = nil
|
19
|
-
@request_api_key = nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.get_instance
|
23
|
-
APIHandler.new
|
24
|
-
end
|
25
|
-
|
26
|
-
def add_param(key, value)
|
27
|
-
@request_params = {} if @request_params.nil?
|
28
|
-
@request_params.store(key, value)
|
29
|
-
end
|
30
|
-
|
31
|
-
def add_header(key, value)
|
32
|
-
@request_headers = {} if @request_headers.nil?
|
33
|
-
@request_headers.store(key, value)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
# THIS CLASS IS USED TO HANDLE SINGLE ENTITY RELATED FUNCTIONALITY
|
37
|
-
class EntityAPIHandler < APIHandler
|
38
|
-
def initialize(zcrm_record)
|
39
|
-
@zcrmrecord = zcrm_record
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.get_instance(zcrm_record)
|
43
|
-
EntityAPIHandler.new(zcrm_record)
|
44
|
-
end
|
45
|
-
|
46
|
-
def get_record
|
47
|
-
if @zcrmrecord.entity_id.nil?
|
48
|
-
raise Utility::ZCRMException.get_instance('get_record', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record', 'ID IS NOT PROVIDED')
|
49
|
-
end
|
50
|
-
|
51
|
-
handler_ins = APIHandler.get_instance
|
52
|
-
handler_ins.request_url_path = ''
|
53
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s
|
54
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
55
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
56
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
57
|
-
obj = EntityAPIHandlerHelper.get_instance
|
58
|
-
obj.set_record_properties(@zcrmrecord, api_response.response_json.dig(Utility::APIConstants::DATA, 0))
|
59
|
-
api_response.data = @zcrmrecord
|
60
|
-
api_response
|
61
|
-
end
|
62
|
-
|
63
|
-
def create_record
|
64
|
-
unless @zcrmrecord.entity_id.nil?
|
65
|
-
raise Utility::ZCRMException.get_instance('create_record', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should not be set for the record', 'ID PROVIDED')
|
66
|
-
end
|
67
|
-
|
68
|
-
handler_ins = APIHandler.get_instance
|
69
|
-
handler_ins.request_url_path = ''
|
70
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name
|
71
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
72
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
73
|
-
helper_obj = EntityAPIHandlerHelper.get_instance
|
74
|
-
input_json = helper_obj.get_zcrmrecord_as_json(@zcrmrecord)
|
75
|
-
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(input_json, Utility::APIConstants::DATA)
|
76
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
77
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
78
|
-
@zcrmrecord.entity_id = response_details['id']
|
79
|
-
@zcrmrecord.created_time = response_details['Created_Time']
|
80
|
-
created_by = response_details['Created_By']
|
81
|
-
@zcrmrecord.created_by = Operations::ZCRMUser.get_instance(created_by['id'], created_by['name'])
|
82
|
-
api_response.data = @zcrmrecord
|
83
|
-
api_response
|
84
|
-
end
|
85
|
-
|
86
|
-
def update_record
|
87
|
-
if @zcrmrecord.entity_id.nil?
|
88
|
-
raise Utility::ZCRMException.get_instance('update_record', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record', 'ID IS NOT PROVIDED')
|
89
|
-
end
|
90
|
-
|
91
|
-
handler_ins = APIHandler.get_instance
|
92
|
-
handler_ins.request_url_path = ''
|
93
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s
|
94
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
95
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
96
|
-
helper_obj = EntityAPIHandlerHelper.get_instance
|
97
|
-
input_json = helper_obj.get_zcrmrecord_as_json(@zcrmrecord)
|
98
|
-
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(input_json, Utility::APIConstants::DATA)
|
99
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
100
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
101
|
-
@zcrmrecord.entity_id = response_details['id']
|
102
|
-
@zcrmrecord.created_time = response_details['Created_Time']
|
103
|
-
@zcrmrecord.modified_time = response_details['Modified_Time']
|
104
|
-
created_by = response_details['Created_By']
|
105
|
-
@zcrmrecord.created_by = Operations::ZCRMUser.get_instance(created_by['id'], created_by['name'])
|
106
|
-
modified_by = response_details['Modified_By']
|
107
|
-
@zcrmrecord.modified_by = Operations::ZCRMUser.get_instance(modified_by['id'], modified_by['name'])
|
108
|
-
api_response.data = @zcrmrecord
|
109
|
-
api_response
|
110
|
-
end
|
111
|
-
|
112
|
-
def delete_record
|
113
|
-
if @zcrmrecord.entity_id.nil?
|
114
|
-
raise Utility::ZCRMException.get_instance('delete_record', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record', 'ID IS NOT PROVIDED')
|
115
|
-
end
|
116
|
-
|
117
|
-
handler_ins = APIHandler.get_instance
|
118
|
-
handler_ins.request_url_path = ''
|
119
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s
|
120
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
121
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
122
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
123
|
-
api_response
|
124
|
-
end
|
125
|
-
|
126
|
-
def convert_record(potential_record, details)
|
127
|
-
if @zcrmrecord.entity_id.nil?
|
128
|
-
raise Utility::ZCRMException.get_instance('convert_record', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record', 'ID IS NOT PROVIDED')
|
129
|
-
end
|
130
|
-
|
131
|
-
handler_ins = APIHandler.get_instance
|
132
|
-
handler_ins.request_url_path = ''
|
133
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s + '/actions/convert'
|
134
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
135
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
136
|
-
input_json = {}
|
137
|
-
unless details.nil?
|
138
|
-
details.each do |key, value|
|
139
|
-
input_json[key] = value
|
140
|
-
end
|
141
|
-
end
|
142
|
-
unless potential_record.nil?
|
143
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
144
|
-
input_json['Deals'] = entity_helper.get_zcrmrecord_as_json(potential_record)
|
145
|
-
end
|
146
|
-
unless details.nil? && potential_record.nil?
|
147
|
-
input_json_arr = []
|
148
|
-
input_json_arr.push(input_json)
|
149
|
-
req_body_json = {}
|
150
|
-
req_body_json.store(Utility::APIConstants::DATA, input_json_arr)
|
151
|
-
handler_ins.request_body = req_body_json
|
152
|
-
end
|
153
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
154
|
-
converted_dict = {}
|
155
|
-
converted_ids_json = api_response.response_json.dig(Utility::APIConstants::DATA, 0)
|
156
|
-
if converted_ids_json.key?(Utility::APIConstants::CONTACTS) && !converted_ids_json.dig(Utility::APIConstants::CONTACTS).nil?
|
157
|
-
converted_dict.store(Utility::APIConstants::CONTACTS, converted_ids_json.dig(Utility::APIConstants::CONTACTS))
|
158
|
-
end
|
159
|
-
if converted_ids_json.key?(Utility::APIConstants::ACCOUNTS) && !converted_ids_json.dig(Utility::APIConstants::ACCOUNTS).nil?
|
160
|
-
converted_dict.store(Utility::APIConstants::ACCOUNTS, converted_ids_json.dig(Utility::APIConstants::ACCOUNTS))
|
161
|
-
end
|
162
|
-
if converted_ids_json.key?(Utility::APIConstants::DEALS) && !converted_ids_json.dig(Utility::APIConstants::DEALS).nil?
|
163
|
-
converted_dict.store(Utility::APIConstants::DEALS, converted_ids_json.dig(Utility::APIConstants::DEALS))
|
164
|
-
end
|
165
|
-
converted_dict
|
166
|
-
end
|
167
|
-
|
168
|
-
def upload_photo(file_path)
|
169
|
-
if file_path.nil?
|
170
|
-
raise Utility::ZCRMException.get_instance('upload_photo', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'file path must be given', 'FILEPATH NOT PROVIDED')
|
171
|
-
end
|
172
|
-
if @zcrmrecord.entity_id.nil?
|
173
|
-
raise Utility::ZCRMException.get_instance('upload_photo', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record for uploading', 'ID IS NOT PROVIDED')
|
174
|
-
end
|
175
|
-
|
176
|
-
handler_ins = APIHandler.get_instance
|
177
|
-
handler_ins.request_url_path = ''
|
178
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s + '/photo'
|
179
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
180
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
181
|
-
api_response = Request::APIRequest.get_instance(handler_ins).upload_file(file_path)
|
182
|
-
api_response
|
183
|
-
end
|
184
|
-
|
185
|
-
def download_photo
|
186
|
-
if @zcrmrecord.entity_id.nil?
|
187
|
-
raise Utility::ZCRMException.get_instance('download_photo', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record for uploading', 'ID IS NOT PROVIDED')
|
188
|
-
end
|
189
|
-
|
190
|
-
handler_ins = APIHandler.get_instance
|
191
|
-
handler_ins.request_url_path = ''
|
192
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s + '/photo'
|
193
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
194
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
195
|
-
Request::APIRequest.get_instance(handler_ins).download_file
|
196
|
-
end
|
197
|
-
|
198
|
-
def delete_photo
|
199
|
-
if @zcrmrecord.entity_id.nil?
|
200
|
-
raise Utility::ZCRMException.get_instance('delete_photo', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the record for uploading', 'ID IS NOT PROVIDED')
|
201
|
-
end
|
202
|
-
|
203
|
-
handler_ins = APIHandler.get_instance
|
204
|
-
handler_ins.request_url_path = ''
|
205
|
-
handler_ins.request_url_path = @zcrmrecord.module_api_name + '/' + @zcrmrecord.entity_id.to_s + '/photo'
|
206
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
207
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
208
|
-
Request::APIRequest.get_instance(handler_ins).get_api_response
|
209
|
-
end
|
210
|
-
end
|
211
|
-
# THIS CLASS IS USED TO HANDLE MASS ENTITY RELATED FUNCTIONALITY
|
212
|
-
class MassEntityAPIHandler < APIHandler
|
213
|
-
def initialize(module_ins)
|
214
|
-
@module_instance = module_ins
|
215
|
-
end
|
216
|
-
|
217
|
-
def self.get_instance(module_ins)
|
218
|
-
MassEntityAPIHandler.new(module_ins)
|
219
|
-
end
|
220
|
-
|
221
|
-
def get_records(cvid, sort_by, sort_order, page, per_page, headers)
|
222
|
-
handler_ins = APIHandler.get_instance
|
223
|
-
handler_ins.request_url_path = ''
|
224
|
-
handler_ins.request_url_path += @module_instance.api_name
|
225
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
226
|
-
handler_ins.add_param('cvid', cvid) unless cvid.nil?
|
227
|
-
handler_ins.add_param('sort_by', sort_by) unless sort_by.nil?
|
228
|
-
handler_ins.add_param('sort_order', sort_order) unless sort_order.nil?
|
229
|
-
unless headers.nil?
|
230
|
-
headers.each do |key, value|
|
231
|
-
handler_ins.add_header(key, value)
|
232
|
-
end
|
233
|
-
end
|
234
|
-
handler_ins.add_param('page', page)
|
235
|
-
handler_ins.add_param('per_page', per_page)
|
236
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
237
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
238
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
239
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
240
|
-
record_ins_list = []
|
241
|
-
unless data_arr.nil?
|
242
|
-
data_arr.each do |record_data|
|
243
|
-
zcrm_record = Operations::ZCRMRecord.get_instance(@module_instance.api_name, record_data['id'])
|
244
|
-
entity_helper.set_record_properties(zcrm_record, record_data)
|
245
|
-
record_ins_list.push(zcrm_record)
|
246
|
-
end
|
247
|
-
end
|
248
|
-
bulk_api_response.data = record_ins_list
|
249
|
-
bulk_api_response
|
250
|
-
end
|
251
|
-
|
252
|
-
def create_records(record_ins_array, lar_id)
|
253
|
-
if record_ins_array.length > 100
|
254
|
-
raise Utility::ZCRMException.get_instance('create_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
255
|
-
end
|
256
|
-
|
257
|
-
if record_ins_array.length < 1
|
258
|
-
raise Utility::ZCRMException.get_instance('create_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be at least 1', 'NO RECORDS PROVIDED')
|
259
|
-
end
|
260
|
-
|
261
|
-
handler_ins = APIHandler.get_instance
|
262
|
-
handler_ins.request_url_path = ''
|
263
|
-
handler_ins.request_url_path += @module_instance.api_name
|
264
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
265
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
266
|
-
helper_obj = EntityAPIHandlerHelper.get_instance
|
267
|
-
data_array = []
|
268
|
-
record_ins_array.each do |zcrm_record|
|
269
|
-
if zcrm_record.entity_id.nil?
|
270
|
-
data_array.push(helper_obj.get_zcrmrecord_as_json(zcrm_record))
|
271
|
-
else
|
272
|
-
raise Utility::ZCRMException.get_instance('Records_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'record id must be nil', 'ID IS PROVIDED')
|
273
|
-
end
|
274
|
-
end
|
275
|
-
request_json = {}
|
276
|
-
request_json[Utility::APIConstants::DATA] = data_array
|
277
|
-
request_json['lar_id'] = lar_id unless lar_id.nil?
|
278
|
-
handler_ins.request_body = request_json
|
279
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
280
|
-
created_records = []
|
281
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
282
|
-
length = entity_responses.length
|
283
|
-
length -= 1
|
284
|
-
(0..length).each do |i|
|
285
|
-
entity_response_ins = entity_responses[i]
|
286
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
287
|
-
|
288
|
-
record_create_details = entity_response_ins.details
|
289
|
-
new_record = record_ins_array[i]
|
290
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
291
|
-
entity_helper.set_record_properties(new_record, record_create_details)
|
292
|
-
created_records.push(new_record)
|
293
|
-
entity_response_ins.data = new_record
|
294
|
-
end
|
295
|
-
bulk_api_response.data = created_records
|
296
|
-
bulk_api_response
|
297
|
-
end
|
298
|
-
|
299
|
-
def upsert_records(record_ins_array, duplicate_check_fields, lar_id)
|
300
|
-
if record_ins_array.length > 100
|
301
|
-
raise Utility::ZCRMException.get_instance('upsert_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
302
|
-
end
|
303
|
-
|
304
|
-
if record_ins_array.length < 1
|
305
|
-
raise Utility::ZCRMException.get_instance('upsert_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be at least 1', 'NO RECORDS PROVIDED')
|
306
|
-
end
|
307
|
-
|
308
|
-
handler_ins = APIHandler.get_instance
|
309
|
-
handler_ins.request_url_path = ''
|
310
|
-
handler_ins.request_url_path = @module_instance.api_name + '/upsert'
|
311
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
312
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
313
|
-
helper_obj = EntityAPIHandlerHelper.get_instance
|
314
|
-
data_array = []
|
315
|
-
record_ins_array.each do |zcrm_record|
|
316
|
-
input_json = helper_obj.get_zcrmrecord_as_json(zcrm_record)
|
317
|
-
unless zcrm_record.entity_id.nil?
|
318
|
-
input_json['id'] = zcrm_record.entity_id.to_s
|
319
|
-
end
|
320
|
-
data_array.push(input_json)
|
321
|
-
end
|
322
|
-
request_json['lar_id'] = lar_id unless lar_id.nil?
|
323
|
-
unless duplicate_check_fields.nil?
|
324
|
-
ids_as_string = ''
|
325
|
-
duplicate_check_fields.each do |duplicate_check_field|
|
326
|
-
ids_as_string += duplicate_check_field.to_s + ','
|
327
|
-
end
|
328
|
-
handler_ins.add_param('duplicate_check_fields', ids_as_string)
|
329
|
-
end
|
330
|
-
|
331
|
-
request_json = {}
|
332
|
-
request_json[Utility::APIConstants::DATA] = data_array
|
333
|
-
handler_ins.request_body = request_json
|
334
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
335
|
-
upsert_records = []
|
336
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
337
|
-
length = entity_responses.length
|
338
|
-
length -= 1
|
339
|
-
(0..length).each do |i|
|
340
|
-
entity_response_ins = entity_responses[i]
|
341
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
342
|
-
|
343
|
-
record_upsert_details = entity_response_ins.details
|
344
|
-
new_record = record_ins_array[i]
|
345
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
346
|
-
entity_helper.set_record_properties(new_record, record_upsert_details)
|
347
|
-
upsert_records.push(new_record)
|
348
|
-
entity_response_ins.data = new_record
|
349
|
-
end
|
350
|
-
bulk_api_response.data = upsert_records
|
351
|
-
bulk_api_response
|
352
|
-
end
|
353
|
-
|
354
|
-
def update_records(record_ins_array)
|
355
|
-
if record_ins_array.length > 100
|
356
|
-
raise Utility::ZCRMException.get_instance('update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
357
|
-
end
|
358
|
-
|
359
|
-
if record_ins_array.length < 1
|
360
|
-
raise Utility::ZCRMException.get_instance('update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be at least 1', 'NO RECORDS PROVIDED')
|
361
|
-
end
|
362
|
-
|
363
|
-
handler_ins = APIHandler.get_instance
|
364
|
-
handler_ins.request_url_path = ''
|
365
|
-
handler_ins.request_url_path += @module_instance.api_name
|
366
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
367
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
368
|
-
helper_obj = EntityAPIHandlerHelper.get_instance
|
369
|
-
data_array = []
|
370
|
-
record_ins_array.each do |zcrm_record|
|
371
|
-
input_json = helper_obj.get_zcrmrecord_as_json(zcrm_record)
|
372
|
-
if !zcrm_record.entity_id.nil?
|
373
|
-
input_json['id'] = zcrm_record.entity_id.to_s
|
374
|
-
else
|
375
|
-
raise Utility::ZCRMException.get_instance('Records_Update', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'record id must not be nil', 'RECORD ID NOT PROVIDED')
|
376
|
-
end
|
377
|
-
data_array.push(input_json)
|
378
|
-
end
|
379
|
-
request_json = {}
|
380
|
-
request_json[Utility::APIConstants::DATA] = data_array
|
381
|
-
handler_ins.request_body = request_json
|
382
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
383
|
-
updated_records = []
|
384
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
385
|
-
length = entity_responses.length
|
386
|
-
length -= 1
|
387
|
-
(0..length).each do |i|
|
388
|
-
entity_response_ins = entity_responses[i]
|
389
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
390
|
-
|
391
|
-
record_update_details = entity_response_ins.details
|
392
|
-
new_record = record_ins_array[i]
|
393
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
394
|
-
entity_helper.set_record_properties(new_record, record_update_details)
|
395
|
-
updated_records.push(new_record)
|
396
|
-
entity_response_ins.data = new_record
|
397
|
-
end
|
398
|
-
bulk_api_response.data = updated_records
|
399
|
-
bulk_api_response
|
400
|
-
end
|
401
|
-
|
402
|
-
def mass_update_records(entityid_list, field_api_name, value)
|
403
|
-
if entityid_list.length > 100
|
404
|
-
raise Utility::ZCRMException.get_instance('mass_update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
405
|
-
end
|
406
|
-
|
407
|
-
if entityid_list.length < 1
|
408
|
-
raise Utility::ZCRMException.get_instance('mass_update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be at least 1', 'NO RECORDS PROVIDED')
|
409
|
-
end
|
410
|
-
|
411
|
-
if field_api_name.nil?
|
412
|
-
raise Utility::ZCRMException.get_instance('mass_update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'field api name must be provided', 'NO FIELD APINAME PROVIDED')
|
413
|
-
end
|
414
|
-
|
415
|
-
if value.nil?
|
416
|
-
raise Utility::ZCRMException.get_instance('mass_update_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'value must be provided', 'NO VALUE PROVIDED')
|
417
|
-
end
|
418
|
-
|
419
|
-
handler_ins = APIHandler.get_instance
|
420
|
-
handler_ins.request_url_path = ''
|
421
|
-
handler_ins.request_url_path += @module_instance.api_name
|
422
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
423
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
424
|
-
massentity_helper = MassEntityAPIHandlerHelper.get_instance
|
425
|
-
handler_ins.request_body = massentity_helper.construct_json_for_massupdate(entityid_list, field_api_name, value)
|
426
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
427
|
-
updated_records = []
|
428
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
429
|
-
length = entity_responses.length - 1
|
430
|
-
(0..length).each do |i|
|
431
|
-
entity_response_ins = entity_responses[i]
|
432
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
433
|
-
|
434
|
-
record_update_details = entity_response_ins.details
|
435
|
-
new_record = Operations::ZCRMRecord.get_instance(@module_instance.api_name, record_update_details['id'])
|
436
|
-
updated_records.push(new_record)
|
437
|
-
entity_response_ins.data = new_record
|
438
|
-
end
|
439
|
-
bulk_api_response.data = updated_records
|
440
|
-
bulk_api_response
|
441
|
-
end
|
442
|
-
|
443
|
-
def delete_records(entityid_list)
|
444
|
-
if entityid_list.length > 100
|
445
|
-
raise Utility::ZCRMException.get_instance('delete_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
446
|
-
end
|
447
|
-
|
448
|
-
if entityid_list.length < 1
|
449
|
-
raise Utility::ZCRMException.get_instance('delete_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be at least 1', 'NO RECORDS PROVIDED')
|
450
|
-
end
|
451
|
-
|
452
|
-
handler_ins = APIHandler.get_instance
|
453
|
-
handler_ins.request_url_path = ''
|
454
|
-
handler_ins.request_url_path += @module_instance.api_name
|
455
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
456
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
457
|
-
ids_as_string = ''
|
458
|
-
entityid_list.each do |entity_id|
|
459
|
-
ids_as_string += entity_id.to_s + ','
|
460
|
-
end
|
461
|
-
handler_ins.add_param('ids', ids_as_string)
|
462
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
463
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
464
|
-
length = entity_responses.length - 1
|
465
|
-
(0..length).each do |i|
|
466
|
-
entity_response_ins = entity_responses[i]
|
467
|
-
record_delete_details = entity_response_ins.details
|
468
|
-
entity_response_ins.data = Operations::ZCRMRecord.get_instance(@module_instance.api_name, record_delete_details['id'])
|
469
|
-
end
|
470
|
-
bulk_api_response
|
471
|
-
end
|
472
|
-
|
473
|
-
def search_records(search_word, page, per_page, type)
|
474
|
-
if search_word.nil?
|
475
|
-
raise Utility::ZCRMException.get_instance('search_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'search word must be given', 'SEARCH WORD NOT PROVIDED')
|
476
|
-
end
|
477
|
-
|
478
|
-
handler_ins = APIHandler.get_instance
|
479
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
480
|
-
handler_ins.request_url_path = @module_instance.api_name + '/search'
|
481
|
-
case type
|
482
|
-
when 'word'
|
483
|
-
handler_ins.add_param('word', search_word)
|
484
|
-
when 'phone'
|
485
|
-
handler_ins.add_param('phone', search_word)
|
486
|
-
when 'email'
|
487
|
-
handler_ins.add_param('email', search_word)
|
488
|
-
when 'criteria'
|
489
|
-
handler_ins.add_param('criteria', search_word)
|
490
|
-
end
|
491
|
-
handler_ins.add_param('page', page)
|
492
|
-
handler_ins.add_param('per_page', per_page)
|
493
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
494
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
495
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
496
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
497
|
-
record_ins_list = []
|
498
|
-
data_arr.each do |record_data|
|
499
|
-
zcrm_record = Operations::ZCRMRecord.get_instance(@module_instance.api_name, record_data['id'])
|
500
|
-
entity_helper.set_record_properties(zcrm_record, record_data)
|
501
|
-
record_ins_list.push(zcrm_record)
|
502
|
-
end
|
503
|
-
bulk_api_response.data = record_ins_list
|
504
|
-
bulk_api_response
|
505
|
-
end
|
506
|
-
|
507
|
-
def get_deleted_records(trashed_type, page, per_page)
|
508
|
-
handler_ins = APIHandler.get_instance
|
509
|
-
handler_ins.request_url_path = ''
|
510
|
-
handler_ins.request_url_path = @module_instance.api_name + '/deleted'
|
511
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
512
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
513
|
-
handler_ins.add_param('page', page)
|
514
|
-
handler_ins.add_param('per_page', per_page)
|
515
|
-
handler_ins.add_param('type', trashed_type) unless trashed_type.nil?
|
516
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
517
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
518
|
-
record_ins_list = []
|
519
|
-
massentity_helper = MassEntityAPIHandlerHelper.get_instance
|
520
|
-
data_arr.each do |record_data|
|
521
|
-
trash_record = Operations::ZCRMTrashRecord.get_instance(@module_instance.api_name, record_data['type'], record_data['id'])
|
522
|
-
massentity_helper.set_trash_record_properties(trash_record, record_data)
|
523
|
-
record_ins_list.push(trash_record)
|
524
|
-
end
|
525
|
-
bulk_api_response.data = record_ins_list
|
526
|
-
bulk_api_response
|
527
|
-
end
|
528
|
-
end
|
529
|
-
# THIS CLASS IS USED TO HANDLE MODULE RELATED FUNCTIONALITY
|
530
|
-
class ModuleAPIHandler < APIHandler
|
531
|
-
def initialize(module_instance)
|
532
|
-
@module_instance = module_instance
|
533
|
-
end
|
534
|
-
|
535
|
-
def self.get_instance(module_ins)
|
536
|
-
ModuleAPIHandler.new(module_ins)
|
537
|
-
end
|
538
|
-
|
539
|
-
def get_field(field_id)
|
540
|
-
if field_id.nil?
|
541
|
-
raise Utility::ZCRMException.get_instance('get_field', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'field id must be given', 'FIELD ID IS NOT PROVIDED')
|
542
|
-
end
|
543
|
-
|
544
|
-
handler_ins = APIHandler.get_instance
|
545
|
-
handler_ins.request_url_path = 'settings/fields/' + field_id.to_s
|
546
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
547
|
-
handler_ins.request_api_key = Utility::APIConstants::FIELDS
|
548
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
549
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
550
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
551
|
-
api_response.data = module_api_helper.get_zcrmfield(api_response.response_json[Utility::APIConstants::FIELDS][0])
|
552
|
-
api_response
|
553
|
-
end
|
554
|
-
|
555
|
-
def get_all_fields
|
556
|
-
handler_ins = APIHandler.get_instance
|
557
|
-
handler_ins.request_url_path = 'settings/fields'
|
558
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
559
|
-
handler_ins.request_api_key = Utility::APIConstants::FIELDS
|
560
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
561
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
562
|
-
fields = bulk_api_response.response_json[Utility::APIConstants::FIELDS]
|
563
|
-
field_instance_arr = []
|
564
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
565
|
-
fields.each do |field|
|
566
|
-
field_instance_arr.push(module_api_helper.get_zcrmfield(field))
|
567
|
-
end
|
568
|
-
bulk_api_response.data = field_instance_arr
|
569
|
-
bulk_api_response
|
570
|
-
end
|
571
|
-
|
572
|
-
def get_all_layouts
|
573
|
-
handler_ins = APIHandler.get_instance
|
574
|
-
handler_ins.request_url_path = 'settings/layouts'
|
575
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
576
|
-
handler_ins.request_api_key = Utility::APIConstants::LAYOUTS
|
577
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
578
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
579
|
-
layouts = bulk_api_response.response_json[Utility::APIConstants::LAYOUTS]
|
580
|
-
layout_instance_arr = []
|
581
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
582
|
-
layouts.each do |layout|
|
583
|
-
layout_instance_arr.push(module_api_helper.get_zcrmlayout(layout))
|
584
|
-
end
|
585
|
-
bulk_api_response.data = layout_instance_arr
|
586
|
-
bulk_api_response
|
587
|
-
end
|
588
|
-
|
589
|
-
def get_layout(layout_id)
|
590
|
-
if layout_id.nil?
|
591
|
-
raise Utility::ZCRMException.get_instance('get_layout', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'layout id must be given', 'LAYOUT ID IS NOT PROVIDED')
|
592
|
-
end
|
593
|
-
|
594
|
-
handler_ins = APIHandler.get_instance
|
595
|
-
handler_ins.request_url_path = 'settings/layouts/' + layout_id.to_s
|
596
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
597
|
-
handler_ins.request_api_key = Utility::APIConstants::LAYOUTS
|
598
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
599
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
600
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
601
|
-
api_response.data = module_api_helper.get_zcrmlayout(api_response.response_json[Utility::APIConstants::LAYOUTS][0])
|
602
|
-
api_response
|
603
|
-
end
|
604
|
-
|
605
|
-
def get_all_customviews
|
606
|
-
handler_ins = APIHandler.get_instance
|
607
|
-
handler_ins.request_url_path = 'settings/custom_views'
|
608
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
609
|
-
handler_ins.request_api_key = Utility::APIConstants::CUSTOM_VIEWS
|
610
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
611
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
612
|
-
response_json = bulk_api_response.response_json
|
613
|
-
categories = response_json['info'].key?('translation') ? response_json['info']['translation'] : nil
|
614
|
-
customviews = response_json[Utility::APIConstants::CUSTOM_VIEWS]
|
615
|
-
customview_instances = []
|
616
|
-
meta_data_api_helper = MetaDataAPIHandlerHelper.get_instance
|
617
|
-
customviews.each do |customview|
|
618
|
-
customview_instances.push(meta_data_api_helper.get_zcrm_customview(customview, @module_instance.api_name, categories))
|
619
|
-
end
|
620
|
-
bulk_api_response.data = customview_instances
|
621
|
-
bulk_api_response
|
622
|
-
end
|
623
|
-
|
624
|
-
def get_customview(customview_id)
|
625
|
-
if customview_id.nil?
|
626
|
-
raise Utility::ZCRMException.get_instance('get_customview', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'custom view id must be given', 'CUSTOM VIEW ID IS NOT PROVIDED')
|
627
|
-
end
|
628
|
-
|
629
|
-
handler_ins = APIHandler.get_instance
|
630
|
-
handler_ins.request_url_path = 'settings/custom_views/' + customview_id.to_s
|
631
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
632
|
-
handler_ins.request_api_key = Utility::APIConstants::CUSTOM_VIEWS
|
633
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
634
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
635
|
-
response_json = api_response.response_json
|
636
|
-
categories = response_json['info'].key?('translation') ? response_json['info']['translation'] : nil
|
637
|
-
meta_data_api_helper = MetaDataAPIHandlerHelper.get_instance
|
638
|
-
api_response.data = meta_data_api_helper.get_zcrm_customview(response_json[Utility::APIConstants::CUSTOM_VIEWS][0], @module_instance.api_name, categories)
|
639
|
-
api_response
|
640
|
-
end
|
641
|
-
|
642
|
-
def update_customview(customview_instance)
|
643
|
-
if customview_instance.nil?
|
644
|
-
raise Utility::ZCRMException.get_instance('update_customview', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'custom view instance must be given', 'NO CUSTOM VIEW INSTANCE PROVIDED')
|
645
|
-
end
|
646
|
-
|
647
|
-
handler_ins = APIHandler.get_instance
|
648
|
-
handler_ins.request_url_path = 'settings/custom_views/' + customview_instance.id.to_s
|
649
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
650
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
651
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
652
|
-
handler_ins.request_body = module_api_helper.construct_json_for_cv_update(customview_instance)
|
653
|
-
Request::APIRequest.get_instance(handler_ins).get_api_response
|
654
|
-
end
|
655
|
-
|
656
|
-
def get_all_relatedlists
|
657
|
-
handler_ins = APIHandler.get_instance
|
658
|
-
handler_ins.request_url_path = 'settings/related_lists'
|
659
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
660
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
661
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
662
|
-
response_json = bulk_api_response.response_json
|
663
|
-
related_lists = response_json[Utility::APIConstants::RELATED_LISTS]
|
664
|
-
relatedlist_instances = []
|
665
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
666
|
-
related_lists.each do |related_list|
|
667
|
-
relatedlist_instances.push(module_api_helper.get_zcrm_module_related_list(related_list))
|
668
|
-
end
|
669
|
-
bulk_api_response.data = relatedlist_instances
|
670
|
-
bulk_api_response
|
671
|
-
end
|
672
|
-
|
673
|
-
def get_relatedlist(relatedlist_id)
|
674
|
-
if relatedlist_id.nil?
|
675
|
-
raise Utility::ZCRMException.get_instance('get_relatedlist', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Related list id must be given', 'NO RELATED LIST ID PROVIDED')
|
676
|
-
end
|
677
|
-
|
678
|
-
handler_ins = APIHandler.get_instance
|
679
|
-
handler_ins.request_url_path = 'settings/related_lists/' + relatedlist_id.to_s
|
680
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
681
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
682
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
683
|
-
response_json = api_response.response_json
|
684
|
-
related_list = response_json[Utility::APIConstants::RELATED_LISTS][0]
|
685
|
-
module_api_helper = ModuleAPIHandlerHelper.get_instance
|
686
|
-
api_response.data = module_api_helper.get_zcrm_module_related_list(related_list)
|
687
|
-
api_response
|
688
|
-
end
|
689
|
-
end
|
690
|
-
# THIS CLASS SERVES THE MassEntityAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
691
|
-
class MassEntityAPIHandlerHelper
|
692
|
-
def initialize; end
|
693
|
-
|
694
|
-
def self.get_instance
|
695
|
-
MassEntityAPIHandlerHelper.new
|
696
|
-
end
|
697
|
-
|
698
|
-
def set_trash_record_properties(trash_record_ins, record_data)
|
699
|
-
if record_data.key?('display_name')
|
700
|
-
trash_record_ins.display_name = record_data['display_name']
|
701
|
-
end
|
702
|
-
if record_data.key?('created_by')
|
703
|
-
unless record_data['created_by'].nil?
|
704
|
-
trash_record_ins.created_by = Operations::ZCRMUser.get_instance(record_data['created_by']['id'], record_data['created_by']['name'])
|
705
|
-
end
|
706
|
-
end
|
707
|
-
if record_data.key?('deleted_by')
|
708
|
-
unless record_data['deleted_by'].nil?
|
709
|
-
trash_record_ins.deleted_by = Operations::ZCRMUser.get_instance(record_data['deleted_by']['id'], record_data['deleted_by']['name'])
|
710
|
-
end
|
711
|
-
end
|
712
|
-
trash_record_ins.deleted_time = record_data['deleted_time']
|
713
|
-
end
|
714
|
-
|
715
|
-
def construct_json_for_massupdate(entityid_list, field_api_name, field_value)
|
716
|
-
input_json_arr = []
|
717
|
-
entityid_list.each do |entity_id|
|
718
|
-
each_json = {}
|
719
|
-
each_json['id'] = entity_id.to_s
|
720
|
-
each_json[field_api_name] = field_value
|
721
|
-
input_json_arr.push(each_json)
|
722
|
-
end
|
723
|
-
data_json = {}
|
724
|
-
data_json[Utility::APIConstants::DATA] = input_json_arr
|
725
|
-
data_json
|
726
|
-
end
|
727
|
-
end
|
728
|
-
# THIS CLASS SERVES THE EntityAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
729
|
-
class EntityAPIHandlerHelper
|
730
|
-
def initialize; end
|
731
|
-
|
732
|
-
def self.get_instance
|
733
|
-
EntityAPIHandlerHelper.new
|
734
|
-
end
|
735
|
-
|
736
|
-
def get_zcrmrecord_as_json(zcrmrecord)
|
737
|
-
record_json = {}
|
738
|
-
apiname_vs_values = zcrmrecord.field_data
|
739
|
-
record_json['Owner'] = zcrmrecord.owner.id unless zcrmrecord.owner.nil?
|
740
|
-
unless zcrmrecord.layout.nil?
|
741
|
-
record_json['Layout'] = zcrmrecord.layout.id
|
742
|
-
end
|
743
|
-
unless zcrmrecord.line_items.empty?
|
744
|
-
record_json['Product_Details'] = get_line_item_json(zcrmrecord.line_items)
|
745
|
-
end
|
746
|
-
unless zcrmrecord.participants.empty?
|
747
|
-
record_json['Participants'] = get_participants_as_jsonarray(zcrmrecord)
|
748
|
-
end
|
749
|
-
unless zcrmrecord.price_details.empty?
|
750
|
-
record_json['Pricing_Details'] = get_price_details_as_jsonarray(zcrmrecord)
|
751
|
-
end
|
752
|
-
unless zcrmrecord.tax_list.empty?
|
753
|
-
record_json['Tax'] = get_tax_list_as_json(zcrmrecord)
|
754
|
-
end
|
755
|
-
unless zcrmrecord.tag_list.empty?
|
756
|
-
record_json['Tag'] = get_tag_list_as_json(zcrmrecord)
|
757
|
-
end
|
758
|
-
unless apiname_vs_values.empty?
|
759
|
-
apiname_vs_values.each do |key, value|
|
760
|
-
if value.is_a?(Operations::ZCRMRecord)
|
761
|
-
value = value.entity_id
|
762
|
-
elsif value.is_a?(Operations::ZCRMUser)
|
763
|
-
value = value.id
|
764
|
-
end
|
765
|
-
record_json.store(key, value)
|
766
|
-
end
|
767
|
-
end
|
768
|
-
record_json
|
769
|
-
end
|
770
|
-
|
771
|
-
def get_tag_list_as_json(zcrmrecord)
|
772
|
-
tag_list_json_arr = []
|
773
|
-
tag_list = zcrmrecord.tag_list
|
774
|
-
tag_list.each do |tag_ins|
|
775
|
-
tag = {}
|
776
|
-
tag['name'] = tag_ins.name unless tag_ins.name.nil?
|
777
|
-
tag['id'] = tag_ins.id unless tag_ins.id.nil?
|
778
|
-
tag_list_json_arr.push(tag)
|
779
|
-
end
|
780
|
-
tag_list_json_arr
|
781
|
-
end
|
782
|
-
|
783
|
-
def get_tax_list_as_json(zcrmrecord)
|
784
|
-
tax_list_json_arr = []
|
785
|
-
tax_list = zcrmrecord.tax_list
|
786
|
-
tax_list.each do |tax_ins|
|
787
|
-
tax_list_json_arr.push(tax_ins.name)
|
788
|
-
end
|
789
|
-
tax_list_json_arr
|
790
|
-
end
|
791
|
-
|
792
|
-
def get_price_details_as_jsonarray(zcrmrecord)
|
793
|
-
price_details_arr = []
|
794
|
-
price_details_list = zcrmrecord.price_details
|
795
|
-
price_details_list.each do |price_book_pricing_ins|
|
796
|
-
price_details_arr.push(get_zcrmprice_detail_as_json(price_book_pricing_ins))
|
797
|
-
end
|
798
|
-
price_details_arr
|
799
|
-
end
|
800
|
-
|
801
|
-
def get_zcrmprice_detail_as_json(price_book_pricing_ins)
|
802
|
-
price_detail_json = {}
|
803
|
-
unless price_book_pricing_ins.id.nil?
|
804
|
-
price_detail_json['id'] = price_book_pricing_ins.id
|
805
|
-
end
|
806
|
-
price_detail_json['discount'] = price_book_pricing_ins.discount
|
807
|
-
price_detail_json['to_range'] = price_book_pricing_ins.to_range
|
808
|
-
price_detail_json['from_range'] = price_book_pricing_ins.from_range
|
809
|
-
price_detail_json
|
810
|
-
end
|
811
|
-
|
812
|
-
def get_participants_as_jsonarray(zcrmrecord)
|
813
|
-
participants_arr = []
|
814
|
-
participants_list = zcrmrecord.participants
|
815
|
-
participants_list.each do |participant_ins|
|
816
|
-
participants_arr.push(get_zcrmparticipant_as_json(participant_ins))
|
817
|
-
end
|
818
|
-
participants_arr
|
819
|
-
end
|
820
|
-
|
821
|
-
def get_zcrmparticipant_as_json(participant_ins)
|
822
|
-
participant_json = {}
|
823
|
-
participant_json['participant'] = participant_ins.id
|
824
|
-
participant_json['type'] = participant_ins.type
|
825
|
-
participant_json['name'] = participant_ins.name
|
826
|
-
participant_json['Email'] = participant_ins.email
|
827
|
-
participant_json['invited'] = participant_ins.is_invited == true
|
828
|
-
participant_json['status'] = participant_ins.status
|
829
|
-
participant_json
|
830
|
-
end
|
831
|
-
|
832
|
-
def get_line_item_json(line_items_array)
|
833
|
-
line_items_as_json_array = []
|
834
|
-
line_items_array.each do |line_item|
|
835
|
-
line_item_data = {}
|
836
|
-
if line_item.quantity.nil?
|
837
|
-
raise Utility::ZCRMException.get_instance(@request_url_path, Utility::APIConstants::RESPONSECODE_BAD_REQUEST, "Mandatory Field 'quantity' is missing.", nil)
|
838
|
-
end
|
839
|
-
|
840
|
-
line_item_data['id'] = line_item.id unless line_item.id.nil?
|
841
|
-
unless line_item.product.nil?
|
842
|
-
line_item_data['product'] = line_item.product.entity_id
|
843
|
-
end
|
844
|
-
unless line_item.description.nil?
|
845
|
-
line_item_data['product_description'] = line_item.description
|
846
|
-
end
|
847
|
-
unless line_item.list_price.nil?
|
848
|
-
line_item_data['list_price'] = line_item.list_price
|
849
|
-
end
|
850
|
-
line_item_data['quantity'] = line_item.quantity
|
851
|
-
line_item_data['Discount'] = if line_item.discount_percentage.nil?
|
852
|
-
line_item.discount
|
853
|
-
else
|
854
|
-
line_item.discount_percentage + '%'
|
855
|
-
end
|
856
|
-
|
857
|
-
unless line_item.line_tax.nil?
|
858
|
-
line_taxes = line_item.line_tax
|
859
|
-
line_tax_array = []
|
860
|
-
line_taxes.each do |line_tax_instance|
|
861
|
-
tax = {}
|
862
|
-
tax['name'] = line_tax_instance.name
|
863
|
-
tax['value'] = line_tax_instance.value
|
864
|
-
tax['percentage'] = line_tax_instance.percentage
|
865
|
-
line_tax_array.push(tax)
|
866
|
-
line_item_data['line_tax'] = line_tax_array
|
867
|
-
end
|
868
|
-
end
|
869
|
-
line_items_as_json_array.push(line_item_data)
|
870
|
-
end
|
871
|
-
line_items_as_json_array
|
872
|
-
end
|
873
|
-
|
874
|
-
def get_zcrm_pricebook_pricing(price_details)
|
875
|
-
price_detail_ins = Operations::ZCRMPriceBookPricing.get_instance(price_details['id'])
|
876
|
-
price_detail_ins.discount = price_details['discount'].to_f
|
877
|
-
price_detail_ins.to_range = price_details['to_range'].to_f
|
878
|
-
price_detail_ins.from_range = price_details['from_range'].to_f
|
879
|
-
price_detail_ins
|
880
|
-
end
|
881
|
-
|
882
|
-
def get_zcrmparticipant(participant_details)
|
883
|
-
participant = Operations::ZCRMEventParticipant.get_instance(participant_details['type'], participant_details['participant'])
|
884
|
-
participant.name = participant_details['name']
|
885
|
-
participant.email = participant_details['Email']
|
886
|
-
participant.is_invited = participant_details['invited'] == true
|
887
|
-
participant.status = participant_details['status']
|
888
|
-
participant
|
889
|
-
end
|
890
|
-
|
891
|
-
def get_zcrminventory_line_item(line_item_details)
|
892
|
-
product_details = line_item_details['product']
|
893
|
-
line_item_instance = Operations::ZCRMInventoryLineItem.get_instance(line_item_details['id'])
|
894
|
-
product = Operations::ZCRMRecord.get_instance('Products', product_details['id'])
|
895
|
-
product.lookup_label = product_details['name']
|
896
|
-
if product_details.key?('Product_Code')
|
897
|
-
product.field_data['Product_Code'] = product_details['Product_Code']
|
898
|
-
end
|
899
|
-
line_item_instance.product = product
|
900
|
-
line_item_instance.description = line_item_details['product_description']
|
901
|
-
line_item_instance.quantity = line_item_details['quantity'].to_i
|
902
|
-
line_item_instance.list_price = line_item_details['list_price'].to_f
|
903
|
-
line_item_instance.total = line_item_details['total'].to_f
|
904
|
-
line_item_instance.discount = line_item_details['Discount'].to_f
|
905
|
-
line_item_instance.total_after_discount = line_item_details['total_after_discount'].to_f
|
906
|
-
line_item_instance.tax_amount = line_item_details['Tax'].to_f
|
907
|
-
line_taxes = line_item_details['line_tax']
|
908
|
-
unless line_taxes.nil?
|
909
|
-
line_taxes.each do |line_tax|
|
910
|
-
tax_instance = Operations::ZCRMTax.get_instance(line_tax['name'])
|
911
|
-
tax_instance.percentage = line_tax['percentage']
|
912
|
-
tax_instance.value = line_tax['value'].to_f
|
913
|
-
line_item_instance.line_tax.push(tax_instance)
|
914
|
-
end
|
915
|
-
end
|
916
|
-
line_item_instance.net_total = line_item_details['net_total'].to_f
|
917
|
-
line_item_instance
|
918
|
-
end
|
919
|
-
|
920
|
-
def get_zcrmsubform(sub_form_details)
|
921
|
-
sub_form_instance = Operations::ZCRMSubForm.get_instance(sub_form_details['id'])
|
922
|
-
sub_form_details.each do |key, value|
|
923
|
-
if key == 'Created_Time'
|
924
|
-
sub_form_instance.created_time = value
|
925
|
-
elsif key == 'Modified_Time'
|
926
|
-
sub_form_instance.modified_time = value
|
927
|
-
elsif key == 'Owner'
|
928
|
-
owner = Operations::ZCRMUser.get_instance(value['id'], value['name'])
|
929
|
-
sub_form_instance.owner = owner
|
930
|
-
elsif key == 'Layout'
|
931
|
-
layout = nil
|
932
|
-
unless value.nil?
|
933
|
-
layout = Operations::ZCRMLayout.get_instance(value['id'])
|
934
|
-
layout.name = value['name']
|
935
|
-
end
|
936
|
-
sub_form_instance.layout = layout
|
937
|
-
elsif key.start_with?('$')
|
938
|
-
sub_form_instance.properties.store(key.gsub('$', ''), value)
|
939
|
-
elsif value.is_a?(Hash) && !value.empty?
|
940
|
-
lookup_record = Operations::ZCRMRecord.get_instance(key, value.dig('id'))
|
941
|
-
lookup_record.name = value.key?('name') ? value.dig('name') : nil
|
942
|
-
sub_form_instance.field_data.store(key, lookup_record)
|
943
|
-
elsif value.is_a?(Array) && !value.empty?
|
944
|
-
arrayinstances = value
|
945
|
-
fieldarray = []
|
946
|
-
arrayinstances.each do |arrayinstance|
|
947
|
-
if arrayinstance.is_a?(Hash) && !arrayinstance.empty?
|
948
|
-
fieldarray.push(entity_api_handler_helper.get_zcrmsubform(arrayinstance))
|
949
|
-
else
|
950
|
-
fieldarray.push(arrayinstance)
|
951
|
-
end
|
952
|
-
end
|
953
|
-
sub_form_instance.field_data.store(key, fieldarray)
|
954
|
-
else
|
955
|
-
sub_form_instance.field_data.store(key, value)
|
956
|
-
end
|
957
|
-
end
|
958
|
-
sub_form_instance
|
959
|
-
end
|
960
|
-
|
961
|
-
def set_record_properties(zcrmrecord, response_hash)
|
962
|
-
entity_api_handler_helper = EntityAPIHandlerHelper.get_instance
|
963
|
-
response_hash.each do |key, value|
|
964
|
-
next if value.nil?
|
965
|
-
|
966
|
-
if key == 'id'
|
967
|
-
zcrmrecord.entity_id = value
|
968
|
-
elsif key == 'Product_Details'
|
969
|
-
line_items = value
|
970
|
-
line_items.each do |line_item|
|
971
|
-
zcrmrecord.line_items.push(entity_api_handler_helper.get_zcrminventory_line_item(line_item))
|
972
|
-
end
|
973
|
-
elsif key == 'Participants'
|
974
|
-
participants = value
|
975
|
-
participants.each do |participant|
|
976
|
-
zcrmrecord.participants.push(entity_api_handler_helper.get_zcrmparticipant(participant))
|
977
|
-
end
|
978
|
-
elsif key == 'Pricing_Details'
|
979
|
-
price_details = value
|
980
|
-
price_details.each do |price_detail|
|
981
|
-
zcrmrecord.price_details.push(entity_api_handler_helper.get_zcrm_pricebook_pricing(price_detail))
|
982
|
-
end
|
983
|
-
elsif key == 'Created_By'
|
984
|
-
created_by = Operations::ZCRMUser.get_instance(value['id'], value['name'])
|
985
|
-
zcrmrecord.created_by = created_by
|
986
|
-
elsif key == 'Modified_By'
|
987
|
-
modified_by = Operations::ZCRMUser.get_instance(value['id'], value['name'])
|
988
|
-
zcrmrecord.modified_by = modified_by
|
989
|
-
elsif key == 'Created_Time'
|
990
|
-
zcrmrecord.created_time = value
|
991
|
-
elsif key == 'Modified_Time'
|
992
|
-
zcrmrecord.modified_time = value
|
993
|
-
elsif key == 'Owner'
|
994
|
-
owner = Operations::ZCRMUser.get_instance(value['id'], value['name'])
|
995
|
-
zcrmrecord.owner = owner
|
996
|
-
elsif key == 'Layout'
|
997
|
-
layout = nil
|
998
|
-
unless value.nil?
|
999
|
-
layout = Operations::ZCRMLayout.get_instance(value['id'])
|
1000
|
-
layout.name = value['name']
|
1001
|
-
end
|
1002
|
-
zcrmrecord.layout = layout
|
1003
|
-
elsif (key == 'Handler') && !value.nil?
|
1004
|
-
handler = Operations::ZCRMUser.get_instance(value['id'], value['name'])
|
1005
|
-
zcrmrecord.field_data.store(key, handler)
|
1006
|
-
elsif (key == 'Tax') && value.is_a?(Array) && !value.empty?
|
1007
|
-
if value.is_a?(Array) && !value.empty?
|
1008
|
-
value.each do |tax_name|
|
1009
|
-
tax_ins = Operations::ZCRMTax.get_instance(tax_name)
|
1010
|
-
zcrmrecord.tax_list.push(tax_ins)
|
1011
|
-
end
|
1012
|
-
end
|
1013
|
-
elsif key == 'Tag'
|
1014
|
-
if value.is_a?(Array) && !value.empty?
|
1015
|
-
value.each do |tag|
|
1016
|
-
tag_ins = Operations::ZCRMTag.get_instance(tag['id'], tag['name'])
|
1017
|
-
zcrmrecord.tag_list.push(tag_ins)
|
1018
|
-
end
|
1019
|
-
end
|
1020
|
-
elsif (key == '$line_tax') && value.is_a?(Array) && !value.empty?
|
1021
|
-
value.each do |line_tax|
|
1022
|
-
tax_ins = Operations::ZCRMTax.get_instance(line_tax['name'])
|
1023
|
-
tax_ins.percentage = line_tax['percentage']
|
1024
|
-
tax_ins.value = line_tax['value']
|
1025
|
-
zcrmrecord.tax_list.push(tax_ins)
|
1026
|
-
end
|
1027
|
-
elsif key.start_with?('$')
|
1028
|
-
zcrmrecord.properties.store(key.gsub('$', ''), value)
|
1029
|
-
elsif key == 'Remind_At'
|
1030
|
-
zcrmrecord.field_data.store(key, value)
|
1031
|
-
elsif key == 'Recurring_Activity'
|
1032
|
-
zcrmrecord.field_data.store(key, value)
|
1033
|
-
elsif value.is_a?(Hash) && !value.empty?
|
1034
|
-
lookup_record = Operations::ZCRMRecord.get_instance(key, value.dig('id'))
|
1035
|
-
lookup_record.name = value.key?('name') ? value.dig('name') : nil
|
1036
|
-
zcrmrecord.field_data.store(key, lookup_record)
|
1037
|
-
elsif value.is_a?(Array) && !value.empty?
|
1038
|
-
arrayinstances = value
|
1039
|
-
fieldarray = []
|
1040
|
-
arrayinstances.each do |arrayinstance|
|
1041
|
-
if arrayinstance.is_a?(Hash) && !arrayinstance.empty?
|
1042
|
-
fieldarray.push(entity_api_handler_helper.get_zcrmsubform(arrayinstance))
|
1043
|
-
else
|
1044
|
-
fieldarray.push(arrayinstance)
|
1045
|
-
end
|
1046
|
-
end
|
1047
|
-
zcrmrecord.field_data.store(key, fieldarray)
|
1048
|
-
else
|
1049
|
-
zcrmrecord.field_data.store(key, value)
|
1050
|
-
end
|
1051
|
-
end
|
1052
|
-
end
|
1053
|
-
end
|
1054
|
-
# THIS CLASS SERVES THE ModuleAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
1055
|
-
class ModuleAPIHandlerHelper
|
1056
|
-
def initialize; end
|
1057
|
-
|
1058
|
-
def self.get_instance
|
1059
|
-
ModuleAPIHandlerHelper.new
|
1060
|
-
end
|
1061
|
-
|
1062
|
-
def construct_json_for_cv_update(customview_instance)
|
1063
|
-
cv_settings = {}
|
1064
|
-
unless customview_instance.sort_by.nil?
|
1065
|
-
field_ins = customview_instance.sort_by
|
1066
|
-
field_details={}
|
1067
|
-
unless field_ins.id.nil?
|
1068
|
-
field_details['id']=field_ins.id
|
1069
|
-
end
|
1070
|
-
|
1071
|
-
unless field_ins.api_name.nil?
|
1072
|
-
field_details['api_name']=field_ins.api_name
|
1073
|
-
end
|
1074
|
-
cv_settings['sort_by'] = field_details
|
1075
|
-
end
|
1076
|
-
unless customview_instance.sort_order.nil?
|
1077
|
-
cv_settings['sort_order'] = customview_instance.sort_order
|
1078
|
-
end
|
1079
|
-
input_json = {}
|
1080
|
-
input_json[Utility::APIConstants::CUSTOM_VIEWS] = [cv_settings]
|
1081
|
-
input_json
|
1082
|
-
end
|
1083
|
-
|
1084
|
-
def get_zcrm_module_related_list(relatedlist_prop)
|
1085
|
-
relatedlist_ins = Operations::ZCRMModuleRelatedList.get_instance(relatedlist_prop['api_name'])
|
1086
|
-
relatedlist_ins.id = relatedlist_prop['id']
|
1087
|
-
relatedlist_ins.module_apiname = relatedlist_prop['module']
|
1088
|
-
relatedlist_ins.display_label = relatedlist_prop['display_label']
|
1089
|
-
relatedlist_ins.name = relatedlist_prop['name']
|
1090
|
-
relatedlist_ins.type = relatedlist_prop['type']
|
1091
|
-
relatedlist_ins.href = relatedlist_prop['href']
|
1092
|
-
relatedlist_ins.is_visible = relatedlist_prop.key?('visible') ? relatedlist_prop['visible'] == true : nil
|
1093
|
-
relatedlist_ins.action = relatedlist_prop['action']
|
1094
|
-
relatedlist_ins.sequence_number = relatedlist_prop['sequence_number']
|
1095
|
-
relatedlist_ins
|
1096
|
-
end
|
1097
|
-
|
1098
|
-
def get_picklist_value_instance(picklist)
|
1099
|
-
picklist_ins = Operations::ZCRMPickListValue.get_instance
|
1100
|
-
picklist_ins.display_value = picklist['display_value']
|
1101
|
-
picklist_ins.actual_value = picklist['actual_value']
|
1102
|
-
if picklist.key?('sequence_number') && !picklist['sequence_number'].nil?
|
1103
|
-
picklist_ins.sequence_number = picklist['sequence_number']
|
1104
|
-
end
|
1105
|
-
picklist_ins.maps = picklist['maps'] if picklist.key?('maps')
|
1106
|
-
picklist_ins
|
1107
|
-
end
|
1108
|
-
|
1109
|
-
def get_multiselect_lookup_field_instance(multi_select_lookup)
|
1110
|
-
multiselect_lookup_field_instance = Operations::ZCRMMultiSelectLookupField.get_instance(multi_select_lookup['api_name'])
|
1111
|
-
multiselect_lookup_field_instance.id = multi_select_lookup['id']
|
1112
|
-
multiselect_lookup_field_instance.connected_module = multi_select_lookup['connected_module']
|
1113
|
-
multiselect_lookup_field_instance.linking_module = multi_select_lookup['linking_module']
|
1114
|
-
multiselect_lookup_field_instance.display_label = multi_select_lookup['display_label']
|
1115
|
-
multiselect_lookup_field_instance
|
1116
|
-
end
|
1117
|
-
|
1118
|
-
def get_lookup_field_instance(lookup_field_details)
|
1119
|
-
lookup_field_instance = Operations::ZCRMLookupField.get_instance(lookup_field_details['api_name'])
|
1120
|
-
lookup_field_instance.display_label = lookup_field_details['display_label']
|
1121
|
-
lookup_field_instance.id = lookup_field_details['id']
|
1122
|
-
lookup_field_instance.module_apiname = lookup_field_details['module']
|
1123
|
-
lookup_field_instance
|
1124
|
-
end
|
1125
|
-
|
1126
|
-
def get_zcrmlayout(layout_details)
|
1127
|
-
layout_instance = Operations::ZCRMLayout.get_instance(layout_details['id'])
|
1128
|
-
layout_instance.created_time = layout_details['created_time']
|
1129
|
-
layout_instance.modified_time = layout_details['modified_time']
|
1130
|
-
layout_instance.name = layout_details['name']
|
1131
|
-
layout_instance.is_visible = layout_details['visible'] == true
|
1132
|
-
layout_instance.created_for = layout_details['created_for']
|
1133
|
-
unless layout_details['created_by'].nil?
|
1134
|
-
layout_instance.created_by = Operations::ZCRMUser.get_instance(layout_details['created_by']['id'], layout_details['created_by']['name'])
|
1135
|
-
end
|
1136
|
-
unless layout_details['modified_by'].nil?
|
1137
|
-
layout_instance.modified_by = Operations::ZCRMUser.get_instance(layout_details['modified_by']['id'], layout_details['modified_by']['name'])
|
1138
|
-
end
|
1139
|
-
accessible_profile_arr = layout_details['profiles']
|
1140
|
-
accessible_profile_instances = []
|
1141
|
-
unless accessible_profile_arr.nil?
|
1142
|
-
accessible_profile_arr.each do |profile|
|
1143
|
-
profile_ins = Operations::ZCRMProfile.get_instance(profile['id'], profile['name'])
|
1144
|
-
profile_ins.is_default = profile['default'] == true
|
1145
|
-
accessible_profile_instances.push(profile_ins)
|
1146
|
-
end
|
1147
|
-
end
|
1148
|
-
layout_instance.accessible_profiles = accessible_profile_instances
|
1149
|
-
layout_instance.sections = get_all_sections_of_layout(layout_details['sections'])
|
1150
|
-
layout_instance.status = layout_details['status']
|
1151
|
-
if layout_details.key?('convert_mapping')
|
1152
|
-
convert_modules = %w[Contacts Deals Accounts]
|
1153
|
-
|
1154
|
-
convert_modules.each do |convert_module|
|
1155
|
-
next unless layout_details['convert_mapping'].key?(convert_module)
|
1156
|
-
|
1157
|
-
convert_map = layout_details['convert_mapping'][convert_module]
|
1158
|
-
convert_map_ins = Operations::ZCRMLeadConvertMapping.get_instance(convert_map['name'], convert_map['id'])
|
1159
|
-
if convert_map.key?('fields')
|
1160
|
-
field_data = convert_map['fields']
|
1161
|
-
unless field_data.nil?
|
1162
|
-
field_data.each do |each_field_data|
|
1163
|
-
convert_mapping_field_ins = Operations::ZCRMLeadConvertMappingField.get_instance(each_field_data['api_name'], each_field_data['id'])
|
1164
|
-
convert_mapping_field_ins.field_label = each_field_data['field_label']
|
1165
|
-
convert_mapping_field_ins.is_required = each_field_data['required'] == true
|
1166
|
-
convert_map_ins.fields.push(convert_mapping_field_ins)
|
1167
|
-
end
|
1168
|
-
end
|
1169
|
-
end
|
1170
|
-
layout_instance.convert_mapping[convert_module] = convert_map_ins
|
1171
|
-
end
|
1172
|
-
end
|
1173
|
-
layout_instance
|
1174
|
-
end
|
1175
|
-
|
1176
|
-
def get_all_sections_of_layout(all_section_details)
|
1177
|
-
section_instances = []
|
1178
|
-
unless all_section_details.nil?
|
1179
|
-
all_section_details.each do |section|
|
1180
|
-
section_ins = Operations::ZCRMSection.get_instance(section['name'])
|
1181
|
-
section_ins.display_label = section['display_label']
|
1182
|
-
section_ins.column_count = section['column_count']
|
1183
|
-
section_ins.sequence_number = section['sequence_number']
|
1184
|
-
section_ins.fields = get_section_fields(section['fields'])
|
1185
|
-
section_ins.tab_traversal = section['tab_traversal']
|
1186
|
-
section_ins.is_subform_section = section['isSubformSection']
|
1187
|
-
section_ins.api_name = section['api_name']
|
1188
|
-
section_ins.properties = get_section_properties(section['properties'])
|
1189
|
-
section_instances.push(section_ins)
|
1190
|
-
end
|
1191
|
-
end
|
1192
|
-
section_instances
|
1193
|
-
end
|
1194
|
-
|
1195
|
-
def get_section_fields(fields)
|
1196
|
-
section_fields = []
|
1197
|
-
unless fields.nil?
|
1198
|
-
fields.each do |field|
|
1199
|
-
section_fields.push(get_zcrmfield(field))
|
1200
|
-
end
|
1201
|
-
end
|
1202
|
-
section_fields
|
1203
|
-
end
|
1204
|
-
|
1205
|
-
def get_section_properties(properties)
|
1206
|
-
section_properties = Operations::ZCRMSectionProperties.get_instance
|
1207
|
-
unless properties.nil?
|
1208
|
-
section_properties.reorder_rows = properties['reorder_rows']
|
1209
|
-
section_properties.tooltip = properties['tooltip']
|
1210
|
-
section_properties.maximum_rows = properties['maximum_rows']
|
1211
|
-
end
|
1212
|
-
section_properties
|
1213
|
-
end
|
1214
|
-
|
1215
|
-
def get_zcrmfield(field_details)
|
1216
|
-
field_instance = Operations::ZCRMField.get_instance(field_details['api_name'])
|
1217
|
-
field_instance.sequence_number = field_details.key?('sequence_number') ? field_details['sequence_number'].to_i : nil
|
1218
|
-
field_instance.id = field_details['id']
|
1219
|
-
field_instance.is_mandatory = field_details.key?('system_mandatory') ? field_details['system_mandatory'] == true : nil
|
1220
|
-
field_instance.default_value = field_details.key?('default_value') ? field_details['default_value'] : nil
|
1221
|
-
field_instance.is_custom_field = field_details.key?('custom_field') ? field_details['custom_field'] == true : nil
|
1222
|
-
field_instance.is_visible = field_details.key?('visible') ? field_details['visible'] == true : nil
|
1223
|
-
field_instance.field_label = field_details.key?('field_label') ? field_details['field_label'] : nil
|
1224
|
-
field_instance.length = field_details.key?('length') ? field_details['length'].to_i : nil
|
1225
|
-
field_instance.created_source = field_details.key?('created_source') ? field_details['created_source'] : nil
|
1226
|
-
field_instance.is_read_only = field_details.key?('read_only') ? field_details['read_only'] == true : nil
|
1227
|
-
field_instance.is_business_card_supported = field_details.key?('businesscard_supported') ? field_details['businesscard_supported'] == true : nil
|
1228
|
-
field_instance.data_type = field_details.key?('data_type') ? field_details['data_type'] : nil
|
1229
|
-
field_instance.convert_mapping = field_details.key?('convert_mapping') ? field_details['convert_mapping'] : nil
|
1230
|
-
field_instance.is_webhook = field_details.key?('webhook') ? field_details['webhook'] : nil
|
1231
|
-
field_instance.crypt = field_details.key?('crypt') ? field_details['crypt'] : nil
|
1232
|
-
field_instance.tooltip = field_details.key?('tooltip') ? field_details['tooltip'] : nil
|
1233
|
-
field_instance.is_field_read_only = field_details.key?('field_read_only') ? field_details['field_read_only'] : nil
|
1234
|
-
field_instance.association_details = field_details.key?('association_details') ? field_details['association_details'] : nil
|
1235
|
-
field_instance.subform = field_details.key?('subform') ? field_details['subform'] : nil
|
1236
|
-
field_instance.is_mass_update = field_details.key?('mass_update') ? field_details['mass_update'] : nil
|
1237
|
-
if field_details.key?('multiselectlookup') && !field_details['multiselectlookup'].empty?
|
1238
|
-
field_instance.multiselectlookup = get_multiselect_lookup_field_instance(field_details['multiselectlookup'])
|
1239
|
-
end
|
1240
|
-
if field_details.key?('view_type')
|
1241
|
-
viewtype_dict = field_details['view_type']
|
1242
|
-
field_layout_permissions = []
|
1243
|
-
field_layout_permissions.push('VIEW') if viewtype_dict['view']
|
1244
|
-
if viewtype_dict['quick_create']
|
1245
|
-
field_layout_permissions.push('QUICK_CREATE')
|
1246
|
-
end
|
1247
|
-
field_layout_permissions.push('CREATE') if viewtype_dict['create']
|
1248
|
-
field_layout_permissions.push('EDIT') if viewtype_dict['edit']
|
1249
|
-
field_instance.field_layout_permissions = field_layout_permissions
|
1250
|
-
end
|
1251
|
-
picklist_arr = field_details['pick_list_values']
|
1252
|
-
unless picklist_arr.empty?
|
1253
|
-
picklist_instance_arr = []
|
1254
|
-
picklist_arr.each do |picklist|
|
1255
|
-
picklist_instance_arr.push(get_picklist_value_instance(picklist))
|
1256
|
-
end
|
1257
|
-
field_instance.picklist_values = picklist_instance_arr
|
1258
|
-
end
|
1259
|
-
if field_details.key?('lookup') && !field_details['lookup'].empty?
|
1260
|
-
field_instance.lookup_field = get_lookup_field_instance(field_details['lookup'])
|
1261
|
-
end
|
1262
|
-
field_instance.is_unique_field = false
|
1263
|
-
field_instance.is_case_sensitive = false
|
1264
|
-
if field_details.key?('unique') && !field_details['unique'].empty?
|
1265
|
-
field_instance.is_unique_field = true
|
1266
|
-
field_instance.is_case_sensitive = field_details['unique']['casesensitive'] == true
|
1267
|
-
end
|
1268
|
-
if field_details.key?('decimal_place') && !field_details['decimal_place'].nil?
|
1269
|
-
field_instance.decimal_place = field_details['decimal_place']
|
1270
|
-
end
|
1271
|
-
if field_details.key?('json_type') && !field_details['json_type'].nil?
|
1272
|
-
field_instance.json_type = field_details['json_type']
|
1273
|
-
end
|
1274
|
-
field_instance.is_formula_field = false
|
1275
|
-
if field_details.key?('formula') && !field_details['formula'].empty?
|
1276
|
-
field_instance.is_formula_field = true
|
1277
|
-
field_instance.formula_return_type = field_details['formula']['return_type']
|
1278
|
-
field_instance.formula_expression = field_details['formula'].key?('expression') ? field_details['formula']['expression'] : nil
|
1279
|
-
end
|
1280
|
-
field_instance.is_currency_field = false
|
1281
|
-
if field_details.key?('currency') && !field_details['currency'].empty?
|
1282
|
-
field_instance.is_currency_field = true
|
1283
|
-
field_instance.precision = field_details['currency'].key?('precision') ? field_details['currency']['precision'].to_i : nil
|
1284
|
-
field_instance.rounding_option = field_details['currency'].key?('rounding_option') ? field_details['currency']['rounding_option'] : nil
|
1285
|
-
end
|
1286
|
-
field_instance.is_auto_number = false
|
1287
|
-
if field_details.key?('auto_number') && !field_details['auto_number'].empty?
|
1288
|
-
field_instance.is_auto_number = true
|
1289
|
-
field_instance.prefix = field_details['auto_number'].key?('prefix') ? field_details['auto_number']['prefix'] : nil
|
1290
|
-
field_instance.suffix = field_details['auto_number'].key?('suffix') ? field_details['auto_number']['suffix'] : nil
|
1291
|
-
field_instance.start_number = field_details['auto_number'].key?('start_number') ? field_details['auto_number']['start_number'] : nil
|
1292
|
-
end
|
1293
|
-
field_instance
|
1294
|
-
end
|
1295
|
-
end
|
1296
|
-
# THIS CLASS IS USED TO HANDLE META DATA RELATED FUNCTIONALITY
|
1297
|
-
class MetaDataAPIHandler < APIHandler
|
1298
|
-
def initialize; end
|
1299
|
-
|
1300
|
-
def self.get_instance
|
1301
|
-
MetaDataAPIHandler.new
|
1302
|
-
end
|
1303
|
-
|
1304
|
-
def get_all_modules
|
1305
|
-
handler_ins = APIHandler.get_instance
|
1306
|
-
handler_ins.request_url_path = 'settings/modules'
|
1307
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
1308
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::MODULES
|
1309
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1310
|
-
modules_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::MODULES)
|
1311
|
-
module_ins_list = []
|
1312
|
-
module_helper = MetaDataAPIHandlerHelper.get_instance
|
1313
|
-
modules_json.each do |module_json|
|
1314
|
-
module_ins_list.push(module_helper.get_zcrmmodule(module_json))
|
1315
|
-
end
|
1316
|
-
bulk_api_response.data = module_ins_list
|
1317
|
-
bulk_api_response
|
1318
|
-
end
|
1319
|
-
|
1320
|
-
def get_module(module_api_name)
|
1321
|
-
if module_api_name.nil?
|
1322
|
-
raise Utility::ZCRMException.get_instance('get_module', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'module api name must be provided', 'NO MODULE API NAME PROVIDED')
|
1323
|
-
end
|
1324
|
-
|
1325
|
-
handler_ins = APIHandler.get_instance
|
1326
|
-
handler_ins.request_url_path = 'settings/modules/' + module_api_name
|
1327
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
1328
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::MODULES
|
1329
|
-
api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_api_response
|
1330
|
-
module_helper = MetaDataAPIHandlerHelper.get_instance
|
1331
|
-
module_json = api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::MODULES)[0]
|
1332
|
-
api_response.data = module_helper.get_zcrmmodule(module_json)
|
1333
|
-
api_response
|
1334
|
-
end
|
1335
|
-
end
|
1336
|
-
# THIS CLASS SERVES THE MetaDataAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
1337
|
-
class MetaDataAPIHandlerHelper
|
1338
|
-
def initialize; end
|
1339
|
-
|
1340
|
-
def self.get_instance
|
1341
|
-
MetaDataAPIHandlerHelper.new
|
1342
|
-
end
|
1343
|
-
|
1344
|
-
def get_relatedlist_property_instance(relatedlist_property)
|
1345
|
-
reltedlist_property_instance = Operations::ZCRMRelatedListProperties.get_instance
|
1346
|
-
reltedlist_property_instance.sort_by = relatedlist_property.key?('sort_by') ? relatedlist_property['sort_by'] : nil
|
1347
|
-
reltedlist_property_instance.sort_order = relatedlist_property.key?('sort_order') ? relatedlist_property['sort_order'] : nil
|
1348
|
-
reltedlist_property_instance.fields = relatedlist_property.key?('fields') ? relatedlist_property['fields'] : nil
|
1349
|
-
reltedlist_property_instance
|
1350
|
-
end
|
1351
|
-
|
1352
|
-
def get_zcrmmodule(module_details)
|
1353
|
-
crmmodule_instance = Operations::ZCRMModule.get_instance(module_details.dig(Utility::APIConstants::API_NAME))
|
1354
|
-
crmmodule_instance.is_viewable = module_details['viewable'] == true
|
1355
|
-
crmmodule_instance.is_creatable = module_details['creatable'] == true
|
1356
|
-
crmmodule_instance.is_convertable = module_details['convertable'] == true
|
1357
|
-
crmmodule_instance.is_editable = module_details['editable'] == true
|
1358
|
-
crmmodule_instance.is_deletable = module_details['deletable'] == true
|
1359
|
-
crmmodule_instance.web_link = module_details.key?('web_link') ? module_details['web_link'] : nil
|
1360
|
-
crmmodule_instance.singular_label = module_details['singular_label']
|
1361
|
-
crmmodule_instance.plural_label = module_details['plural_label']
|
1362
|
-
crmmodule_instance.id = module_details['id']
|
1363
|
-
crmmodule_instance.modified_time = module_details['modified_time']
|
1364
|
-
crmmodule_instance.is_inventory_template_supported = module_details['inventory_template_supported'] == true
|
1365
|
-
crmmodule_instance.is_api_supported = module_details['api_supported'] == true
|
1366
|
-
crmmodule_instance.is_scoring_supported = module_details['scoring_supported'] == true
|
1367
|
-
crmmodule_instance.module_name = module_details['module_name']
|
1368
|
-
crmmodule_instance.business_card_field_limit = module_details.key?('business_card_field_limit') ? module_details['business_card_field_limit'].to_i : nil
|
1369
|
-
crmmodule_instance.sequence_number = module_details.key?('sequence_number') ? module_details['sequence_number'] : nil
|
1370
|
-
crmmodule_instance.is_global_search_supported = module_details.key?('global_search_supported') ? module_details['global_search_supported'] == true : nil
|
1371
|
-
unless module_details['modified_by'].nil?
|
1372
|
-
crmmodule_instance.modified_by = Operations::ZCRMUser.get_instance(module_details['modified_by']['id'], module_details['modified_by']['name'])
|
1373
|
-
end
|
1374
|
-
|
1375
|
-
crmmodule_instance.is_custom_module = module_details['generated_type'] == 'custom'
|
1376
|
-
|
1377
|
-
if module_details.key?('business_card_fields')
|
1378
|
-
crmmodule_instance.business_card_fields = module_details['business_card_fields']
|
1379
|
-
end
|
1380
|
-
|
1381
|
-
profiles = module_details['profiles']
|
1382
|
-
unless profiles.nil?
|
1383
|
-
profiles.each do |profile|
|
1384
|
-
crmmodule_instance.profiles.push(Operations::ZCRMProfile.get_instance(profile['id'], profile['name']))
|
1385
|
-
end
|
1386
|
-
end
|
1387
|
-
|
1388
|
-
if module_details.key?('display_field') && !module_details['display_field'].nil?
|
1389
|
-
crmmodule_instance.display_field_name = module_details['display_field']
|
1390
|
-
end
|
1391
|
-
if module_details.key?('related_lists') && !module_details['related_lists'].nil?
|
1392
|
-
relatedlists = module_details['related_lists']
|
1393
|
-
relatedlist_instances = []
|
1394
|
-
unless relatedlists.nil?
|
1395
|
-
relatedlists.each do |relatedlist|
|
1396
|
-
module_relatedlist_ins = Operations::ZCRMModuleRelatedList.get_instance(relatedlist['api_name'])
|
1397
|
-
relatedlist_instances.push(module_relatedlist_ins.set_relatedlist_properties(relatedlist))
|
1398
|
-
end
|
1399
|
-
end
|
1400
|
-
crmmodule_instance.related_lists = relatedlist_instances
|
1401
|
-
end
|
1402
|
-
if module_details.key?('related_list_properties') && !module_details['related_list_properties'].nil?
|
1403
|
-
crmmodule_instance.related_list_properties = get_relatedlist_property_instance(module_details['related_list_properties'])
|
1404
|
-
end
|
1405
|
-
if module_details.key?('$properties') && !module_details['$properties'].nil?
|
1406
|
-
crmmodule_instance.properties = module_details['$properties']
|
1407
|
-
end
|
1408
|
-
if module_details.key?('per_page') && !module_details['per_page'].nil?
|
1409
|
-
crmmodule_instance.per_page = module_details['per_page'].to_i
|
1410
|
-
end
|
1411
|
-
if module_details.key?('search_layout_fields') && !module_details['search_layout_fields'].nil?
|
1412
|
-
crmmodule_instance.search_layout_fields = module_details['search_layout_fields']
|
1413
|
-
end
|
1414
|
-
if module_details.key?('custom_view') && !module_details['custom_view'].nil?
|
1415
|
-
meta_data_api_helper = MetaDataAPIHandlerHelper.get_instance
|
1416
|
-
crmmodule_instance.default_custom_view = meta_data_api_helper.get_zcrm_customview(module_details.dig('custom_view'), crmmodule_instance.api_name, nil)
|
1417
|
-
crmmodule_instance.default_custom_view_id = module_details['custom_view']['id']
|
1418
|
-
end
|
1419
|
-
if module_details.key?('territory') && !module_details['territory'].nil?
|
1420
|
-
crmmodule_instance.default_territory_id = module_details['territory']['id']
|
1421
|
-
crmmodule_instance.default_territory_name = module_details['territory']['name']
|
1422
|
-
end
|
1423
|
-
crmmodule_instance.is_kanban_view = module_details.key?('kanban_view') ? module_details['kanban_view'] == true : nil
|
1424
|
-
crmmodule_instance.is_filter_status = module_details.key?('filter_status') ? module_details['filter_status'] == true : nil
|
1425
|
-
crmmodule_instance.is_presence_sub_menu = module_details.key?('presence_sub_menu') ? module_details['presence_sub_menu_status'] == true : nil
|
1426
|
-
crmmodule_instance.arguments = module_details['arguments']
|
1427
|
-
crmmodule_instance.generated_type = module_details['generated_type']
|
1428
|
-
crmmodule_instance.is_quick_create = module_details['quick_create'] == true
|
1429
|
-
crmmodule_instance.is_kanban_view_supported = module_details.key?('kanban_view_supported') ? module_details['kanban_view_supported'] == true : nil
|
1430
|
-
crmmodule_instance.is_filter_supported = module_details.key?('filter_supported') ? module_details['filter_supported'] == true : nil
|
1431
|
-
unless module_details['parent_module'].nil?
|
1432
|
-
parent_module_instance = Operations::ZCRMModule.get_instance(module_details['parent_module']['api_name'])
|
1433
|
-
parent_module_instance.id = module_details['parent_module']['id']
|
1434
|
-
unless parent_module_instance.id.nil?
|
1435
|
-
crmmodule_instance.parent_module = parent_module_instance
|
1436
|
-
end
|
1437
|
-
end
|
1438
|
-
crmmodule_instance.is_feeds_required = module_details['feeds_required'] == true
|
1439
|
-
crmmodule_instance.is_email_template_support = module_details['emailTemplate_support'] == true
|
1440
|
-
crmmodule_instance.is_webform_supported = module_details['webform_supported'] == true
|
1441
|
-
crmmodule_instance.visibility = module_details['visibility']
|
1442
|
-
crmmodule_instance
|
1443
|
-
end
|
1444
|
-
|
1445
|
-
def construct_criteria(criteria)
|
1446
|
-
criteria_instance = Operations::ZCRMCustomViewCriteria.get_instance
|
1447
|
-
criteria_instance.field = criteria.key?('field') ? criteria['field'] : nil
|
1448
|
-
criteria_instance.comparator = criteria.key?('comparator') ? criteria['comparator'] : nil
|
1449
|
-
unless criteria['value'].nil?
|
1450
|
-
criteria_instance.index = $index
|
1451
|
-
criteria_instance.value = criteria['value']
|
1452
|
-
criteria_instance.pattern = $index.to_s
|
1453
|
-
$index = $index + 1
|
1454
|
-
criteria_instance.criteria = ' (' + criteria_instance.field .to_s + ':' + criteria_instance.comparator.to_s + ':' + criteria_instance.value.to_s + ') '
|
1455
|
-
end
|
1456
|
-
group_criteria = []
|
1457
|
-
unless criteria['group'].nil?
|
1458
|
-
i = 0
|
1459
|
-
while i < criteria['group'].count
|
1460
|
-
group_criteria.push(construct_criteria(criteria['group'][i]))
|
1461
|
-
i += 1
|
1462
|
-
end
|
1463
|
-
end
|
1464
|
-
criteria_instance.group = group_criteria unless group_criteria.nil?
|
1465
|
-
unless criteria['group_operator'].nil?
|
1466
|
-
criteria_instance.group_operator = criteria['group_operator']
|
1467
|
-
criteria_instance.criteria = '(' + group_criteria[0].criteria + criteria_instance.group_operator + group_criteria[1].criteria + ')'
|
1468
|
-
criteria_instance.pattern = '{' + group_criteria[0].pattern + criteria_instance.group_operator + group_criteria[1].pattern + '}'
|
1469
|
-
end
|
1470
|
-
criteria_instance
|
1471
|
-
end
|
1472
|
-
|
1473
|
-
def get_zcrm_customview(customview_details, module_api_name, categories = nil)
|
1474
|
-
customview_instance = Operations::ZCRMCustomView.get_instance(customview_details['id'], module_api_name)
|
1475
|
-
customview_instance.display_value = customview_details['display_value']
|
1476
|
-
customview_instance.is_default = customview_details['default'] == true
|
1477
|
-
customview_instance.name = customview_details['name']
|
1478
|
-
customview_instance.is_system_defined = customview_details['system_defined'] == true
|
1479
|
-
customview_instance.shared_details = customview_details['shared_details']
|
1480
|
-
customview_instance.system_name = customview_details['system_name']
|
1481
|
-
customview_instance.sort_by = customview_details.key?('sort_by') ? customview_details['sort_by'] : nil
|
1482
|
-
customview_instance.category = customview_details.key?('category') ? customview_details['category'] : nil
|
1483
|
-
customview_instance.fields = customview_details.key?('fields') ? customview_details['fields'] : nil
|
1484
|
-
customview_instance.favorite = customview_details.key?('favorite') ? customview_details['favorite'] : nil
|
1485
|
-
customview_instance.sort_order = customview_details.key?('sort_order') ? customview_details['sort_order'] : nil
|
1486
|
-
if customview_details.key?('criteria') && !customview_details['criteria'].nil?
|
1487
|
-
criteria = customview_details['criteria'] # entire criteria
|
1488
|
-
$index = 0
|
1489
|
-
customview_instance.criteria = construct_criteria(criteria)
|
1490
|
-
customview_instance.criteria_condition = customview_instance.criteria.criteria
|
1491
|
-
customview_instance.criteria_pattern = customview_instance.criteria.pattern
|
1492
|
-
end
|
1493
|
-
unless categories.nil?
|
1494
|
-
category_instances = []
|
1495
|
-
categories.each do |category|
|
1496
|
-
cv_category_instance = Operations::ZCRMCustomViewCategory.get_instance
|
1497
|
-
cv_category_instance.display_value = categories[category]
|
1498
|
-
cv_category_instance.actual_value = category
|
1499
|
-
category_instances.push(cv_category_instance)
|
1500
|
-
end
|
1501
|
-
customview_instance.categories = category_instances
|
1502
|
-
end
|
1503
|
-
if customview_details.key?('offline')
|
1504
|
-
customview_instance.is_off_line = customview_details['offline']
|
1505
|
-
end
|
1506
|
-
customview_instance
|
1507
|
-
end
|
1508
|
-
end
|
1509
|
-
# THIS CLASS IS USED TO HANDLE ORGANIZATION RELATED FUNCTIONALITY
|
1510
|
-
class OrganizationAPIHandler
|
1511
|
-
def initialize; end
|
1512
|
-
|
1513
|
-
def self.get_instance
|
1514
|
-
OrganizationAPIHandler.new
|
1515
|
-
end
|
1516
|
-
|
1517
|
-
def get_organization_details
|
1518
|
-
handler_ins = APIHandler.get_instance
|
1519
|
-
handler_ins.request_url_path = 'org'
|
1520
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1521
|
-
handler_ins.request_api_key = Utility::APIConstants::ORG
|
1522
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1523
|
-
org_json = api_response.response_json[Utility::APIConstants::ORG][0]
|
1524
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1525
|
-
api_response.data = org_api_helper.get_zcrm_organization(org_json)
|
1526
|
-
api_response
|
1527
|
-
end
|
1528
|
-
|
1529
|
-
def get_all_roles
|
1530
|
-
handler_ins = APIHandler.get_instance
|
1531
|
-
handler_ins.request_url_path = 'settings/roles'
|
1532
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1533
|
-
handler_ins.request_api_key = Utility::APIConstants::ROLES
|
1534
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1535
|
-
roles = bulk_api_response.response_json[Utility::APIConstants::ROLES]
|
1536
|
-
role_instances = []
|
1537
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1538
|
-
roles.each do |role|
|
1539
|
-
role_instances.push(org_api_helper.get_zcrm_role(role))
|
1540
|
-
end
|
1541
|
-
bulk_api_response.data = role_instances
|
1542
|
-
bulk_api_response
|
1543
|
-
end
|
1544
|
-
|
1545
|
-
def get_role(role_id)
|
1546
|
-
if role_id.nil?
|
1547
|
-
raise Utility::ZCRMException.get_instance('get_role', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'role id must be given', 'ROLE ID IS NOT PROVIDED')
|
1548
|
-
end
|
1549
|
-
|
1550
|
-
handler_ins = APIHandler.get_instance
|
1551
|
-
handler_ins.request_url_path = 'settings/roles/' + role_id.to_s
|
1552
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1553
|
-
handler_ins.request_api_key = Utility::APIConstants::ROLES
|
1554
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1555
|
-
role = api_response.response_json[Utility::APIConstants::ROLES][0]
|
1556
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1557
|
-
api_response.data = org_api_helper.get_zcrm_role(role)
|
1558
|
-
api_response
|
1559
|
-
end
|
1560
|
-
|
1561
|
-
def get_all_profiles
|
1562
|
-
handler_ins = APIHandler.get_instance
|
1563
|
-
handler_ins.request_url_path = 'settings/profiles'
|
1564
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1565
|
-
handler_ins.request_api_key = Utility::APIConstants::PROFILES
|
1566
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1567
|
-
profiles = bulk_api_response.response_json[handler_ins.request_api_key]
|
1568
|
-
profile_instances = []
|
1569
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1570
|
-
profiles.each do |profile|
|
1571
|
-
profile_instances.push(org_api_helper.get_zcrm_profile(profile))
|
1572
|
-
end
|
1573
|
-
bulk_api_response.data = profile_instances
|
1574
|
-
bulk_api_response
|
1575
|
-
end
|
1576
|
-
|
1577
|
-
def get_profile(profile_id)
|
1578
|
-
if profile_id.nil?
|
1579
|
-
raise Utility::ZCRMException.get_instance('get_profile', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'profile id must be given', 'PROFILE ID IS NOT PROVIDED')
|
1580
|
-
end
|
1581
|
-
|
1582
|
-
handler_ins = APIHandler.get_instance
|
1583
|
-
handler_ins.request_url_path = 'settings/profiles/' + profile_id.to_s
|
1584
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1585
|
-
handler_ins.request_api_key = Utility::APIConstants::PROFILES
|
1586
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1587
|
-
profile = api_response.response_json[handler_ins.request_api_key][0]
|
1588
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1589
|
-
api_response.data = org_api_helper.get_zcrm_profile(profile)
|
1590
|
-
api_response
|
1591
|
-
end
|
1592
|
-
|
1593
|
-
def create_user(user_instance)
|
1594
|
-
if user_instance.nil?
|
1595
|
-
raise Utility::ZCRMException.get_instance('create_user', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'user instance must be given', 'USER INSTANCE IS NOT PROVIDED')
|
1596
|
-
end
|
1597
|
-
|
1598
|
-
handler_ins = APIHandler.get_instance
|
1599
|
-
handler_ins.request_url_path = 'users'
|
1600
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
1601
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1602
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1603
|
-
handler_ins.request_body = org_api_helper.construct_json_from_user_instance(user_instance)
|
1604
|
-
Request::APIRequest.get_instance(handler_ins).get_api_response
|
1605
|
-
end
|
1606
|
-
|
1607
|
-
def update_user(user_instance)
|
1608
|
-
if user_instance.nil? || user_instance.id.nil?
|
1609
|
-
raise Utility::ZCRMException.get_instance('update_user', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'user instance and id must be given', 'USER INSTANCE OR ID IS NOT PROVIDED')
|
1610
|
-
end
|
1611
|
-
|
1612
|
-
handler_ins = APIHandler.get_instance
|
1613
|
-
handler_ins.request_url_path = 'users/' + user_instance.id.to_s
|
1614
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
1615
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1616
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1617
|
-
handler_ins.request_body = org_api_helper.construct_json_from_user_instance(user_instance)
|
1618
|
-
Request::APIRequest.get_instance(handler_ins).get_api_response
|
1619
|
-
end
|
1620
|
-
|
1621
|
-
def delete_user(user_id)
|
1622
|
-
if user_id.nil?
|
1623
|
-
raise Utility::ZCRMException.get_instance('delete_user', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'user id must be given', 'USER ID IS NOT PROVIDED')
|
1624
|
-
end
|
1625
|
-
|
1626
|
-
handler_ins = APIHandler.get_instance
|
1627
|
-
handler_ins.request_url_path = 'users/' + user_id.to_s
|
1628
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
1629
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1630
|
-
Request::APIRequest.get_instance(handler_ins).get_api_response
|
1631
|
-
end
|
1632
|
-
|
1633
|
-
def get_user(user_id)
|
1634
|
-
if user_id.nil?
|
1635
|
-
raise Utility::ZCRMException.get_instance('get_user', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'user id must be given', 'USER ID IS NOT PROVIDED')
|
1636
|
-
end
|
1637
|
-
|
1638
|
-
handler_ins = APIHandler.get_instance
|
1639
|
-
handler_ins.request_url_path = 'users/' + user_id.to_s
|
1640
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1641
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1642
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1643
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1644
|
-
api_response.data = org_api_helper.get_zcrm_user(api_response.response_json[Utility::APIConstants::USERS][0])
|
1645
|
-
api_response
|
1646
|
-
end
|
1647
|
-
|
1648
|
-
def get_all_users(page,per_page)
|
1649
|
-
get_users('AllUsers',page,per_page)
|
1650
|
-
end
|
1651
|
-
|
1652
|
-
def get_all_deactive_users(page,per_page)
|
1653
|
-
get_users('DeactiveUsers',page,per_page)
|
1654
|
-
end
|
1655
|
-
|
1656
|
-
def get_all_active_users(page,per_page)
|
1657
|
-
get_users('ActiveUsers',page,per_page)
|
1658
|
-
end
|
1659
|
-
|
1660
|
-
def get_all_confirmed_users(page,per_page)
|
1661
|
-
get_users('ConfirmedUsers',page,per_page)
|
1662
|
-
end
|
1663
|
-
|
1664
|
-
def get_all_not_confirmed_users(page,per_page)
|
1665
|
-
get_users('NotConfirmedUsers',page,per_page)
|
1666
|
-
end
|
1667
|
-
|
1668
|
-
def get_all_deleted_users(page,per_page)
|
1669
|
-
get_users('DeletedUsers',page,per_page)
|
1670
|
-
end
|
1671
|
-
|
1672
|
-
def get_all_active_confirmed_users(page,per_page)
|
1673
|
-
get_users('ActiveConfirmedUsers',page,per_page)
|
1674
|
-
end
|
1675
|
-
|
1676
|
-
def get_all_admin_users(page,per_page)
|
1677
|
-
get_users('AdminUsers',page,per_page)
|
1678
|
-
end
|
1679
|
-
|
1680
|
-
def get_all_active_confirmed_admin_users(page,per_page)
|
1681
|
-
get_users('ActiveConfirmedAdmins',page,per_page)
|
1682
|
-
end
|
1683
|
-
|
1684
|
-
def get_current_user(page,per_page)
|
1685
|
-
get_users('CurrentUser',page,per_page)
|
1686
|
-
end
|
1687
|
-
|
1688
|
-
def get_users(user_type = nil,page=1,per_page=200)
|
1689
|
-
handler_ins = APIHandler.get_instance
|
1690
|
-
handler_ins.add_param('type', user_type) unless user_type.nil?
|
1691
|
-
handler_ins.add_param('page', page)
|
1692
|
-
handler_ins.add_param('per_page', per_page)
|
1693
|
-
handler_ins.request_url_path = 'users'
|
1694
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1695
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1696
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1697
|
-
users_json = bulk_api_response.response_json[Utility::APIConstants::USERS]
|
1698
|
-
user_instances = []
|
1699
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1700
|
-
users_json.each do |user_details|
|
1701
|
-
user_instances.push(org_api_helper.get_zcrm_user(user_details))
|
1702
|
-
end
|
1703
|
-
bulk_api_response.data = user_instances
|
1704
|
-
bulk_api_response
|
1705
|
-
end
|
1706
|
-
|
1707
|
-
def search_users_by_criteria(criteria, type,page,per_page)
|
1708
|
-
if criteria.nil?
|
1709
|
-
raise Utility::ZCRMException.get_instance('search_users_by_criteria', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'criteria must be provided', 'NO CRITERIA PROVIDED')
|
1710
|
-
end
|
1711
|
-
|
1712
|
-
handler_ins = APIHandler.get_instance
|
1713
|
-
handler_ins.request_url_path = 'users/search'
|
1714
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1715
|
-
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1716
|
-
handler_ins.add_param('criteria', criteria)
|
1717
|
-
handler_ins.add_param('type', type) unless type.nil?
|
1718
|
-
handler_ins.add_param('page', page)
|
1719
|
-
handler_ins.add_param('per_page', per_page)
|
1720
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1721
|
-
users_json = bulk_api_response.response_json[Utility::APIConstants::USERS]
|
1722
|
-
user_instances = []
|
1723
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1724
|
-
users_json.each do |user_details|
|
1725
|
-
user_instances.push(org_api_helper.get_zcrm_user(user_details))
|
1726
|
-
end
|
1727
|
-
bulk_api_response.data = user_instances
|
1728
|
-
bulk_api_response
|
1729
|
-
end
|
1730
|
-
|
1731
|
-
def create_organization_taxes(org_tax_instances)
|
1732
|
-
if org_tax_instances.length > 100
|
1733
|
-
raise Utility::ZCRMException.get_instance('create_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be less than or equals to 100', 'MORE ORG TAXES PROVIDED')
|
1734
|
-
end
|
1735
|
-
|
1736
|
-
if org_tax_instances.length < 1
|
1737
|
-
raise Utility::ZCRMException.get_instance('create_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be at least 1', 'NO ORG TAX PROVIDED')
|
1738
|
-
end
|
1739
|
-
|
1740
|
-
handler_ins = APIHandler.get_instance
|
1741
|
-
handler_ins.request_url_path = 'org/taxes'
|
1742
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
1743
|
-
handler_ins.request_api_key = Utility::APIConstants::TAXES
|
1744
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1745
|
-
data_array = []
|
1746
|
-
org_tax_instances.each do |org_tax_instance|
|
1747
|
-
if org_tax_instance.id.nil?
|
1748
|
-
data_array.push(org_api_helper.get_zcrmorgtax_as_json(org_tax_instance))
|
1749
|
-
else
|
1750
|
-
raise Utility::ZCRMException.get_instance('Org_tax_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax id must be nil', 'ORG TAX ID PROVIDED')
|
1751
|
-
end
|
1752
|
-
end
|
1753
|
-
request_json = {}
|
1754
|
-
request_json[Utility::APIConstants::TAXES] = data_array
|
1755
|
-
handler_ins.request_body = request_json
|
1756
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1757
|
-
bulk_api_response
|
1758
|
-
end
|
1759
|
-
|
1760
|
-
def update_organization_taxes(org_tax_instances)
|
1761
|
-
if org_tax_instances.length > 100
|
1762
|
-
raise Utility::ZCRMException.get_instance('update_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be less than or equals to 100', 'MORE ORG TAXES PROVIDED')
|
1763
|
-
end
|
1764
|
-
|
1765
|
-
if org_tax_instances.length < 1
|
1766
|
-
raise Utility::ZCRMException.get_instance('update_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be at least 1', 'NO ORG TAX PROVIDED')
|
1767
|
-
end
|
1768
|
-
|
1769
|
-
handler_ins = APIHandler.get_instance
|
1770
|
-
handler_ins.request_url_path = 'org/taxes'
|
1771
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_PUT
|
1772
|
-
handler_ins.request_api_key = Utility::APIConstants::TAXES
|
1773
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1774
|
-
data_array = []
|
1775
|
-
org_tax_instances.each do |org_tax_instance|
|
1776
|
-
if org_tax_instance.id.nil?
|
1777
|
-
raise Utility::ZCRMException.get_instance('Org_tax_update', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax id must not be nil', 'ORG TAX ID NOT PROVIDED')
|
1778
|
-
else
|
1779
|
-
data_array.push(org_api_helper.get_zcrmorgtax_as_json(org_tax_instance))
|
1780
|
-
end
|
1781
|
-
end
|
1782
|
-
|
1783
|
-
request_json = {}
|
1784
|
-
request_json[Utility::APIConstants::TAXES] = data_array
|
1785
|
-
handler_ins.request_body = request_json
|
1786
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1787
|
-
bulk_api_response
|
1788
|
-
end
|
1789
|
-
|
1790
|
-
def delete_organization_taxes(org_tax_ids)
|
1791
|
-
if org_tax_ids.length > 100
|
1792
|
-
raise Utility::ZCRMException.get_instance('delete_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be less than or equals to 100', 'MORE ORG TAX PROVIDED')
|
1793
|
-
end
|
1794
|
-
|
1795
|
-
if org_tax_ids.length < 1
|
1796
|
-
raise Utility::ZCRMException.get_instance('delete_organization_taxes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax count must be at least 1', 'NO ORG TAX PROVIDED')
|
1797
|
-
end
|
1798
|
-
|
1799
|
-
handler_ins = APIHandler.get_instance
|
1800
|
-
handler_ins.request_url_path = 'org/taxes'
|
1801
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
1802
|
-
handler_ins.request_api_key = Utility::APIConstants::TAXES
|
1803
|
-
ids_as_string = ''
|
1804
|
-
org_tax_ids.each do |org_tax_id|
|
1805
|
-
ids_as_string += org_tax_id.to_s + ','
|
1806
|
-
end
|
1807
|
-
|
1808
|
-
handler_ins.add_param('ids', ids_as_string)
|
1809
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1810
|
-
bulk_api_response
|
1811
|
-
end
|
1812
|
-
|
1813
|
-
def delete_organization_tax(orgtax_id)
|
1814
|
-
if orgtax_id.nil?
|
1815
|
-
raise Utility::ZCRMException.get_instance('delete_organization_tax', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax id must be given', 'NO ORG TAX ID PROVIDED')
|
1816
|
-
end
|
1817
|
-
|
1818
|
-
handler_ins = APIHandler.get_instance
|
1819
|
-
handler_ins.request_url_path = 'org/taxes/' + orgtax_id.to_s
|
1820
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
1821
|
-
handler_ins.request_api_key = Utility::APIConstants::TAXES
|
1822
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1823
|
-
api_response
|
1824
|
-
end
|
1825
|
-
|
1826
|
-
def get_organization_taxes
|
1827
|
-
handler_ins = APIHandler.get_instance
|
1828
|
-
handler_ins.request_url_path = 'org/taxes'
|
1829
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1830
|
-
handler_ins.request_api_key = Utility::APIConstants::TAXES
|
1831
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1832
|
-
org_taxes_json = bulk_api_response.response_json[Utility::APIConstants::TAXES]
|
1833
|
-
org_taxes_instances = []
|
1834
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1835
|
-
org_taxes_json.each do |org_tax|
|
1836
|
-
org_taxes_instances.push(org_api_helper.get_zcrm_org_tax_instance(org_tax))
|
1837
|
-
end
|
1838
|
-
bulk_api_response.data = org_taxes_instances
|
1839
|
-
bulk_api_response
|
1840
|
-
end
|
1841
|
-
|
1842
|
-
def get_organization_tax(org_tax_id)
|
1843
|
-
if org_tax_id.nil?
|
1844
|
-
raise Utility::ZCRMException.get_instance('get_organization_tax', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'org tax id must be given', 'NO ORG TAX ID PROVIDED')
|
1845
|
-
end
|
1846
|
-
|
1847
|
-
handler_ins = APIHandler.get_instance
|
1848
|
-
handler_ins.request_url_path = 'org/taxes/' + org_tax_id.to_s
|
1849
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1850
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
1851
|
-
org_api_helper = OrganizationAPIHandlerHelper.get_instance
|
1852
|
-
api_response.data = org_api_helper.get_zcrm_org_tax_instance(api_response.response_json[Utility::APIConstants::TAXES][0])
|
1853
|
-
api_response
|
1854
|
-
end
|
1855
|
-
def get_notes(sort_by, sort_order, page, per_page)
|
1856
|
-
handler_ins = APIHandler.get_instance
|
1857
|
-
handler_ins.request_url_path = 'Notes'
|
1858
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1859
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1860
|
-
handler_ins.add_param('page', page)
|
1861
|
-
handler_ins.add_param('per_page', per_page)
|
1862
|
-
handler_ins.add_param('sort_by', sort_by)unless sort_by.nil?
|
1863
|
-
handler_ins.add_param('sort_order', sort_order)unless sort_order.nil?
|
1864
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1865
|
-
notes_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::DATA)
|
1866
|
-
notes_list = []
|
1867
|
-
notes_helper = RelatedListAPIHandlerHelper.get_instance
|
1868
|
-
notes_json.each do |note_json|
|
1869
|
-
record_ins=Operations::ZCRMRecord.get_instance(note_json['$se_module'], note_json['Parent_Id']['id'])
|
1870
|
-
note_ins = Operations::ZCRMNote.get_instance(record_ins,note_json['id'])
|
1871
|
-
notes_list.push(notes_helper.get_zcrm_note(note_json,note_ins))
|
1872
|
-
end
|
1873
|
-
bulk_api_response.data = notes_list
|
1874
|
-
bulk_api_response
|
1875
|
-
end
|
1876
|
-
def create_notes(note_instances)
|
1877
|
-
if note_instances.length > 100
|
1878
|
-
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
1879
|
-
end
|
1880
|
-
|
1881
|
-
if note_instances.length < 1
|
1882
|
-
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be at least 1', 'NO NOTES PROVIDED')
|
1883
|
-
end
|
1884
|
-
|
1885
|
-
handler_ins = APIHandler.get_instance
|
1886
|
-
handler_ins.request_url_path = 'Notes'
|
1887
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
1888
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1889
|
-
notes_api_helper = RelatedListAPIHandlerHelper.get_instance
|
1890
|
-
data_array = []
|
1891
|
-
note_instances.each do |note_instance|
|
1892
|
-
if note_instance.id.nil?
|
1893
|
-
data_array.push(notes_api_helper.get_zcrmnote_as_json(note_instance))
|
1894
|
-
else
|
1895
|
-
raise Utility::ZCRMException.get_instance('notes_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note id must be nil', 'NOTE ID PROVIDED')
|
1896
|
-
end
|
1897
|
-
end
|
1898
|
-
request_json = {}
|
1899
|
-
request_json[Utility::APIConstants::DATA] = data_array
|
1900
|
-
handler_ins.request_body = request_json
|
1901
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1902
|
-
bulk_api_response
|
1903
|
-
end
|
1904
|
-
def delete_notes(note_ids)
|
1905
|
-
if note_ids.length > 100
|
1906
|
-
raise Utility::ZCRMException.get_instance('delete_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'notes count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
1907
|
-
end
|
1908
|
-
|
1909
|
-
if note_ids.length < 1
|
1910
|
-
raise Utility::ZCRMException.get_instance('delete_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'notes count must be at least 1', 'NO NOTES PROVIDED')
|
1911
|
-
end
|
1912
|
-
|
1913
|
-
handler_ins = APIHandler.get_instance
|
1914
|
-
handler_ins.request_url_path = 'Notes'
|
1915
|
-
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
1916
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1917
|
-
ids_as_string = ''
|
1918
|
-
note_ids.each do |note_id|
|
1919
|
-
ids_as_string += note_id.to_s + ','
|
1920
|
-
end
|
1921
|
-
|
1922
|
-
handler_ins.add_param('ids', ids_as_string)
|
1923
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1924
|
-
bulk_api_response
|
1925
|
-
end
|
1926
|
-
end
|
1927
|
-
# THIS CLASS SERVES THE OrganizationAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
1928
|
-
class OrganizationAPIHandlerHelper
|
1929
|
-
def initialize; end
|
1930
|
-
|
1931
|
-
def self.get_instance
|
1932
|
-
OrganizationAPIHandlerHelper.new
|
1933
|
-
end
|
1934
|
-
|
1935
|
-
def get_zcrm_user_customizeinfo(customize_info)
|
1936
|
-
customize_info_instance = Operations::ZCRMUserCustomizeInfo.get_instance
|
1937
|
-
customize_info_instance.notes_desc = customize_info['notes_desc']
|
1938
|
-
customize_info_instance.is_to_show_right_panel = customize_info.key?('show_right_panel') ? customize_info['show_right_panel'] == true : nil
|
1939
|
-
customize_info_instance.is_bc_view = customize_info['bc_view']
|
1940
|
-
customize_info_instance.is_to_show_home = customize_info.key?('show_home') ? customize_info['show_home'] == true : nil
|
1941
|
-
customize_info_instance.is_to_show_detail_view = customize_info.key?('show_detail_view') ? customize_info['show_detail_view'] == true : nil
|
1942
|
-
customize_info_instance.unpin_recent_item = customize_info['unpin_recent_item']
|
1943
|
-
customize_info_instance
|
1944
|
-
end
|
1945
|
-
|
1946
|
-
def get_zcrm_org_tax_instance(org_tax)
|
1947
|
-
org_tax_instance = Operations::ZCRMOrgTax.get_instance(org_tax['id'], org_tax['name'])
|
1948
|
-
org_tax_instance.display_label = org_tax['display_label']
|
1949
|
-
org_tax_instance.value = org_tax['value']
|
1950
|
-
org_tax_instance
|
1951
|
-
end
|
1952
|
-
|
1953
|
-
def get_zcrm_user_theme(user_theme_info)
|
1954
|
-
user_theme_instance = Operations::ZCRMUserTheme.get_instance
|
1955
|
-
user_theme_instance.normal_tab_font_color = user_theme_info['normal_tab']['font_color']
|
1956
|
-
user_theme_instance.normal_tab_background = user_theme_info['normal_tab']['background']
|
1957
|
-
user_theme_instance.selected_tab_font_color = user_theme_info['selected_tab']['font_color']
|
1958
|
-
user_theme_instance.selected_tab_background = user_theme_info['selected_tab']['background']
|
1959
|
-
user_theme_instance.new_background = user_theme_info['new_background']
|
1960
|
-
user_theme_instance.background = user_theme_info['background']
|
1961
|
-
user_theme_instance.screen = user_theme_info['screen']
|
1962
|
-
user_theme_instance.type = user_theme_info['type']
|
1963
|
-
user_theme_instance
|
1964
|
-
end
|
1965
|
-
|
1966
|
-
def get_zcrmorgtax_as_json(zcrmorgtax_instance)
|
1967
|
-
orgtax_as_json = {}
|
1968
|
-
unless zcrmorgtax_instance.id.nil?
|
1969
|
-
orgtax_as_json['id'] = zcrmorgtax_instance.id.to_s
|
1970
|
-
end
|
1971
|
-
unless zcrmorgtax_instance.name.nil?
|
1972
|
-
orgtax_as_json['name'] = zcrmorgtax_instance.name
|
1973
|
-
end
|
1974
|
-
unless zcrmorgtax_instance.display_label.nil?
|
1975
|
-
orgtax_as_json['display_label'] = zcrmorgtax_instance.display_label
|
1976
|
-
end
|
1977
|
-
unless zcrmorgtax_instance.value.nil?
|
1978
|
-
orgtax_as_json['value'] = zcrmorgtax_instance.value
|
1979
|
-
end
|
1980
|
-
unless zcrmorgtax_instance.sequence_number.nil?
|
1981
|
-
orgtax_as_json['sequence_number'] = zcrmorgtax_instance.sequence_number
|
1982
|
-
end
|
1983
|
-
orgtax_as_json
|
1984
|
-
end
|
1985
|
-
|
1986
|
-
def construct_json_from_user_instance(user_instance)
|
1987
|
-
user_info_json = {}
|
1988
|
-
unless user_instance.role.nil?
|
1989
|
-
user_info_json['role'] = user_instance.role.id.to_s
|
1990
|
-
end
|
1991
|
-
unless user_instance.profile.nil?
|
1992
|
-
user_info_json['profile'] = user_instance.profile.id.to_s
|
1993
|
-
end
|
1994
|
-
unless user_instance.country.nil?
|
1995
|
-
user_info_json['country'] = user_instance.country
|
1996
|
-
end
|
1997
|
-
user_info_json['name'] = user_instance.name unless user_instance.name.nil?
|
1998
|
-
user_info_json['city'] = user_instance.city unless user_instance.city.nil?
|
1999
|
-
unless user_instance.signature.nil?
|
2000
|
-
user_info_json['signature'] = user_instance.signature
|
2001
|
-
end
|
2002
|
-
unless user_instance.name_format.nil?
|
2003
|
-
user_info_json['name_format'] = user_instance.name_format
|
2004
|
-
end
|
2005
|
-
unless user_instance.language.nil?
|
2006
|
-
user_info_json['language'] = user_instance.language
|
2007
|
-
end
|
2008
|
-
unless user_instance.locale.nil?
|
2009
|
-
user_info_json['locale'] = user_instance.locale
|
2010
|
-
end
|
2011
|
-
unless user_instance.is_personal_account.nil?
|
2012
|
-
user_info_json['personal_account'] = user_instance.is_personal_account == true
|
2013
|
-
end
|
2014
|
-
unless user_instance.default_tab_group.nil?
|
2015
|
-
user_info_json['default_tab_group'] = user_instance.default_tab_group
|
2016
|
-
end
|
2017
|
-
unless user_instance.street.nil?
|
2018
|
-
user_info_json['street'] = user_instance.street
|
2019
|
-
end
|
2020
|
-
unless user_instance.alias_aka.nil?
|
2021
|
-
user_info_json['alias'] = user_instance.alias_aka
|
2022
|
-
end
|
2023
|
-
unless user_instance.state.nil?
|
2024
|
-
user_info_json['state'] = user_instance.state
|
2025
|
-
end
|
2026
|
-
unless user_instance.country_locale.nil?
|
2027
|
-
user_info_json['country_locale'] = user_instance.country_locale
|
2028
|
-
end
|
2029
|
-
user_info_json['fax'] = user_instance.fax unless user_instance.fax.nil?
|
2030
|
-
unless user_instance.first_name.nil?
|
2031
|
-
user_info_json['first_name'] = user_instance.first_name
|
2032
|
-
end
|
2033
|
-
unless user_instance.email.nil?
|
2034
|
-
user_info_json['email'] = user_instance.email
|
2035
|
-
end
|
2036
|
-
user_info_json['zip'] = user_instance.zip unless user_instance.zip.nil?
|
2037
|
-
unless user_instance.decimal_separator.nil?
|
2038
|
-
user_info_json['decimal_separator'] = user_instance.decimal_separator
|
2039
|
-
end
|
2040
|
-
unless user_instance.reporting_to.nil?
|
2041
|
-
user_info_json['Reporting_To'] = get_reporting_to_as_json(user_instance.reporting_to)
|
2042
|
-
end
|
2043
|
-
unless user_instance.website.nil?
|
2044
|
-
user_info_json['website'] = user_instance.website
|
2045
|
-
end
|
2046
|
-
unless user_instance.time_format.nil?
|
2047
|
-
user_info_json['time_format'] = user_instance.time_format
|
2048
|
-
end
|
2049
|
-
unless user_instance.mobile.nil?
|
2050
|
-
user_info_json['mobile'] = user_instance.mobile
|
2051
|
-
end
|
2052
|
-
unless user_instance.last_name.nil?
|
2053
|
-
user_info_json['last_name'] = user_instance.last_name
|
2054
|
-
end
|
2055
|
-
unless user_instance.time_zone.nil?
|
2056
|
-
user_info_json['time_zone'] = user_instance.time_zone
|
2057
|
-
end
|
2058
|
-
unless user_instance.phone.nil?
|
2059
|
-
user_info_json['phone'] = user_instance.phone
|
2060
|
-
end
|
2061
|
-
user_info_json['dob'] = user_instance.dob unless user_instance.dob.nil?
|
2062
|
-
unless user_instance.date_format.nil?
|
2063
|
-
user_info_json['date_format'] = user_instance.date_format
|
2064
|
-
end
|
2065
|
-
unless user_instance.status.nil?
|
2066
|
-
user_info_json['status'] = user_instance.status
|
2067
|
-
end
|
2068
|
-
custom_fields_data = user_instance.field_apiname_vs_value
|
2069
|
-
unless custom_fields_data.nil?
|
2070
|
-
custom_fields_data.each do |key|
|
2071
|
-
user_info_json[key] = custom_fields_data[key]
|
2072
|
-
end
|
2073
|
-
end
|
2074
|
-
Utility::CommonUtil.create_api_supported_input_json(user_info_json, Utility::APIConstants::USERS)
|
2075
|
-
end
|
2076
|
-
|
2077
|
-
def get_reporting_to_as_json(reporting_to_details)
|
2078
|
-
reporting_to = {}
|
2079
|
-
reporting_to['id'] = reporting_to_details.id
|
2080
|
-
reporting_to
|
2081
|
-
end
|
2082
|
-
|
2083
|
-
def get_zcrm_role(role_details)
|
2084
|
-
role_instance = Operations::ZCRMRole.get_instance(role_details['id'], role_details['name'])
|
2085
|
-
role_instance.display_label = role_details['display_label']
|
2086
|
-
role_instance.description = role_details['description']
|
2087
|
-
unless role_details['forecast_manager'].nil?
|
2088
|
-
role_instance.forecast_manager = Operations::ZCRMUser.get_instance(role_details['forecast_manager']['id'], role_details['forecast_manager']['name'])
|
2089
|
-
end
|
2090
|
-
role_instance.is_admin = role_details['admin_user'] == true
|
2091
|
-
role_instance.is_share_with_peers = role_details['share_with_peers'] == true
|
2092
|
-
if role_details.key?('reporting_to') && !role_details['reporting_to'].nil?
|
2093
|
-
role_instance.reporting_to = Operations::ZCRMUser.get_instance(role_details['reporting_to']['id'], role_details['reporting_to']['name'])
|
2094
|
-
end
|
2095
|
-
role_instance
|
2096
|
-
end
|
2097
|
-
|
2098
|
-
def get_zcrm_profile(profile_details)
|
2099
|
-
profile_instance = Operations::ZCRMProfile.get_instance(profile_details['id'], profile_details['name'])
|
2100
|
-
profile_instance.created_time = profile_details['created_time']
|
2101
|
-
profile_instance.modified_time = profile_details['modified_time']
|
2102
|
-
profile_instance.description = profile_details['description']
|
2103
|
-
profile_instance.category = profile_details['category']
|
2104
|
-
unless profile_details['modified_by'].nil?
|
2105
|
-
profile_instance.modified_by = Operations::ZCRMUser.get_instance(profile_details['modified_by']['id'], profile_details['modified_by']['name'])
|
2106
|
-
end
|
2107
|
-
unless profile_details['created_by'].nil?
|
2108
|
-
profile_instance.created_by = Operations::ZCRMUser.get_instance(profile_details['created_by']['id'], profile_details['created_by']['name'])
|
2109
|
-
end
|
2110
|
-
if profile_details.key?('permissions_details')
|
2111
|
-
permissions = profile_details['permissions_details']
|
2112
|
-
unless permissions.nil?
|
2113
|
-
permissions.each do |permission|
|
2114
|
-
permission_ins = Operations::ZCRMPermission.get_instance(permission['name'], permission['id'])
|
2115
|
-
permission_ins.display_label = permission['display_label']
|
2116
|
-
permission_ins.module_api_name = permission['module']
|
2117
|
-
permission_ins.is_enabled = permission['enabled'] == true
|
2118
|
-
profile_instance.permissions.push(permission_ins)
|
2119
|
-
end
|
2120
|
-
end
|
2121
|
-
end
|
2122
|
-
if profile_details.key?('sections')
|
2123
|
-
sections = profile_details['sections']
|
2124
|
-
unless sections.nil?
|
2125
|
-
sections.each do |section|
|
2126
|
-
profile_section_instance = Operations::ZCRMProfileSection.get_instance(section['name'])
|
2127
|
-
if section.key?('categories')
|
2128
|
-
categories = section['categories']
|
2129
|
-
unless categories.nil?
|
2130
|
-
categories.each do |category|
|
2131
|
-
category_ins = Operations::ZCRMProfileCategory.get_instance(category['name'])
|
2132
|
-
category_ins.display_label = category['display_label']
|
2133
|
-
category_ins.permission_ids = category['permissions_details']
|
2134
|
-
category_ins.module_api_name = category.key?('module') ? category['module'] : nil
|
2135
|
-
profile_section_instance.categories.push(category_ins)
|
2136
|
-
end
|
2137
|
-
end
|
2138
|
-
end
|
2139
|
-
profile_instance.sections.push(profile_section_instance)
|
2140
|
-
end
|
2141
|
-
end
|
2142
|
-
end
|
2143
|
-
profile_instance
|
2144
|
-
end
|
2145
|
-
|
2146
|
-
def get_zcrm_organization(org_details)
|
2147
|
-
org_instance = Org::ZCRMOrganization.get_instance(org_details['company_name'], org_details['id'])
|
2148
|
-
org_instance.alias_aka = org_details['alias']
|
2149
|
-
org_instance.city = org_details['city']
|
2150
|
-
org_instance.country = org_details['country']
|
2151
|
-
org_instance.country_code = org_details['country_code']
|
2152
|
-
org_instance.currency_locale = org_details['currency_locale']
|
2153
|
-
org_instance.currency_symbol = org_details['currency_symbol']
|
2154
|
-
org_instance.currency = org_details['currency']
|
2155
|
-
org_instance.description = org_details['description']
|
2156
|
-
org_instance.employee_count = org_details['employee_count']
|
2157
|
-
org_instance.zia_portal_id = org_details['zia_portal_id']
|
2158
|
-
org_instance.photo_id = org_details['photo_id']
|
2159
|
-
org_instance.fax = org_details['fax']
|
2160
|
-
org_instance.privacy_settings = org_details['privacy_settings']
|
2161
|
-
org_instance.is_gapps_enabled = org_details['gapps_enabled'] == true
|
2162
|
-
org_instance.iso_code = org_details['iso_code']
|
2163
|
-
org_instance.mc_status = org_details['mc_status']
|
2164
|
-
org_instance.mobile = org_details['mobile']
|
2165
|
-
org_instance.phone = org_details['phone']
|
2166
|
-
org_instance.primary_email = org_details['primary_email']
|
2167
|
-
org_instance.primary_zuid = org_details['primary_zuid']
|
2168
|
-
org_instance.state = org_details['state']
|
2169
|
-
org_instance.street = org_details['street']
|
2170
|
-
org_instance.time_zone = org_details['time_zone']
|
2171
|
-
org_instance.website = org_details['website']
|
2172
|
-
org_instance.zgid = org_details['zgid']
|
2173
|
-
org_instance.zip_code = org_details['zip']
|
2174
|
-
unless org_details['license_details'].nil?
|
2175
|
-
license_details = org_details['license_details']
|
2176
|
-
org_instance.is_paid_account = license_details['paid'] == true
|
2177
|
-
org_instance.paid_type = license_details['paid_type']
|
2178
|
-
org_instance.paid_expiry = license_details['paid_expiry']
|
2179
|
-
org_instance.trial_type = license_details['trial_type']
|
2180
|
-
org_instance.trial_expiry = license_details['trial_expiry']
|
2181
|
-
org_instance.users_license_purchased = license_details['users_license_purchased']
|
2182
|
-
end
|
2183
|
-
org_instance
|
2184
|
-
end
|
2185
|
-
|
2186
|
-
def get_zcrm_user(user_details)
|
2187
|
-
user_instance = Operations::ZCRMUser.get_instance(user_details['id'], user_details.key?('name') ? user_details['name'] : nil)
|
2188
|
-
user_instance.is_microsoft = user_details['microsoft'] == true
|
2189
|
-
user_instance.country = user_details.key?('country') ? user_details['country'] : nil
|
2190
|
-
user_instance.role = Operations::ZCRMRole.get_instance(user_details['role']['id'], user_details['role']['name'])
|
2191
|
-
if user_details.key?('customize_info')
|
2192
|
-
user_instance.customize_info = get_zcrm_user_customizeinfo(user_details['customize_info'])
|
2193
|
-
end
|
2194
|
-
user_instance.city = user_details['city']
|
2195
|
-
user_instance.signature = user_details.key?('signature') ? user_details['signature'] : nil
|
2196
|
-
user_instance.name_format = user_details.key?('name_format') ? user_details['name_format'] : nil
|
2197
|
-
user_instance.language = user_details['language']
|
2198
|
-
user_instance.locale = user_details['locale']
|
2199
|
-
user_instance.is_personal_account = user_details.key?('personal_account') ? user_details['personal_account'] == true : nil
|
2200
|
-
user_instance.default_tab_group = user_details.key?('default_tab_group') ? user_details['default_tab_group'] : nil
|
2201
|
-
user_instance.alias_aka = user_details['alias']
|
2202
|
-
user_instance.street = user_details['street']
|
2203
|
-
user_instance.city = user_details['city']
|
2204
|
-
if user_details.key?('theme')
|
2205
|
-
user_instance.theme = get_zcrm_user_theme(user_details['theme'])
|
2206
|
-
end
|
2207
|
-
user_instance.state = user_details['state']
|
2208
|
-
user_instance.country_locale = user_details['country_locale']
|
2209
|
-
user_instance.fax = user_details['fax']
|
2210
|
-
user_instance.first_name = user_details['first_name']
|
2211
|
-
user_instance.email = user_details['email']
|
2212
|
-
user_instance.zip = user_details['zip']
|
2213
|
-
user_instance.decimal_separator = user_details.key?('decimal_separator') ? user_details['decimal_separator'] : nil
|
2214
|
-
user_instance.website = user_details['website']
|
2215
|
-
user_instance.time_format = user_details['time_format']
|
2216
|
-
user_instance.profile = Operations::ZCRMProfile.get_instance(user_details['profile']['id'], user_details['profile']['name'])
|
2217
|
-
user_instance.mobile = user_details['mobile']
|
2218
|
-
user_instance.last_name = user_details['last_name']
|
2219
|
-
user_instance.time_zone = user_details['time_zone']
|
2220
|
-
user_instance.zuid = user_details['zuid']
|
2221
|
-
user_instance.is_confirm = user_details['confirm'] == true
|
2222
|
-
user_instance.full_name = user_details['full_name']
|
2223
|
-
user_instance.phone = user_details['phone']
|
2224
|
-
user_instance.dob = user_details['dob']
|
2225
|
-
user_instance.offset = user_details['offset']
|
2226
|
-
user_instance.date_format = user_details['date_format']
|
2227
|
-
user_instance.status = user_details['status']
|
2228
|
-
if user_details.key?('territories')
|
2229
|
-
user_instance.territories = user_details['territories']
|
2230
|
-
end
|
2231
|
-
if user_details.key?('Reporting_To')
|
2232
|
-
unless user_details['Reporting_To'].nil?
|
2233
|
-
reporting_to = user_details['Reporting_To']
|
2234
|
-
user_instance.reporting_to = Operations::ZCRMUser.get_instance(reporting_to['id'], reporting_to['name'])
|
2235
|
-
end
|
2236
|
-
end
|
2237
|
-
if user_details.key?('Currency')
|
2238
|
-
user_instance.currency = user_details['Currency']
|
2239
|
-
end
|
2240
|
-
created_by = user_details['created_by']
|
2241
|
-
modified_by = user_details['Modified_By']
|
2242
|
-
user_instance.created_by = Operations::ZCRMUser.get_instance(created_by['id'], created_by['name'])
|
2243
|
-
user_instance.modified_by = Operations::ZCRMUser.get_instance(modified_by['id'], modified_by['name'])
|
2244
|
-
user_instance.is_online = user_details['Isonline']
|
2245
|
-
user_instance.created_time = user_details['created_time']
|
2246
|
-
user_instance.modified_time = user_details['Modified_Time']
|
2247
|
-
user_instance
|
2248
|
-
end
|
2249
|
-
end
|
2250
|
-
# THIS CLASS IS USED TO HANDLE TAG RELATED FUNCTIONALITY
|
2251
|
-
class TagAPIHandler < APIHandler
|
2252
|
-
def initialize(module_instance = nil)
|
2253
|
-
@module_instance = module_instance
|
2254
|
-
end
|
2255
|
-
|
2256
|
-
def self.get_instance(module_ins = nil)
|
2257
|
-
TagAPIHandler.new(module_ins)
|
2258
|
-
end
|
2259
|
-
|
2260
|
-
def get_tags
|
2261
|
-
handler_ins = APIHandler.get_instance
|
2262
|
-
handler_ins.request_url_path = 'settings/tags'
|
2263
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2264
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2265
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
2266
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2267
|
-
tags_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::TAG)
|
2268
|
-
tag_list = []
|
2269
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2270
|
-
tags_json.each do |tag_json|
|
2271
|
-
tag_ins = Operations::ZCRMTag.get_instance(tag_json['id'], tag_json['name'])
|
2272
|
-
tag_list.push(tag_helper.get_zcrmtag(tag_ins, tag_json))
|
2273
|
-
end
|
2274
|
-
bulk_api_response.data = tag_list
|
2275
|
-
bulk_api_response
|
2276
|
-
end
|
2277
|
-
|
2278
|
-
def get_tag_count(tag_id)
|
2279
|
-
if tag_id.nil?
|
2280
|
-
raise Utility::ZCRMException.get_instance('get_tag_count', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag id must be given', 'NO TAG ID PROVIDED')
|
2281
|
-
end
|
2282
|
-
|
2283
|
-
handler_ins = APIHandler.get_instance
|
2284
|
-
tag_id = tag_id.to_s
|
2285
|
-
handler_ins.request_url_path = 'settings/tags/' + tag_id + '/actions/records_count'
|
2286
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2287
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2288
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
2289
|
-
api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_api_response
|
2290
|
-
tag_json = api_response.response_json
|
2291
|
-
tag_ins = Operations::ZCRMTag.get_instance(tag_id)
|
2292
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2293
|
-
api_response.data = tag_helper.get_zcrmtag(tag_ins, tag_json)
|
2294
|
-
api_response
|
2295
|
-
end
|
2296
|
-
|
2297
|
-
def create_tags(tag_list)
|
2298
|
-
if tag_list.length > 50
|
2299
|
-
raise Utility::ZCRMException.get_instance('create_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 50', 'MORE TAGS PROVIDED')
|
2300
|
-
end
|
2301
|
-
|
2302
|
-
if tag_list.length < 1
|
2303
|
-
raise Utility::ZCRMException.get_instance('create_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must at least be 1', 'NO TAGS PROVIDED')
|
2304
|
-
end
|
2305
|
-
|
2306
|
-
handler_ins = APIHandler.get_instance
|
2307
|
-
handler_ins.request_url_path = 'settings/tags'
|
2308
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2309
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2310
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
2311
|
-
data_array = []
|
2312
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2313
|
-
tag_list.each do |tag|
|
2314
|
-
if tag.id.nil?
|
2315
|
-
data_array.push(tag_helper.construct_json_for_tag(tag))
|
2316
|
-
else
|
2317
|
-
raise Utility::ZCRMException.get_instance('Tags_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'tag id must be nil', 'TAG ID PROVIDED')
|
2318
|
-
end
|
2319
|
-
end
|
2320
|
-
request_json = {}
|
2321
|
-
request_json[Utility::APIConstants::TAG] = data_array
|
2322
|
-
handler_ins.request_body = request_json
|
2323
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2324
|
-
created_tags = []
|
2325
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
2326
|
-
length = entity_responses.length
|
2327
|
-
length -= 1
|
2328
|
-
(0..length).each do |i|
|
2329
|
-
entity_response_ins = entity_responses[i]
|
2330
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
2331
|
-
|
2332
|
-
tag_create_details = entity_response_ins.details
|
2333
|
-
new_tag = tag_list[i]
|
2334
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2335
|
-
tag_helper.get_zcrmtag(new_tag, tag_create_details)
|
2336
|
-
created_tags.push(new_tag)
|
2337
|
-
entity_response_ins.data = new_tag
|
2338
|
-
end
|
2339
|
-
bulk_api_response.data = created_tags
|
2340
|
-
bulk_api_response
|
2341
|
-
end
|
2342
|
-
|
2343
|
-
def update_tags(tag_list)
|
2344
|
-
if tag_list.length > 50
|
2345
|
-
raise Utility::ZCRMException.get_instance('update_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 50', 'MORE TAGS PROVIDED')
|
2346
|
-
end
|
2347
|
-
|
2348
|
-
if tag_list.length < 1
|
2349
|
-
raise Utility::ZCRMException.get_instance('update_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must at least be 1', 'NO TAGS PROVIDED')
|
2350
|
-
end
|
2351
|
-
|
2352
|
-
handler_ins = APIHandler.get_instance
|
2353
|
-
handler_ins.request_url_path = 'settings/tags'
|
2354
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
2355
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2356
|
-
handler_ins.add_param('module', @module_instance.api_name)
|
2357
|
-
data_array = []
|
2358
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2359
|
-
tag_list.each do |tag|
|
2360
|
-
if !tag.id.nil?
|
2361
|
-
data_array.push(tag_helper.construct_json_for_tag(tag))
|
2362
|
-
else
|
2363
|
-
raise Utility::ZCRMException.get_instance('Tags_update', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'tag id must not be nil', 'TAG ID NOT PROVIDED')
|
2364
|
-
end
|
2365
|
-
end
|
2366
|
-
request_json = {}
|
2367
|
-
request_json[Utility::APIConstants::TAG] = data_array
|
2368
|
-
handler_ins.request_body = request_json
|
2369
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2370
|
-
updated_tags = []
|
2371
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
2372
|
-
length = entity_responses.length
|
2373
|
-
length -= 1
|
2374
|
-
(0..length).each do |i|
|
2375
|
-
entity_response_ins = entity_responses[i]
|
2376
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
2377
|
-
|
2378
|
-
tag_update_details = entity_response_ins.details
|
2379
|
-
new_tag = tag_list[i]
|
2380
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2381
|
-
tag_helper.get_zcrmtag(new_tag, tag_update_details)
|
2382
|
-
updated_tags.push(new_tag)
|
2383
|
-
entity_response_ins.data = new_tag
|
2384
|
-
end
|
2385
|
-
bulk_api_response.data = updated_tags
|
2386
|
-
bulk_api_response
|
2387
|
-
end
|
2388
|
-
|
2389
|
-
def add_tags_to_multiple_records(tag_list, record_list)
|
2390
|
-
if tag_list.length > 50
|
2391
|
-
raise Utility::ZCRMException.get_instance('add_tags_to_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 50', 'MORE TAGS PROVIDED')
|
2392
|
-
end
|
2393
|
-
|
2394
|
-
if tag_list.length < 1
|
2395
|
-
raise Utility::ZCRMException.get_instance('add_tags_to_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must at least be 1', 'NO TAGS PROVIDED')
|
2396
|
-
end
|
2397
|
-
|
2398
|
-
if record_list.length > 100
|
2399
|
-
raise Utility::ZCRMException.get_instance('add_tags_to_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
2400
|
-
end
|
2401
|
-
|
2402
|
-
if record_list.length < 1
|
2403
|
-
raise Utility::ZCRMException.get_instance('add_tags_to_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records must at least be 1', 'NO RECORDS PROVIDED')
|
2404
|
-
end
|
2405
|
-
|
2406
|
-
record_ids_as_string = ''
|
2407
|
-
record_list.each do |record_id|
|
2408
|
-
record_ids_as_string += record_id.to_s + ','
|
2409
|
-
end
|
2410
|
-
handler_ins = APIHandler.get_instance
|
2411
|
-
handler_ins.request_url_path = @module_instance.api_name + '/actions/add_tags'
|
2412
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2413
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::DATA
|
2414
|
-
handler_ins.add_param('ids', record_ids_as_string)
|
2415
|
-
tag_names_as_string = ''
|
2416
|
-
tag_list.each do |tag_name|
|
2417
|
-
tag_names_as_string += tag_name.to_s + ','
|
2418
|
-
end
|
2419
|
-
handler_ins.add_param('tag_names', tag_names_as_string)
|
2420
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2421
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
2422
|
-
length = entity_responses.length
|
2423
|
-
length -= 1
|
2424
|
-
records = []
|
2425
|
-
(0..length).each do |i|
|
2426
|
-
entity_response_ins = entity_responses[i]
|
2427
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
2428
|
-
tag_added_details = entity_response_ins.details
|
2429
|
-
record = Operations::ZCRMRecord.get_instance(@module_instance.api_name, tag_added_details['id'])
|
2430
|
-
tag_added_details['tags'].each do |tag_name|
|
2431
|
-
record.tag_list.push(Operations::ZCRMTag.get_instance(nil, tag_name))
|
2432
|
-
end
|
2433
|
-
records.push(record)
|
2434
|
-
entity_response_ins.data = record
|
2435
|
-
end
|
2436
|
-
bulk_api_response.data = records
|
2437
|
-
bulk_api_response
|
2438
|
-
end
|
2439
|
-
|
2440
|
-
def remove_tags_from_multiple_records(tag_list, record_list)
|
2441
|
-
if tag_list.length > 50
|
2442
|
-
raise Utility::ZCRMException.get_instance('remove_tags_from_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 50', 'MORE TAGS PROVIDED')
|
2443
|
-
end
|
2444
|
-
|
2445
|
-
if tag_list.length < 1
|
2446
|
-
raise Utility::ZCRMException.get_instance('remove_tags_from_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must at least be 1', 'NO TAGS PROVIDED')
|
2447
|
-
end
|
2448
|
-
|
2449
|
-
if record_list.length > 100
|
2450
|
-
raise Utility::ZCRMException.get_instance('remove_tags_from_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records count must be less than or equals to 100', 'MORE RECORDS PROVIDED')
|
2451
|
-
end
|
2452
|
-
|
2453
|
-
if record_list.length < 1
|
2454
|
-
raise Utility::ZCRMException.get_instance('remove_tags_from_multiple_records', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'records must at least be 1', 'NO RECORDS PROVIDED')
|
2455
|
-
end
|
2456
|
-
|
2457
|
-
record_ids_as_string = ''
|
2458
|
-
record_list.each do |record_id|
|
2459
|
-
record_ids_as_string += record_id.to_s + ','
|
2460
|
-
end
|
2461
|
-
|
2462
|
-
handler_ins = APIHandler.get_instance
|
2463
|
-
handler_ins.request_url_path = @module_instance.api_name + '/actions/remove_tags'
|
2464
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2465
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::DATA
|
2466
|
-
handler_ins.add_param('ids', record_ids_as_string)
|
2467
|
-
tag_names_as_string = ''
|
2468
|
-
tag_list.each do |tag_name|
|
2469
|
-
tag_names_as_string += tag_name.to_s + ','
|
2470
|
-
end
|
2471
|
-
|
2472
|
-
handler_ins.add_param('tag_names', tag_names_as_string)
|
2473
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2474
|
-
entity_responses = bulk_api_response.bulk_entity_response
|
2475
|
-
length = entity_responses.length
|
2476
|
-
length -= 1
|
2477
|
-
records = []
|
2478
|
-
(0..length).each do |i|
|
2479
|
-
entity_response_ins = entity_responses[i]
|
2480
|
-
next unless entity_response_ins.status == Utility::APIConstants::STATUS_SUCCESS
|
2481
|
-
|
2482
|
-
tag_added_details = entity_response_ins.details
|
2483
|
-
record = Operations::ZCRMRecord.get_instance(@module_instance.api_name, tag_added_details['id'])
|
2484
|
-
tag_added_details['tags'].each do |tag_name|
|
2485
|
-
record.tag_list.push(Operations::ZCRMTag.get_instance(nil, tag_name))
|
2486
|
-
end
|
2487
|
-
records.push(record)
|
2488
|
-
entity_response_ins.data = record
|
2489
|
-
end
|
2490
|
-
bulk_api_response.data = records
|
2491
|
-
bulk_api_response
|
2492
|
-
end
|
2493
|
-
|
2494
|
-
def add_tags(record, tag_list)
|
2495
|
-
if tag_list.length > 10
|
2496
|
-
raise Utility::ZCRMException.get_instance('add_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 10', 'MORE TAGS PROVIDED')
|
2497
|
-
end
|
2498
|
-
|
2499
|
-
if tag_list.length < 1
|
2500
|
-
raise Utility::ZCRMException.get_instance('add_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must at least be 1', 'NO TAGS PROVIDED')
|
2501
|
-
end
|
2502
|
-
|
2503
|
-
if record.nil? || record.entity_id.nil?
|
2504
|
-
raise Utility::ZCRMException.get_instance('add_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, ' record instance and record id must be given', 'RECORD or RECORD ID NOT PROVIDED')
|
2505
|
-
end
|
2506
|
-
|
2507
|
-
handler_ins = APIHandler.get_instance
|
2508
|
-
handler_ins.request_url_path = record.module_api_name + '/' + record.entity_id + '/actions/add_tags'
|
2509
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2510
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::DATA
|
2511
|
-
tag_names_as_string = ''
|
2512
|
-
tag_list.each do |tag_name|
|
2513
|
-
tag_names_as_string += tag_name.to_s + ','
|
2514
|
-
end
|
2515
|
-
handler_ins.add_param('tag_names', tag_names_as_string)
|
2516
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2517
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
2518
|
-
response_details['tags'].each do |tag_name|
|
2519
|
-
record.tag_list.push(Operations::ZCRMTag.get_instance(nil, tag_name))
|
2520
|
-
end
|
2521
|
-
api_response.data = record
|
2522
|
-
api_response
|
2523
|
-
end
|
2524
|
-
|
2525
|
-
def remove_tags(record, tag_list)
|
2526
|
-
if tag_list.length > 10
|
2527
|
-
raise Utility::ZCRMException.get_instance('remove_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be less than or equals to 10', 'MORE TAGS PROVIDED')
|
2528
|
-
end
|
2529
|
-
|
2530
|
-
if tag_list.length < 1
|
2531
|
-
raise Utility::ZCRMException.get_instance('remove_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'Tag count must be at least 1', 'NO TAGS PROVIDED')
|
2532
|
-
end
|
2533
|
-
|
2534
|
-
if record.nil? || record.entity_id.nil?
|
2535
|
-
raise Utility::ZCRMException.get_instance('remove_tags', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, ' record instance and record id must be given', 'RECORD or RECORD ID NOT PROVIDED')
|
2536
|
-
end
|
2537
|
-
|
2538
|
-
handler_ins = APIHandler.get_instance
|
2539
|
-
handler_ins.request_url_path = record.module_api_name + '/' + record.entity_id + '/actions/remove_tags'
|
2540
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2541
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::DATA
|
2542
|
-
tag_names_as_string = ''
|
2543
|
-
tag_list.each do |tag_name|
|
2544
|
-
tag_names_as_string += tag_name.to_s + ','
|
2545
|
-
end
|
2546
|
-
handler_ins.add_param('tag_names', tag_names_as_string)
|
2547
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2548
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
2549
|
-
response_details['tags'].each do |tag_name|
|
2550
|
-
record.tag_list.push(Operations::ZCRMTag.get_instance(nil, tag_name))
|
2551
|
-
end
|
2552
|
-
api_response.data = record
|
2553
|
-
api_response
|
2554
|
-
end
|
2555
|
-
|
2556
|
-
def delete(tag_id)
|
2557
|
-
if tag_id.nil?
|
2558
|
-
raise Utility::ZCRMException.get_instance('delete', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, ' tag id must be given', 'TAG ID NOT PROVIDED')
|
2559
|
-
end
|
2560
|
-
|
2561
|
-
handler_ins = APIHandler.get_instance
|
2562
|
-
handler_ins.request_url_path = 'settings/tags/' + tag_id.to_s
|
2563
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
2564
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2565
|
-
api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_api_response
|
2566
|
-
api_response
|
2567
|
-
end
|
2568
|
-
|
2569
|
-
def merge(tag_id, merge_tag_id)
|
2570
|
-
if tag_id.nil? || merge_tag_id.nil?
|
2571
|
-
raise Utility::ZCRMException.get_instance('merge', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, ' tag id and merge tag id must be given', 'TAG ID OR MERGE TAG ID NOT PROVIDED')
|
2572
|
-
end
|
2573
|
-
|
2574
|
-
handler_ins = APIHandler.get_instance
|
2575
|
-
handler_ins.request_url_path = 'settings/tags/' + merge_tag_id.to_s + '/actions/merge'
|
2576
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2577
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2578
|
-
tag_json = {}
|
2579
|
-
tag_json['conflict_id'] = tag_id.to_s
|
2580
|
-
handler_ins.request_body = handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(tag_json, Utility::APIConstants::TAG)
|
2581
|
-
api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_api_response
|
2582
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::TAG, 0, 'details')
|
2583
|
-
tag = Operations::ZCRMTag.get_instance(response_details['id'])
|
2584
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2585
|
-
tag_helper.get_zcrmtag(tag, response_details)
|
2586
|
-
api_response.data = tag
|
2587
|
-
api_response
|
2588
|
-
end
|
2589
|
-
|
2590
|
-
def update(tag)
|
2591
|
-
if tag.nil? || tag.id.nil?
|
2592
|
-
raise Utility::ZCRMException.get_instance('update', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'tag instance and tag id must be given', 'TAG INSTANCE OR TAG ID NOT PROVIDED')
|
2593
|
-
end
|
2594
|
-
|
2595
|
-
handler_ins = APIHandler.get_instance
|
2596
|
-
handler_ins.request_url_path = 'settings/tags/' + tag.id.to_s
|
2597
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
2598
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::TAG
|
2599
|
-
handler_ins.add_param('module', tag.module_apiname)
|
2600
|
-
tag_json = {}
|
2601
|
-
tag_json['name'] = tag.name
|
2602
|
-
handler_ins.request_body = handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(tag_json, Utility::APIConstants::TAG)
|
2603
|
-
api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_api_response
|
2604
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::TAG, 0, 'details')
|
2605
|
-
tag_helper = TagAPIHandlerHelper.get_instance
|
2606
|
-
tag_helper.get_zcrmtag(tag, response_details)
|
2607
|
-
api_response.data = tag
|
2608
|
-
api_response
|
2609
|
-
end
|
2610
|
-
end
|
2611
|
-
# THIS CLASS SERVES THE TagAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
2612
|
-
class TagAPIHandlerHelper
|
2613
|
-
def initialize; end
|
2614
|
-
|
2615
|
-
def self.get_instance
|
2616
|
-
TagAPIHandlerHelper.new
|
2617
|
-
end
|
2618
|
-
|
2619
|
-
def get_zcrmtag(tag_ins, tag_details)
|
2620
|
-
tag_details.each do |key, value|
|
2621
|
-
tag_ins.id = value if (key == 'id') && !value.nil?
|
2622
|
-
if (key == 'created_by') && !value.nil?
|
2623
|
-
tag_ins.created_by = Operations::ZCRMUser.get_instance(tag_details['created_by']['id'], tag_details['created_by']['name'])
|
2624
|
-
end
|
2625
|
-
if (key == 'modified_by') && !value.nil?
|
2626
|
-
tag_ins.created_by = Operations::ZCRMUser.get_instance(tag_details['modified_by']['id'], tag_details['modified_by']['name'])
|
2627
|
-
end
|
2628
|
-
if (key == 'created_time') && !value.nil?
|
2629
|
-
tag_ins.created_time = tag_details['created_time']
|
2630
|
-
end
|
2631
|
-
if (key == 'modified_time') && !value.nil?
|
2632
|
-
tag_ins.modified_time = tag_details['modified_time']
|
2633
|
-
end
|
2634
|
-
if (key == 'count') && !value.nil?
|
2635
|
-
tag_ins.count = tag_details['count']
|
2636
|
-
end
|
2637
|
-
end
|
2638
|
-
tag_ins
|
2639
|
-
end
|
2640
|
-
|
2641
|
-
def construct_json_for_tag(zcrmtag)
|
2642
|
-
tag_json = {}
|
2643
|
-
tag_json['id'] = zcrmtag.id unless zcrmtag.id.nil?
|
2644
|
-
tag_json['name'] = zcrmtag.name unless zcrmtag.name.nil?
|
2645
|
-
tag_json
|
2646
|
-
end
|
2647
|
-
end
|
2648
|
-
# THIS CLASS IS USED TO HANDLE RELATED LIST RELATED FUNCTIONALITY
|
2649
|
-
class RelatedListAPIHandler < APIHandler
|
2650
|
-
def initialize(parentrecord, related_list)
|
2651
|
-
@parentrecord = parentrecord
|
2652
|
-
if related_list.instance_of?(Operations::ZCRMModuleRelation)
|
2653
|
-
@related_list = related_list
|
2654
|
-
else
|
2655
|
-
@junction_record = related_list
|
2656
|
-
end
|
2657
|
-
end
|
2658
|
-
|
2659
|
-
def self.get_instance(parentrecord, related_list)
|
2660
|
-
RelatedListAPIHandler.new(parentrecord, related_list)
|
2661
|
-
end
|
2662
|
-
|
2663
|
-
def get_records(sort_by_field, sort_order, page, per_page)
|
2664
|
-
handler_ins = APIHandler.get_instance
|
2665
|
-
handler_ins.request_url_path = ''
|
2666
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2667
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2668
|
-
unless sort_by_field.nil?
|
2669
|
-
handler_ins.add_param('sort_by_field', sort_by_field)
|
2670
|
-
end
|
2671
|
-
|
2672
|
-
handler_ins.add_param('sort_order', sort_order) unless sort_order.nil?
|
2673
|
-
handler_ins.add_param('page', page)
|
2674
|
-
handler_ins.add_param('per_page', per_page)
|
2675
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2676
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2677
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
2678
|
-
entity_helper = EntityAPIHandlerHelper.get_instance
|
2679
|
-
record_ins_list = []
|
2680
|
-
data_arr.each do |record_data|
|
2681
|
-
zcrm_record = Operations::ZCRMRecord.get_instance(@related_list.api_name, record_data['id'])
|
2682
|
-
entity_helper.set_record_properties(zcrm_record, record_data)
|
2683
|
-
record_ins_list.push(zcrm_record)
|
2684
|
-
end
|
2685
|
-
bulk_api_response.data = record_ins_list
|
2686
|
-
bulk_api_response
|
2687
|
-
end
|
2688
|
-
|
2689
|
-
def upload_attachment(file_path)
|
2690
|
-
if file_path.nil?
|
2691
|
-
raise Utility::ZCRMException.get_instance('upload_attachment', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'file path must be given', 'FILEPATH NOT PROVIDED')
|
2692
|
-
end
|
2693
|
-
|
2694
|
-
handler_ins = APIHandler.get_instance
|
2695
|
-
handler_ins.request_url_path = ''
|
2696
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2697
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2698
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2699
|
-
api_response = Request::APIRequest.get_instance(handler_ins).upload_file(file_path)
|
2700
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
2701
|
-
api_response.data = Operations::ZCRMAttachment.get_instance(@parent_record, response_details['id'])
|
2702
|
-
api_response
|
2703
|
-
end
|
2704
|
-
|
2705
|
-
def upload_link_as_attachment(link_url)
|
2706
|
-
if link_url.nil?
|
2707
|
-
raise Utility::ZCRMException.get_instance('upload_link_as_attachment', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'link URL must be given', 'URL_LINK NOT PROVIDED')
|
2708
|
-
end
|
2709
|
-
|
2710
|
-
handler_ins = APIHandler.get_instance
|
2711
|
-
handler_ins.request_url_path = ''
|
2712
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2713
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2714
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2715
|
-
api_response = Request::APIRequest.get_instance(handler_ins).upload_link_as_attachment(link_url)
|
2716
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
2717
|
-
api_response.data = Operations::ZCRMAttachment.get_instance(@parent_record, response_details['id'])
|
2718
|
-
api_response
|
2719
|
-
end
|
2720
|
-
|
2721
|
-
def add_relation
|
2722
|
-
if @junction_record.nil?
|
2723
|
-
raise Utility::ZCRMException.get_instance('add_relation', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'junction_record must be given', 'JUNCTION RECORD NOT PROVIDED')
|
2724
|
-
end
|
2725
|
-
|
2726
|
-
handler_ins = APIHandler.get_instance
|
2727
|
-
handler_ins.request_url_path = ''
|
2728
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
2729
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @junction_record.api_name + '/' + @junction_record.id
|
2730
|
-
data_array = @junction_record.related_data
|
2731
|
-
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(data_array, Utility::APIConstants::DATA)
|
2732
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2733
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2734
|
-
api_response
|
2735
|
-
end
|
2736
|
-
|
2737
|
-
def remove_relation
|
2738
|
-
if @junction_record.nil?
|
2739
|
-
raise Utility::ZCRMException.get_instance('remove_relation', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'junction_record must be given', 'JUNCTION RECORD NOT PROVIDED')
|
2740
|
-
end
|
2741
|
-
|
2742
|
-
handler_ins = APIHandler.get_instance
|
2743
|
-
handler_ins.request_url_path = ''
|
2744
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
2745
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @junction_record.api_name + '/' + @junction_record.id
|
2746
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2747
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2748
|
-
api_response
|
2749
|
-
end
|
2750
|
-
|
2751
|
-
def delete_attachment(attachment_id)
|
2752
|
-
if attachment_id.nil?
|
2753
|
-
raise Utility::ZCRMException.get_instance('delete_attachment', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'attachment id must be given', 'ID IS NOT PROVIDED')
|
2754
|
-
end
|
2755
|
-
|
2756
|
-
handler_ins = APIHandler.get_instance
|
2757
|
-
handler_ins.request_url_path = ''
|
2758
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name + '/' + attachment_id
|
2759
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
2760
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2761
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2762
|
-
api_response
|
2763
|
-
end
|
2764
|
-
|
2765
|
-
def download_attachment(attachment_id)
|
2766
|
-
if attachment_id.nil?
|
2767
|
-
raise Utility::ZCRMException.get_instance('download_attachment', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'attachment id must be given', 'ID IS NOT PROVIDED')
|
2768
|
-
end
|
2769
|
-
|
2770
|
-
handler_ins = APIHandler.get_instance
|
2771
|
-
handler_ins.request_url_path = ''
|
2772
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name + '/' + attachment_id
|
2773
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2774
|
-
api_response = Request::APIRequest.get_instance(handler_ins).download_file
|
2775
|
-
api_response
|
2776
|
-
end
|
2777
|
-
|
2778
|
-
def add_notes(note_instances)
|
2779
|
-
if note_instances.length > 100
|
2780
|
-
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
2781
|
-
end
|
2782
|
-
|
2783
|
-
if note_instances.length < 1
|
2784
|
-
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be at least 1', 'NO NOTES PROVIDED')
|
2785
|
-
end
|
2786
|
-
|
2787
|
-
handler_ins = APIHandler.get_instance
|
2788
|
-
handler_ins.request_url_path = ''
|
2789
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2790
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2791
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2792
|
-
notes_api_helper = RelatedListAPIHandlerHelper.get_instance
|
2793
|
-
data_array = []
|
2794
|
-
note_instances.each do |note_instance|
|
2795
|
-
if note_instance.id.nil?
|
2796
|
-
data_array.push(notes_api_helper.get_zcrmnote_as_json(note_instance))
|
2797
|
-
else
|
2798
|
-
raise Utility::ZCRMException.get_instance('notes_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note id must be nil', 'NOTE ID PROVIDED')
|
2799
|
-
end
|
2800
|
-
end
|
2801
|
-
request_json = {}
|
2802
|
-
request_json[Utility::APIConstants::DATA] = data_array
|
2803
|
-
handler_ins.request_body = request_json
|
2804
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2805
|
-
bulk_api_response
|
2806
|
-
end
|
2807
|
-
|
2808
|
-
def update_note(note_ins)
|
2809
|
-
if note_ins.nil? || note_ins.id.nil?
|
2810
|
-
raise Utility::ZCRMException.get_instance('update_note', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note instance and note id must be given', 'NOTE INSTANCE OR NOTE ID NOT PROVIDED')
|
2811
|
-
end
|
2812
|
-
|
2813
|
-
handler_ins = APIHandler.get_instance
|
2814
|
-
handler_ins.request_url_path = ''
|
2815
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
2816
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name + '/' + note_ins.id
|
2817
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2818
|
-
helper_obj = RelatedListAPIHandlerHelper.get_instance
|
2819
|
-
input_json = helper_obj.get_zcrmnote_as_json(note_ins)
|
2820
|
-
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(input_json, Utility::APIConstants::DATA)
|
2821
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2822
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::DATA, 0, 'details')
|
2823
|
-
api_response.data = helper_obj.get_zcrm_note(response_details, note_ins, @parentrecord)
|
2824
|
-
api_response
|
2825
|
-
end
|
2826
|
-
|
2827
|
-
def delete_note(note_ins)
|
2828
|
-
if note_ins.nil? || note_ins.id.nil?
|
2829
|
-
raise Utility::ZCRMException.get_instance('delete_note', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note instance and note id must be given', 'NOTE INSTANCE OR NOTE ID NOT PROVIDED')
|
2830
|
-
end
|
2831
|
-
|
2832
|
-
handler_ins = APIHandler.get_instance
|
2833
|
-
handler_ins.request_url_path = ''
|
2834
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
2835
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name + '/' + note_ins.id
|
2836
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2837
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
2838
|
-
api_response
|
2839
|
-
end
|
2840
|
-
|
2841
|
-
def get_attachments(page, per_page)
|
2842
|
-
handler_ins = APIHandler.get_instance
|
2843
|
-
handler_ins.request_url_path = ''
|
2844
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2845
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2846
|
-
handler_ins.add_param('page', page)
|
2847
|
-
handler_ins.add_param('per_page', per_page)
|
2848
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2849
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2850
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
2851
|
-
helper_obj = RelatedListAPIHandlerHelper.get_instance
|
2852
|
-
attachment_ins_list = []
|
2853
|
-
data_arr.each do |attachmentdetails|
|
2854
|
-
zcrm_attachment = helper_obj.get_zcrm_attachment(attachmentdetails, @parentrecord)
|
2855
|
-
attachment_ins_list.push(zcrm_attachment)
|
2856
|
-
end
|
2857
|
-
bulk_api_response.data = attachment_ins_list
|
2858
|
-
bulk_api_response
|
2859
|
-
end
|
2860
|
-
|
2861
|
-
def get_notes(sort_by, sort_order, page, per_page)
|
2862
|
-
handler_ins = APIHandler.get_instance
|
2863
|
-
handler_ins.request_url_path = ''
|
2864
|
-
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2865
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
2866
|
-
handler_ins.add_param('sort_by', sort_by) unless sort_by.nil?
|
2867
|
-
handler_ins.add_param('sort_order', sort_order) unless sort_order.nil?
|
2868
|
-
handler_ins.add_param('page', page)
|
2869
|
-
handler_ins.add_param('per_page', per_page)
|
2870
|
-
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2871
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2872
|
-
data_arr = bulk_api_response.response_json[Utility::APIConstants::DATA]
|
2873
|
-
helper_obj = RelatedListAPIHandlerHelper.get_instance
|
2874
|
-
note_ins_list = []
|
2875
|
-
data_arr.each do |notedetails|
|
2876
|
-
zcrm_note = helper_obj.get_zcrm_note(notedetails, nil, @parentrecord)
|
2877
|
-
note_ins_list.push(zcrm_note)
|
2878
|
-
end
|
2879
|
-
bulk_api_response.data = note_ins_list
|
2880
|
-
bulk_api_response
|
2881
|
-
end
|
2882
|
-
end
|
2883
|
-
# THIS CLASS SERVES THE RelatedListAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
2884
|
-
class RelatedListAPIHandlerHelper
|
2885
|
-
def initialize; end
|
2886
|
-
|
2887
|
-
def self.get_instance
|
2888
|
-
RelatedListAPIHandlerHelper.new
|
2889
|
-
end
|
2890
|
-
|
2891
|
-
def get_zcrmnote_as_json(note_ins)
|
2892
|
-
note = {}
|
2893
|
-
note['Note_Title'] = note_ins.title unless note_ins.title.nil?
|
2894
|
-
note['Note_Content'] = note_ins.content
|
2895
|
-
note['Parent_Id'] = note_ins.parent_id unless note_ins.parent_id.nil?
|
2896
|
-
note['se_module'] = note_ins.parent_module unless note_ins.parent_module.nil?
|
2897
|
-
note
|
2898
|
-
end
|
2899
|
-
|
2900
|
-
def get_zcrm_note(note_details, zcrmnote_ins = nil, parentrecord = nil)
|
2901
|
-
if zcrmnote_ins.nil?
|
2902
|
-
zcrmnote_ins = ZCRMSDK::Operations::ZCRMNote.get_instance(parentrecord, note_details['id'])
|
2903
|
-
end
|
2904
|
-
zcrmnote_ins.id = note_details['id']
|
2905
|
-
if note_details.key?('Note_Title')
|
2906
|
-
zcrmnote_ins.title = note_details['Note_Title']
|
2907
|
-
end
|
2908
|
-
if note_details.key?('Note_Content')
|
2909
|
-
zcrmnote_ins.content = note_details['Note_Content']
|
2910
|
-
end
|
2911
|
-
if note_details.key?('Owner')
|
2912
|
-
unless note_details['Owner'].nil?
|
2913
|
-
owner = note_details['Owner']
|
2914
|
-
zcrmnote_ins.owner = ZCRMSDK::Operations::ZCRMUser.get_instance(owner['id'], owner['name'])
|
2915
|
-
end
|
2916
|
-
end
|
2917
|
-
if note_details.key?('Created_By')
|
2918
|
-
unless note_details['Created_By'].nil?
|
2919
|
-
created_by = note_details['Created_By']
|
2920
|
-
zcrmnote_ins.created_by = ZCRMSDK::Operations::ZCRMUser.get_instance(created_by['id'], created_by['name'])
|
2921
|
-
end
|
2922
|
-
end
|
2923
|
-
if note_details.key?('Modified_By')
|
2924
|
-
unless note_details['Modified_By'].nil?
|
2925
|
-
modified_by = note_details['Modified_By']
|
2926
|
-
zcrmnote_ins.modified_by = ZCRMSDK::Operations::ZCRMUser.get_instance(modified_by['id'], modified_by['name'])
|
2927
|
-
end
|
2928
|
-
end
|
2929
|
-
zcrmnote_ins.size = note_details['$size'] if note_details.key?('$size')
|
2930
|
-
if note_details.key?('Created_Time')
|
2931
|
-
zcrmnote_ins.created_time = note_details['Created_Time']
|
2932
|
-
end
|
2933
|
-
if note_details.key?('$editable')
|
2934
|
-
zcrmnote_ins.is_editable = note_details['$editable'] == true
|
2935
|
-
end
|
2936
|
-
if note_details.key?('Modified_Time')
|
2937
|
-
zcrmnote_ins.modified_time = note_details['Modified_Time']
|
2938
|
-
end
|
2939
|
-
if note_details.key?('$voice_note')
|
2940
|
-
zcrmnote_ins.is_voice_note = note_details['$voice_note']
|
2941
|
-
end
|
2942
|
-
if note_details.key?('$se_module')
|
2943
|
-
zcrmnote_ins.parent_module = note_details['$se_module']
|
2944
|
-
end
|
2945
|
-
if note_details.key?('Parent_Id')
|
2946
|
-
unless note_details['Parent_Id'].nil?
|
2947
|
-
parent_details = note_details['Parent_Id']
|
2948
|
-
unless parent_details['id'].nil?
|
2949
|
-
zcrmnote_ins.parent_id = parent_details['id']
|
2950
|
-
end
|
2951
|
-
unless parent_details['name'].nil?
|
2952
|
-
zcrmnote_ins.parent_name = parent_details['name']
|
2953
|
-
end
|
2954
|
-
end
|
2955
|
-
end
|
2956
|
-
zcrmnote_ins.size = note_details['$size'] if note_details.key?('$size')
|
2957
|
-
if note_details.key?('$attachments')
|
2958
|
-
unless note_details['$attachments'].nil?
|
2959
|
-
attachments = note_details['$attachments']
|
2960
|
-
attachment_instants = []
|
2961
|
-
attachments.each do |attachment|
|
2962
|
-
attachment_instants.push(get_zcrm_attachment(attachment, parentrecord))
|
2963
|
-
end
|
2964
|
-
zcrmnote_ins.attachments = attachment_instants
|
2965
|
-
end
|
2966
|
-
end
|
2967
|
-
zcrmnote_ins
|
2968
|
-
end
|
2969
|
-
|
2970
|
-
def get_zcrm_attachment(attachment_details, parent_record)
|
2971
|
-
attachment_ins = ZCRMSDK::Operations::ZCRMAttachment.get_instance(parent_record, attachment_details['id'])
|
2972
|
-
if attachment_details.key?('File_Name')
|
2973
|
-
attachment_ins.file_name = attachment_details['File_Name']
|
2974
|
-
end
|
2975
|
-
if attachment_details.key?('$editable')
|
2976
|
-
attachment_ins.is_editable = attachment_details['$editable'] == true
|
2977
|
-
end
|
2978
|
-
if attachment_details.key?('$file_id')
|
2979
|
-
attachment_ins.file_id = attachment_details['$file_id']
|
2980
|
-
end
|
2981
|
-
if attachment_details.key?('Owner')
|
2982
|
-
unless attachment_details['Owner'].nil?
|
2983
|
-
owner = attachment_details['Owner']
|
2984
|
-
attachment_ins.owner = ZCRMSDK::Operations::ZCRMUser.get_instance(owner['id'], owner['name'])
|
2985
|
-
end
|
2986
|
-
end
|
2987
|
-
if attachment_details.key?('Created_By')
|
2988
|
-
unless attachment_details['Created_By'].nil?
|
2989
|
-
created_by = attachment_details['Created_By']
|
2990
|
-
attachment_ins.created_by = ZCRMSDK::Operations::ZCRMUser.get_instance(created_by['id'], created_by['name'])
|
2991
|
-
end
|
2992
|
-
end
|
2993
|
-
if attachment_details.key?('Modified_By')
|
2994
|
-
unless attachment_details['Modified_By'].nil?
|
2995
|
-
modified_by = attachment_details['Modified_By']
|
2996
|
-
attachment_ins.modified_by = ZCRMSDK::Operations::ZCRMUser.get_instance(modified_by['id'], modified_by['name'])
|
2997
|
-
end
|
2998
|
-
end
|
2999
|
-
if attachment_details.key?('Created_Time')
|
3000
|
-
attachment_ins.created_time = attachment_details['Created_Time']
|
3001
|
-
end
|
3002
|
-
if attachment_details.key?('Modified_Time')
|
3003
|
-
attachment_ins.modified_time = attachment_details['Modified_Time']
|
3004
|
-
end
|
3005
|
-
if attachment_details.key?('$type')
|
3006
|
-
attachment_ins.type = attachment_details['$type']
|
3007
|
-
end
|
3008
|
-
if attachment_details.key?('$se_module')
|
3009
|
-
attachment_ins.parent_module = attachment_details['$se_module']
|
3010
|
-
end
|
3011
|
-
if attachment_details.key?('Parent_Id')
|
3012
|
-
unless attachment_details['Parent_Id'].nil?
|
3013
|
-
parent_details = attachment_details['Parent_Id']
|
3014
|
-
unless parent_details['id'].nil?
|
3015
|
-
attachment_ins.parent_id = parent_details['id']
|
3016
|
-
end
|
3017
|
-
unless parent_details['name'].nil?
|
3018
|
-
attachment_ins.parent_name = parent_details['name']
|
3019
|
-
end
|
3020
|
-
end
|
3021
|
-
end
|
3022
|
-
if attachment_details.key?('Size')
|
3023
|
-
attachment_ins.size = attachment_details['Size']
|
3024
|
-
end
|
3025
|
-
if attachment_details.key?('$link_url')
|
3026
|
-
attachment_ins.link_url = attachment_details['$link_url']
|
3027
|
-
end
|
3028
|
-
attachment_ins
|
3029
|
-
end
|
3030
|
-
end
|
3031
|
-
|
3032
|
-
class VariableAPIHandler < APIHandler
|
3033
|
-
def initialize(variable_ins = nil)
|
3034
|
-
@zcrmvariable = variable_ins
|
3035
|
-
end
|
3036
|
-
|
3037
|
-
def self.get_instance(variable_ins = nil)
|
3038
|
-
VariableAPIHandler.new(variable_ins)
|
3039
|
-
end
|
3040
|
-
|
3041
|
-
def create_variables(variables)
|
3042
|
-
if variables.length > 100
|
3043
|
-
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must be less than or equals to 100', 'MORE VARIABLES PROVIDED')
|
3044
|
-
end
|
3045
|
-
|
3046
|
-
if variables.length < 1
|
3047
|
-
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must at least be 1', 'NO VARIABLES PROVIDED')
|
3048
|
-
end
|
3049
|
-
|
3050
|
-
handler_ins = APIHandler.get_instance
|
3051
|
-
handler_ins.request_url_path = 'settings/variables'
|
3052
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
3053
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3054
|
-
variable_array = []
|
3055
|
-
variable_helper = VariableAPIHandlerHelper.get_instance
|
3056
|
-
variables.each do |variable|
|
3057
|
-
if variable.id.nil?
|
3058
|
-
variable_array.push(variable_helper.get_zcrmvariable_as_json(variable))
|
3059
|
-
else
|
3060
|
-
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable id must be nil', 'VARIABLE ID PROVIDED')
|
3061
|
-
end
|
3062
|
-
end
|
3063
|
-
request_json = {}
|
3064
|
-
request_json[Utility::APIConstants::VARIABLE] = variable_array
|
3065
|
-
handler_ins.request_body = request_json
|
3066
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3067
|
-
bulk_api_response
|
3068
|
-
end
|
3069
|
-
|
3070
|
-
def update_variables(variables)
|
3071
|
-
if variables.length > 100
|
3072
|
-
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must be less than or equals to 100', 'MORE VARIABLES PROVIDED')
|
3073
|
-
end
|
3074
|
-
|
3075
|
-
if variables.length < 1
|
3076
|
-
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must at least be 1', 'NO VARIABLES PROVIDED')
|
3077
|
-
end
|
3078
|
-
|
3079
|
-
handler_ins = APIHandler.get_instance
|
3080
|
-
handler_ins.request_url_path = 'settings/variables'
|
3081
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
3082
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3083
|
-
variable_array = []
|
3084
|
-
variable_helper = VariableAPIHandlerHelper.get_instance
|
3085
|
-
variables.each do |variable|
|
3086
|
-
unless variable.id.nil?
|
3087
|
-
variable_array.push(variable_helper.get_zcrmvariable_as_json(variable))
|
3088
|
-
else
|
3089
|
-
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable id must not be nil', 'VARIABLE ID NOT PROVIDED')
|
3090
|
-
end
|
3091
|
-
end
|
3092
|
-
request_json = {}
|
3093
|
-
request_json[Utility::APIConstants::VARIABLE] = variable_array
|
3094
|
-
handler_ins.request_body = request_json
|
3095
|
-
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3096
|
-
bulk_api_response
|
3097
|
-
end
|
3098
|
-
|
3099
|
-
def get_variable(group_id)
|
3100
|
-
if @zcrmvariable.id.nil?
|
3101
|
-
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3102
|
-
end
|
3103
|
-
|
3104
|
-
if group_id.nil?
|
3105
|
-
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'group should be set for the variable', 'ID IS NOT PROVIDED')
|
3106
|
-
end
|
3107
|
-
|
3108
|
-
handler_ins = APIHandler.get_instance
|
3109
|
-
handler_ins.request_url_path = ''
|
3110
|
-
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3111
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3112
|
-
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3113
|
-
handler_ins.add_param('group',group_id)
|
3114
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3115
|
-
obj = VariableAPIHandlerHelper.get_instance
|
3116
|
-
obj.get_zcrmvariable(@zcrmvariable, api_response.response_json.dig(Utility::APIConstants::VARIABLE, 0))
|
3117
|
-
api_response.data = @zcrmvariable
|
3118
|
-
api_response
|
3119
|
-
end
|
3120
|
-
|
3121
|
-
def update_variable
|
3122
|
-
if @zcrmvariable.id.nil?
|
3123
|
-
raise Utility::ZCRMException.get_instance('update_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3124
|
-
end
|
3125
|
-
|
3126
|
-
handler_ins = APIHandler.get_instance
|
3127
|
-
handler_ins.request_url_path = ''
|
3128
|
-
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3129
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
3130
|
-
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3131
|
-
helper_obj = VariableAPIHandlerHelper.get_instance
|
3132
|
-
input_json = helper_obj.get_zcrmvariable_as_json(@zcrmvariable)
|
3133
|
-
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(input_json, Utility::APIConstants::VARIABLE)
|
3134
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3135
|
-
response_details = api_response.response_json.dig(Utility::APIConstants::VARIABLE, 0, 'details')
|
3136
|
-
@zcrmvariable.id = response_details['id']
|
3137
|
-
api_response.data = @zcrmvariable
|
3138
|
-
api_response
|
3139
|
-
end
|
3140
|
-
|
3141
|
-
def delete_variable
|
3142
|
-
if @zcrmvariable.id.nil?
|
3143
|
-
raise Utility::ZCRMException.get_instance('delete_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3144
|
-
end
|
3145
|
-
|
3146
|
-
handler_ins = APIHandler.get_instance
|
3147
|
-
handler_ins.request_url_path = ''
|
3148
|
-
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3149
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
3150
|
-
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3151
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3152
|
-
api_response
|
3153
|
-
end
|
3154
|
-
|
3155
|
-
def get_variables
|
3156
|
-
handler_ins = APIHandler.get_instance
|
3157
|
-
handler_ins.request_url_path = 'settings/variables'
|
3158
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3159
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3160
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3161
|
-
variables_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::VARIABLE)
|
3162
|
-
variable_list = []
|
3163
|
-
variable_helper = VariableAPIHandlerHelper.get_instance
|
3164
|
-
variables_json.each do |variable_json|
|
3165
|
-
variable_ins = Operations::ZCRMVariable.get_instance(variable_json['api_name'], variable_json['id'])
|
3166
|
-
variable_list.push(variable_helper.get_zcrmvariable(variable_ins, variable_json))
|
3167
|
-
end
|
3168
|
-
bulk_api_response.data = variable_list
|
3169
|
-
bulk_api_response
|
3170
|
-
end
|
3171
|
-
end
|
3172
|
-
|
3173
|
-
class VariableAPIHandlerHelper
|
3174
|
-
def initialize; end
|
3175
|
-
|
3176
|
-
def self.get_instance
|
3177
|
-
VariableAPIHandlerHelper.new
|
3178
|
-
end
|
3179
|
-
|
3180
|
-
def get_zcrmvariable(zcrm_variable_ins, variable_details)
|
3181
|
-
variable_details.each do |key, value|
|
3182
|
-
zcrm_variable_ins.id = value if (key == 'id') && !value.nil?
|
3183
|
-
if (key == 'variable_group') && !value.nil?
|
3184
|
-
zcrm_variable_ins.variable_group = Operations::ZCRMVariableGroup.get_instance(variable_details['variable_group']['api_name'], variable_details['variable_group']['id'])
|
3185
|
-
elsif (key == 'api_name') && !value.nil?
|
3186
|
-
zcrm_variable_ins.api_name = variable_details['api_name']
|
3187
|
-
elsif (key == 'name') && !value.nil?
|
3188
|
-
zcrm_variable_ins.name = variable_details['name']
|
3189
|
-
elsif (key == 'id') && !value.nil?
|
3190
|
-
zcrm_variable_ins.id = variable_details['id']
|
3191
|
-
elsif (key == 'type') && !value.nil?
|
3192
|
-
zcrm_variable_ins.type = variable_details['type']
|
3193
|
-
elsif (key == 'value') && !value.nil?
|
3194
|
-
zcrm_variable_ins.value = variable_details['value']
|
3195
|
-
elsif (key == 'description') && !value.nil?
|
3196
|
-
zcrm_variable_ins.description = variable_details['description']
|
3197
|
-
end
|
3198
|
-
end
|
3199
|
-
zcrm_variable_ins
|
3200
|
-
end
|
3201
|
-
|
3202
|
-
def get_zcrmvariable_as_json(zcrm_variable_ins)
|
3203
|
-
variable_json = {}
|
3204
|
-
variable_json['id'] = zcrm_variable_ins.id unless zcrm_variable_ins.id.nil?
|
3205
|
-
variable_json['name'] = zcrm_variable_ins.name unless zcrm_variable_ins.name.nil?
|
3206
|
-
variable_json['api_name'] = zcrm_variable_ins.api_name unless zcrm_variable_ins.api_name.nil?
|
3207
|
-
variable_json['type'] = zcrm_variable_ins.type unless zcrm_variable_ins.type.nil?
|
3208
|
-
variable_json['value'] = zcrm_variable_ins.value unless zcrm_variable_ins.value.nil?
|
3209
|
-
variable_json['description'] = zcrm_variable_ins.description unless zcrm_variable_ins.description.nil?
|
3210
|
-
unless zcrm_variable_ins.variable_group.nil?
|
3211
|
-
variable_group_json = {}
|
3212
|
-
variable_group_json['id'] = zcrm_variable_ins.variable_group.id unless zcrm_variable_ins.variable_group.nil? || zcrm_variable_ins.variable_group.id.nil?
|
3213
|
-
variable_group_json['api_name'] = zcrm_variable_ins.variable_group.id unless zcrm_variable_ins.variable_group.nil? || zcrm_variable_ins.variable_group.id.nil?
|
3214
|
-
variable_json['variable_group']= variable_group_json
|
3215
|
-
end
|
3216
|
-
variable_json
|
3217
|
-
end
|
3218
|
-
end
|
3219
|
-
|
3220
|
-
class VariableGroupAPIHandler < APIHandler
|
3221
|
-
def initialize(variable_group_ins = nil)
|
3222
|
-
@zcrmvariablegroup = variable_group_ins
|
3223
|
-
end
|
3224
|
-
|
3225
|
-
def self.get_instance(variable_group_ins = nil)
|
3226
|
-
VariableGroupAPIHandler.new(variable_group_ins)
|
3227
|
-
end
|
3228
|
-
|
3229
|
-
def get_variable_group
|
3230
|
-
if @zcrmvariablegroup.id.nil?
|
3231
|
-
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3232
|
-
end
|
3233
|
-
|
3234
|
-
handler_ins = APIHandler.get_instance
|
3235
|
-
handler_ins.request_url_path = ''
|
3236
|
-
handler_ins.request_url_path = 'settings/variable_groups/' + @zcrmvariablegroup.id.to_s
|
3237
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3238
|
-
handler_ins.request_api_key = Utility::APIConstants::VARIABLE_GROUP
|
3239
|
-
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3240
|
-
obj = VariableGroupAPIHandlerHelper.get_instance
|
3241
|
-
obj.get_zcrmvariablegroup(@zcrmvariablegroup, api_response.response_json.dig(Utility::APIConstants::VARIABLE_GROUP, 0))
|
3242
|
-
api_response.data = @zcrmvariablegroup
|
3243
|
-
api_response
|
3244
|
-
end
|
3245
|
-
|
3246
|
-
def get_variable_groups
|
3247
|
-
handler_ins = APIHandler.get_instance
|
3248
|
-
handler_ins.request_url_path = 'settings/variable_groups'
|
3249
|
-
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3250
|
-
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE_GROUP
|
3251
|
-
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3252
|
-
variable_groups_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::VARIABLE_GROUP)
|
3253
|
-
variable_group_list = []
|
3254
|
-
variable_group_helper = VariableGroupAPIHandlerHelper.get_instance
|
3255
|
-
variable_groups_json.each do |variable_group_json|
|
3256
|
-
variable_group_ins = Operations::ZCRMVariableGroup.get_instance(variable_group_json['api_name'], variable_group_json['id'])
|
3257
|
-
variable_group_list.push(variable_group_helper.get_zcrmvariablegroup(variable_group_ins, variable_group_json))
|
3258
|
-
end
|
3259
|
-
bulk_api_response.data = variable_group_list
|
3260
|
-
bulk_api_response
|
3261
|
-
end
|
3262
|
-
end
|
3263
|
-
|
3264
|
-
class VariableGroupAPIHandlerHelper
|
3265
|
-
def initialize; end
|
3266
|
-
|
3267
|
-
def self.get_instance
|
3268
|
-
VariableGroupAPIHandlerHelper.new
|
3269
|
-
end
|
3270
|
-
|
3271
|
-
def get_zcrmvariablegroup(zcrm_variablegroup_ins, variable_group_details)
|
3272
|
-
variable_group_details.each do |key, value|
|
3273
|
-
zcrm_variablegroup_ins.id = value if (key == 'id') && !value.nil?
|
3274
|
-
if (key == 'api_name') && !value.nil?
|
3275
|
-
zcrm_variablegroup_ins.api_name = variable_group_details['api_name']
|
3276
|
-
elsif (key == 'name') && !value.nil?
|
3277
|
-
zcrm_variablegroup_ins.name = variable_group_details['name']
|
3278
|
-
elsif (key == 'id') && !value.nil?
|
3279
|
-
zcrm_variablegroup_ins.id = variable_group_details['id']
|
3280
|
-
elsif (key == 'display_label') && !value.nil?
|
3281
|
-
zcrm_variablegroup_ins.display_label = variable_group_details['display_label']
|
3282
|
-
elsif (key == 'description') && !value.nil?
|
3283
|
-
zcrm_variablegroup_ins.description = variable_group_details['description']
|
3284
|
-
end
|
3285
|
-
end
|
3286
|
-
zcrm_variablegroup_ins
|
3287
|
-
end
|
3288
|
-
end
|
3289
|
-
end
|
3290
|
-
end
|