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
@@ -0,0 +1,167 @@
|
|
1
|
+
require_relative 'converter'
|
2
|
+
require_relative 'stream_wrapper'
|
3
|
+
require_relative 'constants'
|
4
|
+
module Util
|
5
|
+
# This class is to process the upload file and stream.
|
6
|
+
class FormDataConverter < Converter
|
7
|
+
attr_accessor :unique_hash
|
8
|
+
|
9
|
+
def initialize(common_api_handler)
|
10
|
+
@unique_hash = {}
|
11
|
+
|
12
|
+
super(common_api_handler)
|
13
|
+
end
|
14
|
+
|
15
|
+
def append_to_request(request_base, request_object)
|
16
|
+
request_base.set_form(set_file_fody(request_object), Constants::MULTIPART_FORM_DATA) if request_object.is_a?(Hash)
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_file_fody(request_object)
|
20
|
+
data = []
|
21
|
+
request_object.each do |key, value|
|
22
|
+
if value.is_a? Array
|
23
|
+
value.each do |v|
|
24
|
+
if v.is_a? StreamWrapper
|
25
|
+
data.push([key, v.stream, { filename: v.name }])
|
26
|
+
else
|
27
|
+
data.push([key, v])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
elsif value.is_a? StreamWrapper
|
31
|
+
data.push([key, value.stream, { filename: value.name }])
|
32
|
+
else
|
33
|
+
data.push([key, value])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
data
|
37
|
+
end
|
38
|
+
|
39
|
+
def form_request(request_instance, class_path, instance_no, member_json_details = nil)
|
40
|
+
require_relative '../initializer'
|
41
|
+
if @common_api_handler.api_path.include? Constants::PHOTO
|
42
|
+
path = @common_api_handler.api_path.split("/")
|
43
|
+
if path.length == 6
|
44
|
+
module_api_name = path[3].downcase
|
45
|
+
if path[1].downcase == Constants::CRM && path[2].downcase == Constants::API_VERSION && path[5].downcase == Constants::PHOTO && !(Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name)
|
46
|
+
api_supported_module = Utility::api_supported_module
|
47
|
+
if api_supported_module.key?(module_api_name) && api_supported_module[module_api_name].downcase != "custom"
|
48
|
+
raise SDKException.new(Constants::INVALID_MODULE, Constants::PHOTO_UPLOAD_ERROR_MESSAGE)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
package_name = Utility.path_to_package(class_path)
|
54
|
+
class_details = Initializer.json_details[package_name]
|
55
|
+
request_hash = {}
|
56
|
+
|
57
|
+
class_details.each_key do |member_name|
|
58
|
+
member_details = class_details[member_name]
|
59
|
+
if (member_details.key?(Constants::READ_ONLY) && member_details[Constants::READ_ONLY]) || (!member_details.key? Constants::NAME)
|
60
|
+
next
|
61
|
+
end
|
62
|
+
|
63
|
+
begin
|
64
|
+
modified = request_instance.public_send(Constants::IS_KEY_MODIFIED, member_name)
|
65
|
+
rescue StandardError => e
|
66
|
+
raise SDKException.new(nil, Constants::EXCEPTION_IS_KEY_MODIFIED, nil, e)
|
67
|
+
end
|
68
|
+
|
69
|
+
if (modified.nil? || modified.zero?) && member_details.key?(Constants::REQUIRED) && member_details[Constants::REQUIRED]
|
70
|
+
raise SDKException.new(Constants::MANDATORY_KEY_ERROR, Constants::MANDATORY_VALUE_ERROR + member_name)
|
71
|
+
end
|
72
|
+
|
73
|
+
member_data = request_instance.instance_variable_get(Constants::AT + member_name)
|
74
|
+
|
75
|
+
if !modified.nil? && (modified != 0) && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
|
76
|
+
key_name = member_details[Constants::NAME]
|
77
|
+
type = member_details[Constants::TYPE]
|
78
|
+
if type.downcase == Constants::LIST_NAMESPACE.downcase
|
79
|
+
request_hash[key_name] = set_json_array(member_data, member_details)
|
80
|
+
elsif (type.downcase == Constants::MAP_NAMESPACE.downcase) || (type.downcase == Constants::HASH_MAP_NAMESPACE.downcase)
|
81
|
+
request_hash[key_name] = set_json_object(member_data, member_details)
|
82
|
+
elsif member_details.key? Constants::STRUCTURE_NAME
|
83
|
+
request_hash[key_name] = form_request(member_data, member_details[Constants::STRUCTURE_NAME], 1, member_details)
|
84
|
+
else
|
85
|
+
request_hash[key_name] = member_data
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
request_hash
|
91
|
+
end
|
92
|
+
|
93
|
+
def set_json_object(field_value, member_json_details)
|
94
|
+
json_object = {}
|
95
|
+
request_object = field_value
|
96
|
+
|
97
|
+
if member_json_details.nil?
|
98
|
+
request_object.each_pair do |key, value|
|
99
|
+
json_object[key] = redirector_for_object_to_json(value)
|
100
|
+
end
|
101
|
+
else
|
102
|
+
keys_detail = request_object[Constants::KEYS]
|
103
|
+
|
104
|
+
keys_detail.each do |key_detail|
|
105
|
+
key_name = key_detail[Constants::NAME]
|
106
|
+
|
107
|
+
if json_object.key?(key_name) && !json_object[key_name].nil?
|
108
|
+
|
109
|
+
key_value = if key_detail.key? Constants::STRUCTURE_NAME
|
110
|
+
form_request(request_object[key_name], key_detail[Constants::STRUCTURE_NAME], 1, member_json_details)
|
111
|
+
else
|
112
|
+
redirector_for_object_to_json(request_object[key_name])
|
113
|
+
end
|
114
|
+
json_object[key_name] = key_value
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
json_object
|
120
|
+
end
|
121
|
+
|
122
|
+
def set_json_array(member_data, member_json_details)
|
123
|
+
json_array = []
|
124
|
+
|
125
|
+
if member_json_details.nil?
|
126
|
+
|
127
|
+
member_data.each do |value|
|
128
|
+
json_array.push(redirector_for_object_to_json(value))
|
129
|
+
end
|
130
|
+
elsif member_json_details.key? Constants::STRUCTURE_NAME
|
131
|
+
|
132
|
+
instance_count = 0
|
133
|
+
package = member_json_details[Constants::STRUCTURE_NAME]
|
134
|
+
|
135
|
+
member_data.each do |data|
|
136
|
+
instance_count += 1
|
137
|
+
json_array.push(form_request(data, package, instance_count, member_json_details))
|
138
|
+
end
|
139
|
+
else
|
140
|
+
|
141
|
+
member_data.each do |data|
|
142
|
+
json_array.push(redirector_for_object_to_json(data))
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
json_array
|
147
|
+
end
|
148
|
+
|
149
|
+
def redirector_for_object_to_json(request)
|
150
|
+
if request.is_a?(Hash)
|
151
|
+
set_json_object(request, nil)
|
152
|
+
elsif request.is_a?(Array)
|
153
|
+
set_json_array(request, nil)
|
154
|
+
else
|
155
|
+
request
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def get_wrapped_response(response, class_path)
|
160
|
+
nil
|
161
|
+
end
|
162
|
+
|
163
|
+
def get_response(response_object, class_path)
|
164
|
+
nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Util
|
2
|
+
class HeaderParamValidator
|
3
|
+
def validate(header_param, value)
|
4
|
+
name = header_param.name
|
5
|
+
class_name = header_param.class_name
|
6
|
+
json_details = get_json_details
|
7
|
+
split_names = class_name.split(Constants::DOT)
|
8
|
+
structure_name = ''
|
9
|
+
(0..split_names.length - 2).each do |i|
|
10
|
+
changed_class_name = ''
|
11
|
+
camel_case_split = (split_names[i].to_s.split(/([[:upper:]][[:lower:]]+)/)).delete_if(&:empty?)
|
12
|
+
camel_case_split.each_with_index do |each_name, j|
|
13
|
+
changed_class_name += Constants::UNDERSCORE if j.positive?
|
14
|
+
changed_class_name += each_name.to_s.downcase
|
15
|
+
end
|
16
|
+
structure_name += changed_class_name + Constants::DOT
|
17
|
+
end
|
18
|
+
structure_name += split_names[split_names.length - 1]
|
19
|
+
type_detail = []
|
20
|
+
type_detail = get_key_json_details(name, json_details[structure_name]) if json_details.key? structure_name
|
21
|
+
unless type_detail.empty?
|
22
|
+
type = type_detail[Constants::TYPE]
|
23
|
+
if !Utility.check_data_type(value,type)
|
24
|
+
details_jo = {}
|
25
|
+
details_jo[Constants::HEADER_OR_PARAM_NAME] = name
|
26
|
+
details_jo[Constants::ERROR_HASH_CLASS] = class_name
|
27
|
+
details_jo[Constants::ERROR_HASH_EXPECTED_TYPE] = type
|
28
|
+
raise SDKException.new(Constants::TYPE_ERROR, nil, details_jo, nil)
|
29
|
+
else
|
30
|
+
value = Util::DataTypeConverter.post_convert(value, type)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
value
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_json_details
|
37
|
+
json_details = Initializer.json_details
|
38
|
+
if json_details.nil?
|
39
|
+
json_details = JSON.parse(File.open(File.join(File.dirname(File.expand_path(__FILE__)), '../../../../../' + Constants::JSON_DETAILS_FILE_PATH)).read)
|
40
|
+
end
|
41
|
+
json_details
|
42
|
+
rescue StandardError => e
|
43
|
+
raise SDKException.new(nil, Constants::EXCEPTION_JSONDETAILS, nil, e)
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_key_json_details(name, json_details)
|
47
|
+
json_details.each_key do |key|
|
48
|
+
json_detail = json_details[key]
|
49
|
+
if json_detail.key? Constants::NAME
|
50
|
+
return json_detail if name.downcase == json_detail[Constants::NAME].downcase
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,726 @@
|
|
1
|
+
require 'json'
|
2
|
+
require_relative 'converter'
|
3
|
+
require_relative 'constants'
|
4
|
+
module Util
|
5
|
+
class JSONConverter < Converter
|
6
|
+
attr_accessor :unique_hash
|
7
|
+
|
8
|
+
def initialize(common_api_handler)
|
9
|
+
@unique_hash = {}
|
10
|
+
super(common_api_handler)
|
11
|
+
end
|
12
|
+
|
13
|
+
def append_to_request(request_base, request_object)
|
14
|
+
request_object = request_object.to_json
|
15
|
+
request_base.body = request_object.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def form_request(request_instance, pack, instance_number, member_json_details = nil)
|
19
|
+
require_relative '../initializer'
|
20
|
+
|
21
|
+
package_name = Utility.path_to_package(pack)
|
22
|
+
class_detail = Initializer.json_details[package_name]
|
23
|
+
|
24
|
+
if class_detail.key?(Constants::INTERFACE) && !class_detail[Constants::INTERFACE].nil?
|
25
|
+
request_object_class_name = request_instance.class.name
|
26
|
+
request_object_class_name = Utility.path_to_package(request_object_class_name)
|
27
|
+
classes = class_detail[Constants::CLASSES]
|
28
|
+
|
29
|
+
classes.each do |class_name|
|
30
|
+
class_name_lower = class_name.to_s.downcase
|
31
|
+
request_class_path_lower = request_object_class_name.downcase
|
32
|
+
|
33
|
+
if class_name_lower.downcase == request_class_path_lower.downcase
|
34
|
+
class_detail = Initializer.json_details[class_name.to_s]
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
require_relative '../record/record'
|
41
|
+
|
42
|
+
if request_instance.is_a? Record::Record
|
43
|
+
module_api_name = @common_api_handler.module_api_name
|
44
|
+
return_json = is_record_request(request_instance, class_detail, instance_number, member_json_details)
|
45
|
+
@common_api_handler.module_api_name = module_api_name
|
46
|
+
return_json
|
47
|
+
else
|
48
|
+
is_not_record_request(request_instance, class_detail, instance_number, member_json_details)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def is_not_record_request(request_instance, class_detail, instance_number, class_member_details = nil)
|
53
|
+
lookup = false
|
54
|
+
skip_mandatory = false
|
55
|
+
class_member_name = nil
|
56
|
+
unless class_member_details.nil?
|
57
|
+
lookup = (class_member_details.key? Constants::LOOKUP) ? class_member_details[Constants::LOOKUP] : false
|
58
|
+
skip_mandatory = (class_member_details.key? Constants::SKIP_MANDATORY) ? class_member_details[Constants::SKIP_MANDATORY] : false
|
59
|
+
class_member_name = build_name(class_member_details[Constants::NAME])
|
60
|
+
end
|
61
|
+
|
62
|
+
request_json = {}
|
63
|
+
required_keys = {}
|
64
|
+
primary_keys = {}
|
65
|
+
required_in_update_keys = {}
|
66
|
+
|
67
|
+
class_detail.each_key do |member_name|
|
68
|
+
member_detail = class_detail[member_name]
|
69
|
+
|
70
|
+
if (member_detail.key?(Constants::READ_ONLY) && member_detail[Constants::READ_ONLY]) || (!member_detail.key? Constants::NAME)
|
71
|
+
next
|
72
|
+
end
|
73
|
+
|
74
|
+
key_name = member_detail[Constants::NAME]
|
75
|
+
begin
|
76
|
+
modified = request_instance.public_send(Constants::IS_KEY_MODIFIED, key_name)
|
77
|
+
rescue StandardError => e
|
78
|
+
raise SDKException.new(nil, Constants::EXCEPTION_IS_KEY_MODIFIED, nil, e)
|
79
|
+
end
|
80
|
+
|
81
|
+
if member_detail.key?(Constants::REQUIRED) && member_detail[Constants::REQUIRED]
|
82
|
+
required_keys[key_name]=1
|
83
|
+
end
|
84
|
+
|
85
|
+
if member_detail.key?(Constants::REQUIRED_IN_UPDATE) && member_detail[Constants::REQUIRED_IN_UPDATE]
|
86
|
+
required_in_update_keys[key_name]=1
|
87
|
+
end
|
88
|
+
|
89
|
+
if member_detail.key?(Constants::PRIMARY) && member_detail[Constants::PRIMARY] && (!member_detail.key?(Constants::REQUIRED_IN_UPDATE) || member_detail[Constants::REQUIRED])
|
90
|
+
primary_keys[key_name]=1
|
91
|
+
end
|
92
|
+
|
93
|
+
if !modified.nil? && (modified != 0)
|
94
|
+
field_value = request_instance.instance_variable_get(Constants::AT + member_name)
|
95
|
+
|
96
|
+
if value_checker(request_instance.class.name, member_name, member_detail, field_value, @unique_hash, instance_number) == true
|
97
|
+
require_relative '../record/file_details'
|
98
|
+
|
99
|
+
unless field_value.nil?
|
100
|
+
required_keys.delete(key_name)
|
101
|
+
|
102
|
+
primary_keys.delete(key_name)
|
103
|
+
|
104
|
+
required_in_update_keys.delete(key_name)
|
105
|
+
end
|
106
|
+
|
107
|
+
if request_instance.is_a? Record::FileDetails
|
108
|
+
lower_case_key_name = key_name.downcase
|
109
|
+
|
110
|
+
|
111
|
+
request_json[lower_case_key_name] = if field_value.nil?
|
112
|
+
nil
|
113
|
+
else
|
114
|
+
field_value
|
115
|
+
end
|
116
|
+
else
|
117
|
+
request_json[key_name] = set_data(member_detail, field_value)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if skip_mandatory || check_exception(class_member_name, request_instance, instance_number, lookup, required_keys, primary_keys, required_in_update_keys)
|
124
|
+
request_json
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def is_record_request(record_instance, class_detail, instance_number, class_member_details = nil)
|
129
|
+
lookup = false
|
130
|
+
skip_mandatory = false
|
131
|
+
class_member_name = nil
|
132
|
+
unless class_member_details.nil?
|
133
|
+
lookup = (class_member_details.key? Constants::LOOKUP) ? class_member_details[Constants::LOOKUP] : false
|
134
|
+
skip_mandatory = (class_member_details.key? Constants::SKIP_MANDATORY) ? class_member_details[Constants::SKIP_MANDATORY] : false
|
135
|
+
class_member_name = (class_member_details.key? Constants::NAME) ? class_member_details[Constants::NAME] : nil
|
136
|
+
end
|
137
|
+
request_json = {}
|
138
|
+
module_detail = {}
|
139
|
+
module_api_name = @common_api_handler.module_api_name
|
140
|
+
|
141
|
+
if module_api_name.nil?
|
142
|
+
module_detail = class_detail
|
143
|
+
class_detail = Initializer.json_details[Constants::RECORD_NAMESPACE]
|
144
|
+
else
|
145
|
+
|
146
|
+
@common_api_handler.module_api_name = nil
|
147
|
+
full_detail = Utility.search_json_details(module_api_name)
|
148
|
+
|
149
|
+
module_detail = if full_detail.nil?
|
150
|
+
get_module_detail_from_user_spec_json(module_api_name)
|
151
|
+
else
|
152
|
+
full_detail[Constants::MODULEDETAILS]
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
if record_instance.class.superclass == 'Record'
|
157
|
+
end
|
158
|
+
|
159
|
+
key_values = record_instance.instance_variable_get(Constants::AT + Constants::KEY_VALUES)
|
160
|
+
key_modified = record_instance.instance_variable_get(Constants::AT + Constants::KEY_MODIFIED)
|
161
|
+
|
162
|
+
required_keys = {}
|
163
|
+
primary_keys = {}
|
164
|
+
unless skip_mandatory
|
165
|
+
module_detail.each_key do |key_name|
|
166
|
+
key_detail = module_detail[key_name]
|
167
|
+
name = key_detail[Constants::NAME]
|
168
|
+
if key_detail.key?(Constants::REQUIRED) && key_detail[Constants::REQUIRED]
|
169
|
+
required_keys[name]=1
|
170
|
+
end
|
171
|
+
if key_detail.key?(Constants::PRIMARY) && key_detail[Constants::PRIMARY]
|
172
|
+
primary_keys[name]=1
|
173
|
+
end
|
174
|
+
end
|
175
|
+
class_detail.each_key do |key_name|
|
176
|
+
key_detail = class_detail[key_name]
|
177
|
+
name = key_detail[Constants::NAME]
|
178
|
+
if key_detail.key?(Constants::REQUIRED) && key_detail[Constants::REQUIRED]
|
179
|
+
required_keys[name]=1
|
180
|
+
end
|
181
|
+
if key_detail.key?(Constants::PRIMARY) && key_detail[Constants::PRIMARY]
|
182
|
+
primary_keys[name]=1
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
key_modified.each_key do |key_name|
|
188
|
+
next if key_modified[key_name] != 1
|
189
|
+
|
190
|
+
key_detail = {}
|
191
|
+
key_value = key_values[key_name]
|
192
|
+
json_value = nil
|
193
|
+
member_name = build_name(key_name)
|
194
|
+
|
195
|
+
if !module_detail.empty? && (module_detail.key?(member_name) || module_detail.key?(key_name))
|
196
|
+
|
197
|
+
key_detail = if module_detail.key? key_name
|
198
|
+
module_detail[key_name]
|
199
|
+
else
|
200
|
+
module_detail[member_name]
|
201
|
+
end
|
202
|
+
|
203
|
+
elsif class_detail.key? member_name
|
204
|
+
key_detail = class_detail[member_name]
|
205
|
+
end
|
206
|
+
|
207
|
+
unless key_value.nil?
|
208
|
+
required_keys.delete(key_name)
|
209
|
+
primary_keys.delete(key_name)
|
210
|
+
end
|
211
|
+
|
212
|
+
if !key_detail.empty?
|
213
|
+
if (key_detail.key?(Constants::READ_ONLY) && key_detail[Constants::READ_ONLY]) || !(key_detail.key? Constants::NAME)
|
214
|
+
next
|
215
|
+
end
|
216
|
+
|
217
|
+
if value_checker(record_instance.class.name, member_name, key_detail, key_value, @unique_hash, instance_number) == true
|
218
|
+
|
219
|
+
json_value = set_data(key_detail, key_value)
|
220
|
+
end
|
221
|
+
else
|
222
|
+
json_value = redirector_for_object_to_json(key_value)
|
223
|
+
end
|
224
|
+
|
225
|
+
request_json[key_name] = json_value
|
226
|
+
end
|
227
|
+
if skip_mandatory || check_exception(class_member_name, record_instance, instance_number, lookup, required_keys, primary_keys, [])
|
228
|
+
request_json
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def check_exception(class_member_name, request_instance, instance_number, lookup, required_keys, primary_keys, required_in_update_keys = [])
|
233
|
+
if required_in_update_keys.size.positive? && (@common_api_handler.category_method.downcase == Constants::REQUEST_CATEGORY_UPDATE.downcase)
|
234
|
+
error = {}
|
235
|
+
error[Constants::ERROR_HASH_FIELD] = class_member_name
|
236
|
+
error[Constants::TYPE] = request_instance.class.name
|
237
|
+
error[Constants::KEYS] = required_in_update_keys.keys
|
238
|
+
error[Constants::INSTANCE_NUMBER] = instance_number
|
239
|
+
raise SDKException.new(Constants::MANDATORY_VALUE_ERROR, Constants::MANDATORY_KEY_ERROR, error, nil)
|
240
|
+
end
|
241
|
+
|
242
|
+
if !@common_api_handler.mandatory_checker.nil? && @common_api_handler.mandatory_checker
|
243
|
+
|
244
|
+
if @common_api_handler.category_method.downcase == Constants::REQUEST_CATEGORY_CREATE.downcase
|
245
|
+
|
246
|
+
if lookup
|
247
|
+
unless primary_keys.empty?
|
248
|
+
error = {}
|
249
|
+
error[Constants::ERROR_HASH_FIELD] = class_member_name
|
250
|
+
error[Constants::TYPE] = request_instance.class.name
|
251
|
+
error[Constants::KEYS] = primary_keys.keys
|
252
|
+
error[Constants::INSTANCE_NUMBER] = instance_number
|
253
|
+
raise SDKException.new(Constants::MANDATORY_VALUE_ERROR, Constants::PRIMARY_KEY_ERROR, error, nil)
|
254
|
+
end
|
255
|
+
elsif !required_keys.empty?
|
256
|
+
error = {}
|
257
|
+
error[Constants::ERROR_HASH_FIELD] = class_member_name
|
258
|
+
error[Constants::TYPE] = request_instance.class.name
|
259
|
+
error[Constants::KEYS] = required_keys.keys
|
260
|
+
error[Constants::INSTANCE_NUMBER] = instance_number
|
261
|
+
raise SDKException.new(Constants::MANDATORY_VALUE_ERROR, Constants::MANDATORY_KEY_ERROR, error, nil)
|
262
|
+
end
|
263
|
+
|
264
|
+
elsif @common_api_handler.category_method.downcase == Constants::REQUEST_CATEGORY_UPDATE.downcase && !primary_keys.empty?
|
265
|
+
|
266
|
+
error = {}
|
267
|
+
error[Constants::ERROR_HASH_FIELD] = class_member_name
|
268
|
+
error[Constants::TYPE] = request_instance.class.name
|
269
|
+
error[Constants::KEYS] = primary_keys.keys
|
270
|
+
error[Constants::INSTANCE_NUMBER] = instance_number
|
271
|
+
raise SDKException.new(Constants::MANDATORY_VALUE_ERROR, Constants::PRIMARY_KEY_ERROR, error, nil)
|
272
|
+
end
|
273
|
+
|
274
|
+
elsif lookup && (@common_api_handler.category_method.downcase == Constants::REQUEST_CATEGORY_UPDATE.downcase) && !primary_keys.empty?
|
275
|
+
error = {}
|
276
|
+
error[Constants::ERROR_HASH_FIELD] = class_member_name
|
277
|
+
error[Constants::TYPE] = request_instance.class.name
|
278
|
+
error[Constants::KEYS] = primary_keys.keys
|
279
|
+
error[Constants::INSTANCE_NUMBER] = instance_number
|
280
|
+
raise SDKException.new(Constants::MANDATORY_VALUE_ERROR, Constants::PRIMARY_KEY_ERROR, error, nil)
|
281
|
+
end
|
282
|
+
true
|
283
|
+
end
|
284
|
+
|
285
|
+
def set_data(member_detail, field_value)
|
286
|
+
unless field_value.nil?
|
287
|
+
type = member_detail[Constants::TYPE]
|
288
|
+
|
289
|
+
if type.downcase == Constants::LIST_NAMESPACE.downcase
|
290
|
+
return set_json_array(field_value, member_detail)
|
291
|
+
elsif type.downcase == Constants::MAP_NAMESPACE.downcase
|
292
|
+
return set_json_object(field_value, member_detail)
|
293
|
+
elsif (type == Constants::CHOICE_NAMESPACE) || (member_detail.key?(Constants::STRUCTURE_NAME) && (member_detail[Constants::STRUCTURE_NAME] == Constants::CHOICE_NAMESPACE))
|
294
|
+
return field_value.value
|
295
|
+
elsif member_detail.key?(Constants::STRUCTURE_NAME) && member_detail.key?(Constants::MODULE)
|
296
|
+
return is_record_request(field_value, get_module_detail_from_user_spec_json(member_detail[Constants::MODULE]), nil, member_detail)
|
297
|
+
elsif member_detail.key? Constants::STRUCTURE_NAME
|
298
|
+
return form_request(field_value, member_detail[Constants::STRUCTURE_NAME], nil, member_detail)
|
299
|
+
else
|
300
|
+
return DataTypeConverter.post_convert(field_value, type)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
nil
|
305
|
+
end
|
306
|
+
|
307
|
+
def set_json_object(field_value, member_detail)
|
308
|
+
json_object = {}
|
309
|
+
request_object = field_value
|
310
|
+
|
311
|
+
unless request_object.empty?
|
312
|
+
|
313
|
+
if member_detail.nil? || (!member_detail.nil? && !member_detail.key?(Constants::KEYS))
|
314
|
+
|
315
|
+
request_object.each_pair do |key, value|
|
316
|
+
json_object[key] = redirector_for_object_to_json(value)
|
317
|
+
end
|
318
|
+
elsif member_detail.key? Constants::KEYS
|
319
|
+
|
320
|
+
keys_detail = member_detail[Constants::KEYS]
|
321
|
+
|
322
|
+
keys_detail.each do |key_detail|
|
323
|
+
key_value = nil
|
324
|
+
key_name = key_detail[Constants::NAME]
|
325
|
+
|
326
|
+
if request_object.key?(key_name) && !request_object[key_name].nil?
|
327
|
+
key_value = set_data(key_detail, key_value)
|
328
|
+
json_object[key_name] = key_value
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
json_object
|
336
|
+
end
|
337
|
+
|
338
|
+
def set_json_array(field_value, member_detail)
|
339
|
+
json_array = []
|
340
|
+
request_objects = field_value
|
341
|
+
|
342
|
+
unless request_objects.empty?
|
343
|
+
|
344
|
+
if member_detail.nil? || (!member_detail.nil? && !member_detail.key?(Constants::STRUCTURE_NAME))
|
345
|
+
|
346
|
+
request_objects.each do |request|
|
347
|
+
json_array.push(redirector_for_object_to_json(request))
|
348
|
+
end
|
349
|
+
else
|
350
|
+
pack = member_detail[Constants::STRUCTURE_NAME]
|
351
|
+
|
352
|
+
if pack.downcase == Constants::CHOICE_NAMESPACE.downcase
|
353
|
+
|
354
|
+
request_objects.each do |request|
|
355
|
+
json_array.push(request.value)
|
356
|
+
end
|
357
|
+
elsif member_detail.key?(Constants::MODULE) && !member_detail[Constants::MODULE].nil?
|
358
|
+
instance_count = 0
|
359
|
+
request_objects.each do |request|
|
360
|
+
json_array.push(is_record_request(request, get_module_detail_from_user_spec_json(member_detail[Constants::MODULE]), instance_count, member_detail))
|
361
|
+
instance_count += 1
|
362
|
+
end
|
363
|
+
else
|
364
|
+
instance_count = 0
|
365
|
+
|
366
|
+
request_objects.each do |request|
|
367
|
+
json_array.push(form_request(request, pack, instance_count, member_detail))
|
368
|
+
instance_count += 1
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
json_array
|
374
|
+
end
|
375
|
+
|
376
|
+
def redirector_for_object_to_json(request)
|
377
|
+
if request.is_a?(Hash)
|
378
|
+
set_json_object(request, nil)
|
379
|
+
elsif request.is_a?(Array)
|
380
|
+
set_json_array(request, nil)
|
381
|
+
else
|
382
|
+
request
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def get_wrapped_response(response, pack)
|
387
|
+
response_json = JSON.parse(response.body)
|
388
|
+
get_response(response_json, pack)
|
389
|
+
rescue StandardError => e
|
390
|
+
raise e
|
391
|
+
end
|
392
|
+
|
393
|
+
def get_response(response_json, pack)
|
394
|
+
require_relative '../initializer'
|
395
|
+
response_string = response_json.to_s
|
396
|
+
|
397
|
+
return nil if response_string.nil? || response_string.length.zero? || (response_string == 'null')
|
398
|
+
|
399
|
+
unless pack.nil?
|
400
|
+
|
401
|
+
if pack.to_s.include? Constants::DOUBLE_COLON
|
402
|
+
class_path_split = pack.to_s.split(Constants::DOUBLE_COLON)
|
403
|
+
module_name = Utility.classname_to_filename(class_path_split[0])
|
404
|
+
file_name = Utility.classname_to_filename(class_path_split[1])
|
405
|
+
else
|
406
|
+
class_path_split = pack.to_s.split(Constants::DOT)
|
407
|
+
module_name = class_path_split[-2]
|
408
|
+
file_name = Utility.classname_to_filename(class_path_split[-1])
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
require_relative '../' + module_name + '/' + file_name
|
413
|
+
pack = Utility.path_to_package(pack)
|
414
|
+
class_detail = Initializer.json_details[pack.to_s]
|
415
|
+
|
416
|
+
if class_detail.key?(Constants::INTERFACE) && !class_detail[Constants::INTERFACE].nil?
|
417
|
+
classes = class_detail[Constants::CLASSES]
|
418
|
+
instance = find_match(classes, response_json)
|
419
|
+
else
|
420
|
+
|
421
|
+
instance = if pack.is_a? String
|
422
|
+
|
423
|
+
if pack.include? Constants::DOUBLE_COLON
|
424
|
+
Object.const_get(pack).new
|
425
|
+
else
|
426
|
+
Object.const_get(Utility.class_to_load(pack)).new
|
427
|
+
end
|
428
|
+
else
|
429
|
+
Object.const_get(Utility.class_to_load(pack.to_s)).new
|
430
|
+
end
|
431
|
+
|
432
|
+
require_relative '../record/record'
|
433
|
+
|
434
|
+
if instance.is_a? Record::Record
|
435
|
+
module_api_name = @common_api_handler.module_api_name
|
436
|
+
instance = is_record_response(response_json, class_detail, pack)
|
437
|
+
@common_api_handler.module_api_name = module_api_name
|
438
|
+
else
|
439
|
+
instance = not_record_response(instance, response_json, class_detail)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
instance
|
444
|
+
end
|
445
|
+
|
446
|
+
def not_record_response(instance, response_json, class_detail)
|
447
|
+
class_detail.each_key do |member_name|
|
448
|
+
key_detail = class_detail[member_name]
|
449
|
+
key_name = (key_detail[Constants::NAME] if key_detail.key? Constants::NAME)
|
450
|
+
|
451
|
+
if !key_name.nil? && response_json.key?(key_name) && !response_json[key_name].nil?
|
452
|
+
key_data = response_json[key_name]
|
453
|
+
member_value = get_data(key_data, key_detail)
|
454
|
+
instance.instance_variable_set(Constants::AT + member_name, member_value)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
instance
|
459
|
+
end
|
460
|
+
|
461
|
+
def is_record_response(response_json, class_detail, package_name)
|
462
|
+
record_instance = Object.const_get(Utility.class_to_load(package_name)).new
|
463
|
+
module_api_name = @common_api_handler.module_api_name
|
464
|
+
module_detail = {}
|
465
|
+
|
466
|
+
unless module_api_name.nil?
|
467
|
+
@common_api_handler.module_api_name = nil
|
468
|
+
full_detail = Utility.search_json_details(module_api_name)
|
469
|
+
if full_detail.nil?
|
470
|
+
module_detail = get_module_detail_from_user_spec_json(module_api_name)
|
471
|
+
else
|
472
|
+
module_detail = full_detail[Constants::MODULEDETAILS]
|
473
|
+
record_instance = Object.const_get(Utility.class_to_load(full_detail[Constants::MODULEPACKAGENAME])).new
|
474
|
+
end
|
475
|
+
end
|
476
|
+
module_detail = module_detail.merge(class_detail)
|
477
|
+
record_detail = Initializer.json_details[Constants::RECORD_NAMESPACE]
|
478
|
+
|
479
|
+
# superclass check
|
480
|
+
key_values = {}
|
481
|
+
|
482
|
+
response_json.each_key do |key_name|
|
483
|
+
member_name = build_name(key_name)
|
484
|
+
key_detail = {}
|
485
|
+
|
486
|
+
if !module_detail.empty? && (module_detail.key?(member_name) || module_detail.key?(key_name))
|
487
|
+
|
488
|
+
key_detail = if module_detail.key? key_name
|
489
|
+
module_detail[key_name]
|
490
|
+
else
|
491
|
+
module_detail[member_name]
|
492
|
+
end
|
493
|
+
elsif record_detail.key? member_name
|
494
|
+
key_detail = record_detail[member_name]
|
495
|
+
end
|
496
|
+
|
497
|
+
key_data = response_json[key_name]
|
498
|
+
key_value = nil
|
499
|
+
|
500
|
+
if !key_detail.empty?
|
501
|
+
key_name = key_detail[Constants::NAME]
|
502
|
+
key_value = get_data(key_data, key_detail)
|
503
|
+
else
|
504
|
+
key_value = redirector_for_json_to_object(key_data)
|
505
|
+
end
|
506
|
+
|
507
|
+
key_values[key_name] = key_value
|
508
|
+
end
|
509
|
+
|
510
|
+
record_instance.instance_variable_set(Constants::AT + Constants::KEY_VALUES, key_values)
|
511
|
+
record_instance
|
512
|
+
end
|
513
|
+
|
514
|
+
def get_data(key_data, member_detail)
|
515
|
+
member_value = nil
|
516
|
+
|
517
|
+
unless key_data.nil?
|
518
|
+
type = member_detail[Constants::TYPE]
|
519
|
+
|
520
|
+
if type.downcase == Constants::LIST_NAMESPACE.downcase
|
521
|
+
member_value = get_collections_data(key_data, member_detail)
|
522
|
+
elsif type.downcase == Constants::MAP_NAMESPACE.downcase
|
523
|
+
member_value = get_map_data(key_data, member_detail)
|
524
|
+
elsif (type.downcase == Constants::CHOICE_NAMESPACE.downcase) || (member_detail.key?(Constants::STRUCTURE_NAME) && (member_detail[Constants::STRUCTURE_NAME].downcase == Constants::CHOICE_NAMESPACE.downcase))
|
525
|
+
member_value = get_choice_instance(key_data)
|
526
|
+
elsif member_detail.key?(Constants::STRUCTURE_NAME) && member_detail.key?(Constants::MODULE)
|
527
|
+
member_value = is_record_response(key_data, get_module_detail_from_user_spec_json(member_detail[Constants::MODULE]), member_detail[Constants::STRUCTURE_NAME])
|
528
|
+
elsif member_detail.key? Constants::STRUCTURE_NAME
|
529
|
+
member_value = get_response(key_data, member_detail[Constants::STRUCTURE_NAME])
|
530
|
+
else
|
531
|
+
member_value = DataTypeConverter.pre_convert(key_data, type)
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
member_value
|
536
|
+
end
|
537
|
+
|
538
|
+
def get_map_data(response, member_detail)
|
539
|
+
map_instance = {}
|
540
|
+
unless response.empty?
|
541
|
+
|
542
|
+
if member_detail.nil? || (!member_detail.nil? && !member_detail.include?(Constants::KEYS))
|
543
|
+
response.each do |key, value|
|
544
|
+
map_instance[key] = redirector_for_json_to_object(value)
|
545
|
+
end
|
546
|
+
elsif member_detail.key? Constants::KEYS
|
547
|
+
keys_detail = member_detail[Constants::KEYS]
|
548
|
+
|
549
|
+
keys_detail.each do |key_detail|
|
550
|
+
key_name = key_detail[Constants::NAME]
|
551
|
+
|
552
|
+
if response.key?(key_name) && !response[key_name].nil?
|
553
|
+
key_value = get_data(response[key_name], key_detail)
|
554
|
+
map_instance[key_name] = key_value
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
558
|
+
end
|
559
|
+
map_instance
|
560
|
+
end
|
561
|
+
|
562
|
+
def get_collections_data(responses, member_detail)
|
563
|
+
values = []
|
564
|
+
|
565
|
+
unless responses.empty?
|
566
|
+
|
567
|
+
if member_detail.nil? || (!member_detail.nil? && !(member_detail.include? Constants::STRUCTURE_NAME))
|
568
|
+
|
569
|
+
responses.each do |response|
|
570
|
+
values.push(redirector_for_json_to_object(response))
|
571
|
+
end
|
572
|
+
else
|
573
|
+
pack = member_detail[Constants::STRUCTURE_NAME]
|
574
|
+
|
575
|
+
if pack.downcase == Constants::CHOICE_NAMESPACE.downcase
|
576
|
+
|
577
|
+
responses.each do |response|
|
578
|
+
values.push(get_choice_instance(response))
|
579
|
+
end
|
580
|
+
elsif member_detail.key?(Constants::MODULE) && !member_detail[Constants::MODULE].nil?
|
581
|
+
|
582
|
+
responses.each do |response|
|
583
|
+
values.push(is_record_response(response, get_module_detail_from_user_spec_json(member_detail[Constants::MODULE]), pack))
|
584
|
+
end
|
585
|
+
else
|
586
|
+
responses.each do |response|
|
587
|
+
values.push(get_response(response, pack))
|
588
|
+
end
|
589
|
+
end
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
values
|
594
|
+
end
|
595
|
+
|
596
|
+
def get_module_detail_from_user_spec_json(module_name)
|
597
|
+
record_field_details = JSON.parse(File.read(Converter.new(nil).get_record_json_file_path))
|
598
|
+
module_detail = Utility.get_json_object(record_field_details, module_name.downcase)
|
599
|
+
module_detail
|
600
|
+
end
|
601
|
+
|
602
|
+
def redirector_for_json_to_object(key_data)
|
603
|
+
if key_data.is_a? Hash
|
604
|
+
get_map_data(key_data, nil)
|
605
|
+
elsif key_data.is_a? Array
|
606
|
+
get_collections_data(key_data, nil)
|
607
|
+
else
|
608
|
+
key_data
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
def find_match(classes, response_json)
|
613
|
+
pack = ''
|
614
|
+
ratio = 0
|
615
|
+
|
616
|
+
classes.each do |class_name|
|
617
|
+
match_ratio = find_ratio(class_name, response_json)
|
618
|
+
|
619
|
+
if match_ratio == 1.0
|
620
|
+
pack = class_name
|
621
|
+
ratio = 1
|
622
|
+
break
|
623
|
+
elsif match_ratio > ratio
|
624
|
+
ratio = match_ratio
|
625
|
+
pack = class_name.to_s
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
get_response(response_json, pack)
|
630
|
+
end
|
631
|
+
|
632
|
+
def find_ratio(class_name, response_json)
|
633
|
+
require_relative '../initializer'
|
634
|
+
|
635
|
+
class_json_details = Initializer.json_details[class_name]
|
636
|
+
total_points = class_json_details.keys.length
|
637
|
+
matches = 0
|
638
|
+
|
639
|
+
return 0 if total_points.zero?
|
640
|
+
|
641
|
+
class_json_details.each_key do |member_name|
|
642
|
+
member_json_details = class_json_details[member_name.to_s]
|
643
|
+
key_name = nil
|
644
|
+
key_name = member_json_details[Constants::NAME] if member_json_details.key? Constants::NAME
|
645
|
+
|
646
|
+
if !key_name.nil? && response_json.key?(key_name.to_s) && !response_json[key_name].nil?
|
647
|
+
key_data = response_json[key_name]
|
648
|
+
type = key_data.class.name
|
649
|
+
structure_name = nil
|
650
|
+
|
651
|
+
if member_json_details.key? Constants::STRUCTURE_NAME
|
652
|
+
structure_name = member_json_details[Constants::STRUCTURE_NAME]
|
653
|
+
end
|
654
|
+
|
655
|
+
if key_data.is_a? Integer
|
656
|
+
type = Constants::INTEGER
|
657
|
+
elsif key_data.is_a? String
|
658
|
+
type = Constants::STRING
|
659
|
+
elsif key_data.is_a? Float
|
660
|
+
type = Constants::FLOAT
|
661
|
+
elsif [true, false].include? key_data
|
662
|
+
type = Constants::BOOLEAN
|
663
|
+
elsif key_data.is_a? Hash
|
664
|
+
type = Constants::MAP_NAMESPACE
|
665
|
+
elsif key_data.is_a? Array
|
666
|
+
type = Constants::LIST_NAMESPACE
|
667
|
+
end
|
668
|
+
|
669
|
+
if type == member_json_details[Constants::TYPE]
|
670
|
+
matches += 1
|
671
|
+
elsif member_json_details[Constants::TYPE].downcase == Constants::CHOICE_NAMESPACE.downcase
|
672
|
+
member_json_details[Constants::VALUES].each do |value|
|
673
|
+
if value == key_data
|
674
|
+
matches += 1
|
675
|
+
break
|
676
|
+
end
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
if !structure_name.nil? && (structure_name == member_json_details[Constants::TYPE])
|
681
|
+
|
682
|
+
if member_json_details.key? Constants::VALUES
|
683
|
+
|
684
|
+
member_json_details[Constants::VALUES].each do |value|
|
685
|
+
if value == key_data
|
686
|
+
matches += 1
|
687
|
+
break
|
688
|
+
end
|
689
|
+
end
|
690
|
+
else
|
691
|
+
matches += 1
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
matches / total_points.to_f
|
698
|
+
end
|
699
|
+
|
700
|
+
def get_choice_instance(data)
|
701
|
+
class_path_split = Constants::CHOICE_NAMESPACE.split(Constants::DOT)
|
702
|
+
module_name = class_path_split[-2]
|
703
|
+
file_name = Utility.classname_to_filename(class_path_split[-1])
|
704
|
+
require_relative '../' + module_name + '/' + file_name
|
705
|
+
member_value = Object.const_get(Utility.class_to_load(Constants::CHOICE_NAMESPACE)).new(data)
|
706
|
+
member_value
|
707
|
+
end
|
708
|
+
|
709
|
+
def build_name(member_name)
|
710
|
+
sdk_name = ''
|
711
|
+
name_split = member_name.to_s.split('_')
|
712
|
+
sdk_name = name_split[0].to_s.downcase
|
713
|
+
index = 1
|
714
|
+
|
715
|
+
if name_split.length > 1
|
716
|
+
index.upto(name_split.length - 1) do |name_index|
|
717
|
+
if name_split[name_index].length > 1
|
718
|
+
sdk_name += '_' + (name_split[name_index]).to_s.downcase
|
719
|
+
end
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
sdk_name
|
724
|
+
end
|
725
|
+
end
|
726
|
+
end
|