From e90eead537ce3d31074c998f5f5ee83c6ac817e9 Mon Sep 17 00:00:00 2001 From: Elijah Krukowski Date: Thu, 20 Jul 2023 20:10:39 +0300 Subject: [PATCH] Version 8.0.0.rc1 (#28) * v8, first draft * docs for v8 * v8.0.0.rc1 is ready --- .github/workflows/ci.yml | 7 +- .rubocop.yml | 49 +- docs/Gemfile | 2 +- docs/_data/api_items.yml | 4 +- docs/additional_info/changelog.md | 71 ++ docs/additional_info/exception_handling.md | 4 +- docs/additional_info/oauth2.md | 8 +- docs/api/branches.md | 120 ++- docs/api/comments.md | 104 ++- docs/api/contributors.md | 105 ++- docs/api/custom-translation-statuses.md | 179 +++-- docs/api/files.md | 90 ++- docs/api/getting-started.md | 64 +- docs/api/jwt.md | 27 +- docs/api/keys.md | 166 +++- docs/api/languages.md | 158 +++- docs/api/orders.md | 49 +- docs/api/payment-cards.md | 45 +- docs/api/projects.md | 78 +- docs/api/queued-processes.md | 39 + docs/api/screenshots.md | 96 ++- docs/api/segments.md | 61 +- docs/api/snapshots.md | 65 +- docs/api/tasks.md | 110 ++- docs/api/team-user-billing-details.md | 37 +- docs/api/team-user-groups.md | 137 +++- docs/api/team-users.md | 52 +- docs/api/teams.md | 9 +- docs/api/translation-providers.md | 19 +- docs/api/translations.md | 66 +- docs/api/webhooks.md | 114 ++- docs/index.md | 8 +- lib/ruby_lokalise_api.rb | 8 +- lib/ruby_lokalise_api/base_client.rb | 36 +- lib/ruby_lokalise_api/base_request.rb | 73 -- lib/ruby_lokalise_api/client.rb | 33 +- lib/ruby_lokalise_api/collections/base.rb | 167 ++-- lib/ruby_lokalise_api/collections/branch.rb | 15 - lib/ruby_lokalise_api/collections/branches.rb | 11 + .../collections/contributor.rb | 13 - .../collections/contributors.rb | 10 + .../collections/custom_translation_status.rb | 15 - .../custom_translation_statuses.rb | 10 + lib/ruby_lokalise_api/collections/file.rb | 13 - lib/ruby_lokalise_api/collections/files.rb | 10 + lib/ruby_lokalise_api/collections/key.rb | 20 - .../collections/key_comment.rb | 14 - .../collections/key_comments.rb | 11 + lib/ruby_lokalise_api/collections/keys.rb | 10 + lib/ruby_lokalise_api/collections/order.rb | 13 - lib/ruby_lokalise_api/collections/orders.rb | 10 + .../collections/payment_card.rb | 13 - .../collections/payment_cards.rb | 10 + lib/ruby_lokalise_api/collections/project.rb | 13 - .../collections/project_comment.rb | 13 - .../collections/project_comments.rb | 12 + .../collections/project_language.rb | 13 - .../collections/project_languages.rb | 11 + lib/ruby_lokalise_api/collections/projects.rb | 10 + .../collections/queued_process.rb | 15 - .../collections/queued_processes.rb | 11 + .../collections/screenshot.rb | 13 - .../collections/screenshots.rb | 10 + lib/ruby_lokalise_api/collections/segment.rb | 15 - lib/ruby_lokalise_api/collections/segments.rb | 10 + lib/ruby_lokalise_api/collections/snapshot.rb | 13 - .../collections/snapshots.rb | 10 + .../collections/system_language.rb | 13 - .../collections/system_languages.rb | 11 + lib/ruby_lokalise_api/collections/task.rb | 13 - lib/ruby_lokalise_api/collections/tasks.rb | 10 + lib/ruby_lokalise_api/collections/team.rb | 13 - .../collections/team_user.rb | 13 - .../collections/team_user_group.rb | 15 - .../collections/team_user_groups.rb | 11 + .../collections/team_users.rb | 10 + lib/ruby_lokalise_api/collections/teams.rb | 10 + .../collections/translation.rb | 13 - .../collections/translation_provider.rb | 13 - .../collections/translation_providers.rb | 10 + .../collections/translations.rb | 10 + lib/ruby_lokalise_api/collections/webhook.rb | 13 - lib/ruby_lokalise_api/collections/webhooks.rb | 10 + .../concerns/attrs_loadable.rb | 31 + .../concerns/hash_accessible.rb | 16 + .../concerns/unsupportable.rb | 16 + lib/ruby_lokalise_api/connection.rb | 27 +- .../data/collection_attributes.yml | 52 ++ ...attributes.yml => resource_attributes.yml} | 70 +- .../endpoints/base_endpoint.rb | 66 ++ .../endpoints/branches_endpoint.rb | 16 + .../endpoints/contributors_endpoint.rb | 16 + .../custom_translation_statuses_endpoint.rb | 16 + .../endpoints/files_endpoint.rb | 16 + .../endpoints/jwts_endpoint.rb | 15 + .../endpoints/key_comments_endpoint.rb | 17 + .../endpoints/keys_endpoint.rb | 16 + .../endpoints/main_endpoint.rb | 25 + .../endpoints/oauth2/oauth2_endpoint.rb | 33 + .../endpoints/orders_endpoint.rb | 16 + .../endpoints/payment_cards_endpoint.rb | 15 + .../endpoints/project_comments_endpoint.rb | 15 + .../endpoints/project_languages_endpoint.rb | 16 + .../endpoints/projects_endpoint.rb | 15 + .../endpoints/queued_processes_endpoint.rb | 16 + .../endpoints/screenshots_endpoint.rb | 16 + .../endpoints/segments_endpoint.rb | 17 + .../endpoints/snapshots_endpoint.rb | 16 + .../endpoints/system_languages_endpoint.rb | 15 + .../endpoints/tasks_endpoint.rb | 16 + .../team_user_billing_details_endpoint.rb | 15 + .../endpoints/team_user_groups_endpoint.rb | 16 + .../endpoints/team_users_endpoint.rb | 16 + .../endpoints/teams_endpoint.rb | 13 + .../translation_providers_endpoint.rb | 16 + .../endpoints/translations_endpoint.rb | 16 + .../endpoints/webhooks_endpoint.rb | 16 + lib/ruby_lokalise_api/error.rb | 1 + lib/ruby_lokalise_api/generics.rb | 25 + lib/ruby_lokalise_api/json_handler.rb | 3 +- lib/ruby_lokalise_api/oauth2/auth.rb | 72 +- lib/ruby_lokalise_api/oauth2/refresh.rb | 16 - lib/ruby_lokalise_api/oauth2/token.rb | 16 - lib/ruby_lokalise_api/oauth2_client.rb | 3 + lib/ruby_lokalise_api/request.rb | 84 +- lib/ruby_lokalise_api/resources/base.rb | 223 +----- lib/ruby_lokalise_api/resources/branch.rb | 23 +- lib/ruby_lokalise_api/resources/comment.rb | 11 + .../resources/contributor.rb | 10 +- .../resources/custom_translation_status.rb | 14 +- lib/ruby_lokalise_api/resources/file.rb | 18 +- lib/ruby_lokalise_api/resources/jwt.rb | 7 +- lib/ruby_lokalise_api/resources/key.rb | 13 +- .../resources/key_comment.rb | 19 - .../resources/oauth2_refreshed_token.rb | 9 + .../{project_comment.rb => oauth2_token.rb} | 5 +- lib/ruby_lokalise_api/resources/order.rb | 11 +- .../resources/payment_card.rb | 10 +- lib/ruby_lokalise_api/resources/project.rb | 101 ++- .../resources/project_language.rb | 12 +- .../resources/queued_process.rb | 13 +- lib/ruby_lokalise_api/resources/screenshot.rb | 10 +- lib/ruby_lokalise_api/resources/segment.rb | 13 +- lib/ruby_lokalise_api/resources/snapshot.rb | 21 +- .../resources/system_language.rb | 3 +- lib/ruby_lokalise_api/resources/task.rb | 10 +- lib/ruby_lokalise_api/resources/team.rb | 2 + lib/ruby_lokalise_api/resources/team_user.rb | 10 +- .../resources/team_user_billing_details.rb | 15 +- .../resources/team_user_group.rb | 20 +- .../resources/translation.rb | 11 +- .../resources/translation_provider.rb | 11 +- lib/ruby_lokalise_api/resources/webhook.rb | 18 +- lib/ruby_lokalise_api/response.rb | 50 ++ lib/ruby_lokalise_api/rest.rb | 31 + lib/ruby_lokalise_api/rest/branches.rb | 79 +- lib/ruby_lokalise_api/rest/comments.rb | 71 +- lib/ruby_lokalise_api/rest/contributors.rb | 70 +- .../rest/custom_translation_statuses.rb | 96 ++- lib/ruby_lokalise_api/rest/files.rb | 67 +- lib/ruby_lokalise_api/rest/jwt.rb | 15 - lib/ruby_lokalise_api/rest/jwts.rb | 21 + lib/ruby_lokalise_api/rest/keys.rb | 101 ++- lib/ruby_lokalise_api/rest/languages.rb | 85 +- lib/ruby_lokalise_api/rest/orders.rb | 50 +- lib/ruby_lokalise_api/rest/payment_cards.rb | 41 +- lib/ruby_lokalise_api/rest/projects.rb | 87 ++- .../rest/queued_processes.rb | 34 +- lib/ruby_lokalise_api/rest/screenshots.rb | 65 +- lib/ruby_lokalise_api/rest/segments.rb | 49 +- lib/ruby_lokalise_api/rest/snapshots.rb | 48 +- lib/ruby_lokalise_api/rest/tasks.rb | 60 +- .../rest/team_user_billing_details.rb | 45 +- .../rest/team_user_groups.rb | 132 ++-- lib/ruby_lokalise_api/rest/team_users.rb | 53 +- lib/ruby_lokalise_api/rest/teams.rb | 15 +- .../rest/translation_providers.rb | 33 +- lib/ruby_lokalise_api/rest/translations.rb | 43 +- lib/ruby_lokalise_api/rest/webhooks.rb | 84 +- .../utils/attribute_helpers.rb | 86 --- lib/ruby_lokalise_api/utils/attributes.rb | 37 + lib/ruby_lokalise_api/utils/classes.rb | 24 + .../utils/endpoint_helpers.rb | 14 - lib/ruby_lokalise_api/utils/keys.rb | 29 + lib/ruby_lokalise_api/utils/loaders.rb | 24 + lib/ruby_lokalise_api/utils/string_utils.rb | 33 - lib/ruby_lokalise_api/utils/strings.rb | 20 + lib/ruby_lokalise_api/version.rb | 2 +- ruby-lokalise-api.gemspec | 4 +- spec/fixtures/branches/branch.json | 11 + spec/fixtures/branches/branch2.json | 11 + spec/fixtures/branches/branches.json | 30 + .../fixtures/branches/branches_next_page.json | 14 + .../fixtures/branches/branches_paginated.json | 22 + spec/fixtures/branches/create_branch.json | 11 + spec/fixtures/branches/destroy_branch.json | 5 + spec/fixtures/branches/merge_branch.json | 20 + spec/fixtures/branches/update_branch.json | 11 + spec/fixtures/comments/comment.json | 12 + spec/fixtures/comments/comment2.json | 12 + spec/fixtures/comments/comments.json | 32 + .../fixtures/comments/comments_next_page.json | 14 + .../fixtures/comments/comments_paginated.json | 23 + spec/fixtures/comments/destroy_comment.json | 4 + .../comments/multiple_created_comments.json | 23 + spec/fixtures/comments/project_comments.json | 32 + .../comments/project_comments_next_page.json | 14 + .../comments/project_comments_paginated.json | 23 + .../comments/single_created_comment.json | 14 + spec/fixtures/contributors/contributor.json | 52 ++ spec/fixtures/contributors/contributor2.json | 52 ++ spec/fixtures/contributors/contributors.json | 125 +++ .../contributors/contributors_next_page.json | 51 ++ .../contributors/contributors_paginated.json | 78 ++ .../contributors/create_contributor.json | 54 ++ .../contributors/destroy_contributor.json | 4 + .../contributors/update_contributor.json | 52 ++ spec/fixtures/cts/colors.json | 13 + spec/fixtures/cts/create_status.json | 9 + spec/fixtures/cts/destroy_status.json | 5 + spec/fixtures/cts/destroy_status2.json | 5 + spec/fixtures/cts/status.json | 9 + spec/fixtures/cts/statuses.json | 21 + spec/fixtures/cts/update_status.json | 9 + spec/fixtures/cts/update_status2.json | 9 + spec/fixtures/errors/invalid_token.json | 6 + spec/fixtures/errors/not_found.json | 6 + spec/fixtures/files/destroy_file.json | 4 + spec/fixtures/files/doc_files.json | 20 + spec/fixtures/files/download_files.json | 5 + spec/fixtures/files/files.json | 26 + spec/fixtures/files/files_page1.json | 16 + spec/fixtures/files/files_page2.json | 16 + spec/fixtures/files/upload_file.json | 14 + spec/fixtures/files/upload_file_reloaded.json | 29 + spec/fixtures/jwts/create_jwt.json | 3 + spec/fixtures/keys/create_keys.json | 129 ++++ spec/fixtures/keys/destroy_key.json | 6 + spec/fixtures/keys/destroy_keys.json | 6 + spec/fixtures/keys/key.json | 115 +++ spec/fixtures/keys/key2.json | 114 +++ spec/fixtures/keys/keys.json | 178 +++++ spec/fixtures/keys/keys_page1.json | 109 +++ spec/fixtures/keys/keys_page2.json | 75 ++ spec/fixtures/keys/update_key.json | 115 +++ spec/fixtures/keys/update_key2.json | 114 +++ spec/fixtures/keys/update_keys.json | 124 +++ .../languages/create_project_languages.json | 27 + spec/fixtures/languages/destroy_language.json | 5 + spec/fixtures/languages/project_language.json | 14 + .../fixtures/languages/project_languages.json | 52 ++ .../languages/project_languages_page1.json | 30 + .../languages/project_languages_page2.json | 28 + .../languages/system_languages_page1.json | 42 + .../languages/system_languages_page2.json | 38 + .../languages/update_project_language.json | 14 + spec/fixtures/orders/create_order.json | 29 + spec/fixtures/orders/order.json | 29 + spec/fixtures/orders/orders.json | 156 ++++ spec/fixtures/orders/orders_page2.json | 68 ++ spec/fixtures/orders/orders_page3.json | 64 ++ .../payment_cards/create_payment_card.json | 7 + .../payment_cards/destroy_payment_card.json | 4 + spec/fixtures/payment_cards/payment_card.json | 10 + .../fixtures/payment_cards/payment_cards.json | 33 + .../payment_cards/payment_cards_page2.json | 12 + .../payment_cards/payment_cards_page3.json | 12 + spec/fixtures/processes/process.json | 29 + spec/fixtures/processes/processes.json | 26 + spec/fixtures/processes/processes_page1.json | 16 + spec/fixtures/processes/processes_page2.json | 16 + spec/fixtures/projects/create_project.json | 58 ++ spec/fixtures/projects/destroy_project.json | 4 + spec/fixtures/projects/empty_project.json | 4 + spec/fixtures/projects/empty_project2.json | 4 + spec/fixtures/projects/project.json | 76 ++ spec/fixtures/projects/projects.json | 162 ++++ .../fixtures/projects/projects_next_page.json | 138 ++++ spec/fixtures/projects/update_project.json | 76 ++ spec/fixtures/projects/update_project2.json | 64 ++ .../screenshots/create_screenshots.json | 20 + .../screenshots/destroy_screenshot.json | 5 + spec/fixtures/screenshots/screenshot.json | 59 ++ .../{ => screenshots}/screenshot_base64.txt | 0 spec/fixtures/screenshots/screenshots.json | 141 ++++ .../screenshots/screenshots_page1.json | 106 +++ .../screenshots/screenshots_page2.json | 41 + .../screenshots/update_screenshot.json | 62 ++ spec/fixtures/segments/segment.json | 19 + spec/fixtures/segments/segments.json | 77 ++ spec/fixtures/segments/update_segment.json | 19 + spec/fixtures/snapshots/create_snapshot.json | 12 + spec/fixtures/snapshots/destroy_snapshot.json | 5 + spec/fixtures/snapshots/restore_snapshot.json | 83 ++ .../fixtures/snapshots/restore_snapshot2.json | 77 ++ spec/fixtures/snapshots/snapshots.json | 30 + spec/fixtures/snapshots/snapshots_page1.json | 22 + spec/fixtures/snapshots/snapshots_page2.json | 14 + spec/fixtures/tasks/create_task.json | 65 ++ spec/fixtures/tasks/destroy_task.json | 5 + spec/fixtures/tasks/task.json | 70 ++ spec/fixtures/tasks/tasks.json | 186 +++++ spec/fixtures/tasks/tasks_page1.json | 138 ++++ spec/fixtures/tasks/tasks_page2.json | 70 ++ spec/fixtures/tasks/update_task.json | 65 ++ spec/fixtures/tasks/update_task2.json | 70 ++ .../create_billing_details.json | 13 + .../team_user_billing_details.json | 12 + .../update_billing_details.json | 12 + .../add_members_to_group.json | 32 + .../add_projects_to_group.json | 31 + .../create_team_user_group.json | 25 + .../destroy_team_user_group.json | 4 + .../remove_members_from_group.json | 31 + .../remove_projects_from_group.json | 30 + .../team_user_groups/team_user_group.json | 43 ++ .../team_user_groups/team_user_groups.json | 125 +++ .../team_user_groups_page1.json | 79 ++ .../team_user_groups_page2.json | 51 ++ .../update_team_user_group.json | 28 + .../team_users/destroy_team_user.json | 4 + spec/fixtures/team_users/team_user.json | 11 + spec/fixtures/team_users/team_users.json | 61 ++ .../fixtures/team_users/team_users_page1.json | 29 + .../fixtures/team_users/team_users_page2.json | 29 + .../fixtures/team_users/update_team_user.json | 11 + spec/fixtures/teams/teams.json | 118 +++ spec/fixtures/teams/teams_page1.json | 61 ++ spec/fixtures/teams/teams_page2.json | 61 ++ .../translation_provider.json | 36 + .../translation_providers.json | 36 + .../translation_providers_page1.json | 20 + .../translation_providers_page2.json | 20 + spec/fixtures/translations/translation.json | 22 + spec/fixtures/translations/translations.json | 60 ++ .../translations/translations_page3.json | 48 ++ .../translations/translations_page4.json | 42 + .../translations/update_translation.json | 22 + .../add_project_to_group_chained.yml | 52 -- .../vcr_cassettes/add_projects_to_group.yml | 52 -- .../add_user_to_group_chained.yml | 52 -- .../vcr_cassettes/add_users_to_group.yml | 52 -- spec/fixtures/vcr_cassettes/all_branches.yml | 72 -- .../vcr_cassettes/all_branches_pagination.yml | 72 -- spec/fixtures/vcr_cassettes/all_comments.yml | 72 -- .../vcr_cassettes/all_comments_pagination.yml | 69 -- .../vcr_cassettes/all_contributors.yml | 70 -- .../all_contributors_pagination.yml | 69 -- .../vcr_cassettes/all_files_pagination.yml | 67 -- .../vcr_cassettes/all_key_segments.yml | 64 -- .../all_key_segments_pagination.yml | 64 -- spec/fixtures/vcr_cassettes/all_keys.yml | 87 --- spec/fixtures/vcr_cassettes/all_keys_gzip.yml | 72 -- .../vcr_cassettes/all_keys_pagination.yml | 69 -- spec/fixtures/vcr_cassettes/all_orders.yml | 61 -- .../vcr_cassettes/all_orders_pagination.yml | 61 -- .../vcr_cassettes/all_payment_cards.yml | 60 -- .../all_payment_cards_pagination.yml | 60 -- .../vcr_cassettes/all_project_languages.yml | 68 -- .../all_project_languages_pagination.yml | 68 -- spec/fixtures/vcr_cassettes/all_projects.yml | 74 -- .../vcr_cassettes/all_projects_pagination.yml | 68 -- .../vcr_cassettes/all_queued_processes.yml | 64 -- .../vcr_cassettes/all_screenshots.yml | 68 -- .../all_screenshots_pagination.yml | 68 -- spec/fixtures/vcr_cassettes/all_snapshots.yml | 61 -- .../all_snapshots_pagination.yml | 69 -- .../vcr_cassettes/all_system_languages.yml | 125 --- .../all_system_languages_pagination.yml | 75 -- spec/fixtures/vcr_cassettes/all_tasks.yml | 73 -- .../vcr_cassettes/all_tasks_pagination.yml | 68 -- .../all_team_users_pagination.yml | 68 -- .../all_translation_providers.yml | 69 -- .../all_translation_providers_pagination.yml | 64 -- .../all_translation_statuses.yml | 60 -- .../all_translation_statuses_pagination.yml | 60 -- .../all_translations_pagination.yml | 67 -- .../vcr_cassettes/all_webhooks_pagination.yml | 59 -- .../vcr_cassettes/another_key_segment.yml | 61 -- .../vcr_cassettes/another_team_user.yml | 60 -- .../vcr_cassettes/another_team_user_group.yml | 52 -- .../vcr_cassettes/another_translation.yml | 60 -- spec/fixtures/vcr_cassettes/branch.yml | 47 -- spec/fixtures/vcr_cassettes/comment.yml | 53 -- spec/fixtures/vcr_cassettes/contributor.yml | 57 -- .../vcr_cassettes/create_another_branch.yml | 47 -- .../vcr_cassettes/create_another_comment.yml | 61 -- .../create_another_contributor.yml | 60 -- .../vcr_cassettes/create_another_key.yml | 63 -- .../vcr_cassettes/create_another_language.yml | 60 -- .../vcr_cassettes/create_another_project.yml | 60 -- .../create_another_screenshot.yml | 61 -- .../vcr_cassettes/create_another_snapshot.yml | 60 -- .../vcr_cassettes/create_another_task.yml | 61 -- .../create_another_translation_status.yml | 51 -- spec/fixtures/vcr_cassettes/create_branch.yml | 47 -- .../vcr_cassettes/create_branch_to_merge.yml | 47 -- .../vcr_cassettes/create_branch_to_merge2.yml | 47 -- .../vcr_cassettes/create_comments.yml | 63 -- .../vcr_cassettes/create_contributors.yml | 60 -- spec/fixtures/vcr_cassettes/create_keys.yml | 63 -- .../vcr_cassettes/create_keys_collection.yml | 67 -- .../vcr_cassettes/create_languages.yml | 60 -- spec/fixtures/vcr_cassettes/create_order.yml | 54 -- .../vcr_cassettes/create_order_dry_run.yml | 62 -- .../vcr_cassettes/create_screenshots.yml | 61 -- .../vcr_cassettes/create_snapshot.yml | 61 -- .../create_snapshot_for_chained.yml | 60 -- spec/fixtures/vcr_cassettes/create_task.yml | 61 -- .../create_team_user_billing_details.yml | 61 -- .../vcr_cassettes/create_team_user_group.yml | 58 -- .../create_translation_status.yml | 52 -- .../fixtures/vcr_cassettes/create_webhook.yml | 51 -- .../vcr_cassettes/created_team_user_group.yml | 56 -- .../vcr_cassettes/delete_all_keys_chained.yml | 59 -- .../delete_another_translation_status.yml | 51 -- .../fixtures/vcr_cassettes/delete_comment.yml | 59 -- .../vcr_cassettes/delete_comment_chained.yml | 59 -- .../vcr_cassettes/delete_contributor.yml | 59 -- .../delete_contributor_chained.yml | 59 -- spec/fixtures/vcr_cassettes/delete_key.yml | 59 -- .../vcr_cassettes/delete_key_chained.yml | 59 -- spec/fixtures/vcr_cassettes/delete_keys.yml | 59 -- .../vcr_cassettes/delete_language.yml | 59 -- .../vcr_cassettes/delete_language_chained.yml | 59 -- .../fixtures/vcr_cassettes/delete_project.yml | 59 -- .../vcr_cassettes/delete_project_chained.yml | 59 -- .../vcr_cassettes/delete_restored_project.yml | 58 -- .../vcr_cassettes/delete_screenshot.yml | 59 -- .../delete_screenshot_chained.yml | 59 -- .../vcr_cassettes/delete_snapshot.yml | 59 -- .../vcr_cassettes/delete_snapshot_chained.yml | 59 -- spec/fixtures/vcr_cassettes/delete_task.yml | 59 -- .../vcr_cassettes/delete_task_chained.yml | 59 -- .../vcr_cassettes/delete_team_user.yml | 59 -- .../delete_team_user_chained.yml | 59 -- .../vcr_cassettes/destroy_another_branch.yml | 46 -- .../destroy_another_team_user_group.yml | 51 -- .../fixtures/vcr_cassettes/destroy_branch.yml | 46 -- spec/fixtures/vcr_cassettes/destroy_file.yml | 67 -- .../vcr_cassettes/destroy_payment_card.yml | 51 -- .../vcr_cassettes/destroy_team_user_group.yml | 51 -- .../destroy_translation_status.yml | 51 -- .../vcr_cassettes/destroy_webhook.yml | 51 -- .../fixtures/vcr_cassettes/download_files.yml | 59 -- spec/fixtures/vcr_cassettes/empty_project.yml | 59 -- .../vcr_cassettes/empty_project_chained.yml | 59 -- .../vcr_cassettes/error_invalid_token.yml | 53 -- .../vcr_cassettes/error_not_found.yml | 55 -- .../vcr_cassettes/error_unknown_code.yml | 53 -- spec/fixtures/vcr_cassettes/files.yml | 75 -- spec/fixtures/vcr_cassettes/jwt.yml | 67 -- spec/fixtures/vcr_cassettes/key.yml | 70 -- spec/fixtures/vcr_cassettes/key_segment.yml | 59 -- .../vcr_cassettes/key_segment_params.yml | 59 -- spec/fixtures/vcr_cassettes/language.yml | 59 -- spec/fixtures/vcr_cassettes/merge_branch.yml | 47 -- .../vcr_cassettes/merge_branch_chained.yml | 47 -- .../vcr_cassettes/new_payment_card.yml | 52 -- spec/fixtures/vcr_cassettes/new_project.yml | 60 -- .../vcr_cassettes/oauth2/new_project.yml | 66 -- .../fixtures/vcr_cassettes/oauth2/refresh.yml | 52 -- .../vcr_cassettes/oauth2/refresh_error.yml | 47 -- spec/fixtures/vcr_cassettes/oauth2/token.yml | 51 -- .../vcr_cassettes/oauth2/token_error.yml | 48 -- spec/fixtures/vcr_cassettes/order.yml | 59 -- spec/fixtures/vcr_cassettes/payment_card.yml | 52 -- spec/fixtures/vcr_cassettes/project.yml | 52 -- .../vcr_cassettes/project_comments.yml | 72 -- .../fixtures/vcr_cassettes/queued_process.yml | 57 -- .../regenerate_webhook_secret.yml | 56 -- .../regenerate_webhook_secret_2.yml | 56 -- .../vcr_cassettes/reload_key_segment.yml | 59 -- .../remove_project_from_group_chained.yml | 52 -- .../remove_projects_from_group.yml | 52 -- .../remove_user_from_group_chained.yml | 52 -- .../vcr_cassettes/remove_users_from_group.yml | 52 -- .../vcr_cassettes/restore_snapshot.yml | 60 -- .../restore_snapshot_chained.yml | 60 -- .../restore_snapshot_for_chained.yml | 58 -- .../restored_updated_project.yml | 60 -- spec/fixtures/vcr_cassettes/screenshot.yml | 60 -- spec/fixtures/vcr_cassettes/task.yml | 70 -- spec/fixtures/vcr_cassettes/team_user.yml | 64 -- .../team_user_billing_details.yml | 60 -- .../vcr_cassettes/team_user_group.yml | 52 -- .../vcr_cassettes/team_user_groups.yml | 62 -- .../team_user_groups_pagination.yml | 60 -- spec/fixtures/vcr_cassettes/team_users.yml | 71 -- spec/fixtures/vcr_cassettes/teams.yml | 60 -- spec/fixtures/vcr_cassettes/translation.yml | 58 -- .../vcr_cassettes/translation_provider.yml | 303 -------- .../vcr_cassettes/translation_status.yml | 51 -- .../translation_status_colors.yml | 51 -- spec/fixtures/vcr_cassettes/translations.yml | 76 -- .../vcr_cassettes/translations_next_page.yml | 65 -- .../vcr_cassettes/translations_prev_page.yml | 66 -- .../vcr_cassettes/update_another_branch.yml | 47 -- .../update_another_team_user_group.yml | 52 -- .../update_another_translation_status.yml | 52 -- spec/fixtures/vcr_cassettes/update_branch.yml | 47 -- .../vcr_cassettes/update_contributor.yml | 60 -- .../update_contributor_chained.yml | 60 -- spec/fixtures/vcr_cassettes/update_key.yml | 64 -- .../vcr_cassettes/update_key_chained.yml | 63 -- .../vcr_cassettes/update_key_segment.yml | 63 -- .../update_key_segment_chained.yml | 63 -- spec/fixtures/vcr_cassettes/update_keys.yml | 72 -- .../vcr_cassettes/update_language.yml | 60 -- .../vcr_cassettes/update_language_chained.yml | 59 -- .../fixtures/vcr_cassettes/update_project.yml | 61 -- .../vcr_cassettes/update_project_chained.yml | 60 -- .../vcr_cassettes/update_screenshot.yml | 60 -- .../update_screenshot_chained.yml | 59 -- spec/fixtures/vcr_cassettes/update_task.yml | 62 -- .../vcr_cassettes/update_task_chained.yml | 61 -- .../vcr_cassettes/update_team_user.yml | 60 -- .../update_team_user_billing_details.yml | 62 -- .../update_team_user_chained.yml | 60 -- .../vcr_cassettes/update_team_user_group.yml | 52 -- .../vcr_cassettes/update_translation.yml | 61 -- .../update_translation_chained.yml | 61 -- .../update_translation_status.yml | 52 -- .../fixtures/vcr_cassettes/update_webhook.yml | 51 -- spec/fixtures/vcr_cassettes/upload_file.yml | 52 -- .../upload_file_queued_reload.yml | 56 -- .../vcr_cassettes/upload_file_status.yml | 56 -- spec/fixtures/vcr_cassettes/webhook.yml | 51 -- spec/fixtures/vcr_cassettes/webhook_2.yml | 56 -- spec/fixtures/vcr_cassettes/webhooks.yml | 59 -- spec/fixtures/webhooks/create_webhook.json | 14 + spec/fixtures/webhooks/destroy_webhook.json | 4 + .../webhooks/regenerate_webhook_secret.json | 4 + spec/fixtures/webhooks/update_webhook.json | 13 + spec/fixtures/webhooks/webhook.json | 27 + spec/fixtures/webhooks/webhooks.json | 49 ++ spec/fixtures/webhooks/webhooks_page1.json | 39 + spec/fixtures/webhooks/webhooks_page2.json | 15 + .../ruby_lokalise_api/client/branches_spec.rb | 152 ---- .../ruby_lokalise_api/client/comments_spec.rb | 118 --- .../client/contributors_spec.rb | 132 ---- .../custom_translation_statuses_spec.rb | 131 ---- .../ruby_lokalise_api/client/files_spec.rb | 77 -- spec/lib/ruby_lokalise_api/client/jwt_spec.rb | 14 - .../lib/ruby_lokalise_api/client/keys_spec.rb | 199 ----- .../client/languages_spec.rb | 134 ---- .../ruby_lokalise_api/client/orders_spec.rb | 113 --- .../client/payment_cards_spec.rb | 92 --- .../ruby_lokalise_api/client/projects_spec.rb | 150 ---- .../client/queued_processes_spec.rb | 57 -- .../client/screenshots_spec.rb | 127 --- .../ruby_lokalise_api/client/segments_spec.rb | 106 --- .../client/snapshots_spec.rb | 117 --- .../ruby_lokalise_api/client/tasks_spec.rb | 145 ---- .../client/team_user_billing_details_spec.rb | 48 -- .../client/team_user_groups_spec.rb | 278 ------- .../client/team_users_spec.rb | 95 --- .../ruby_lokalise_api/client/teams_spec.rb | 25 - .../client/translation_providers_spec.rb | 48 -- .../client/translations_spec.rb | 118 --- .../ruby_lokalise_api/client/webhooks_spec.rb | 126 --- spec/lib/ruby_lokalise_api/client_spec.rb | 39 + .../collections/branches_spec.rb | 52 ++ .../collections/contributors_spec.rb | 52 ++ .../collections/files_spec.rb | 49 ++ .../collections/key_comments_spec.rb | 53 ++ .../collections/keys_spec.rb | 49 ++ .../collections/orders_spec.rb | 53 ++ .../collections/payment_cards_spec.rb | 51 ++ .../collections/project_comments_spec.rb | 52 ++ .../collections/project_languages_spec.rb | 53 ++ .../collections/projects_spec.rb | 116 +++ .../collections/queued_processes_spec.rb | 48 ++ .../collections/screenshots_spec.rb | 53 ++ .../collections/snapshots_spec.rb | 53 ++ .../collections/tasks_spec.rb | 53 ++ .../collections/team_user_groups_spec.rb | 53 ++ .../collections/team_users_spec.rb | 53 ++ .../collections/teams_spec.rb | 51 ++ .../collections/translation_providers_spec.rb | 53 ++ .../collections/translations_spec.rb | 53 ++ .../collections/webhooks_spec.rb | 53 ++ spec/lib/ruby_lokalise_api/connection_spec.rb | 47 +- .../custom_json_parser_spec.rb | 81 -- .../endpoints/base_endpoint_spec.rb | 15 + spec/lib/ruby_lokalise_api/error_spec.rb | 33 - spec/lib/ruby_lokalise_api/generics_spec.rb | 20 + .../lib/ruby_lokalise_api/oauth2/auth_spec.rb | 121 +-- .../ruby_lokalise_api/oauth2_client_spec.rb | 24 + .../ruby_lokalise_api/resources/base_spec.rb | 20 + .../resources/branch_spec.rb | 81 ++ .../resources/comment_spec.rb | 49 ++ .../resources/contributor_spec.rb | 62 ++ .../custom_translation_status_spec.rb | 62 ++ .../ruby_lokalise_api/resources/file_spec.rb | 41 + .../ruby_lokalise_api/resources/jwt_spec.rb | 11 + .../ruby_lokalise_api/resources/key_spec.rb | 93 +++ .../resources/oauth2_refreshed_token_spec.rb | 11 + .../resources/oauth2_token_spec.rb | 11 + .../ruby_lokalise_api/resources/order_spec.rb | 41 + .../resources/payment_cards_spec.rb | 45 ++ .../resources/project_language_spec.rb | 67 ++ .../resources/project_spec.rb | 730 ++++++++++++++++++ .../resources/queued_process_spec.rb | 36 + .../resources/screenshot_spec.rb | 63 ++ .../resources/segment_spec.rb | 51 ++ .../resources/snapshot_spec.rb | 58 ++ .../resources/system_language_spec.rb | 11 + .../ruby_lokalise_api/resources/task_spec.rb | 62 ++ .../ruby_lokalise_api/resources/team_spec.rb | 11 + .../team_user_billing_details_spec.rb | 55 ++ .../resources/team_user_group_spec.rb | 132 ++++ .../resources/team_user_spec.rb | 61 ++ .../resources/translation_provider_spec.rb | 41 + .../resources/translation_spec.rb | 51 ++ .../resources/webhook_spec.rb | 74 ++ .../ruby_lokalise_api/rest/branches_spec.rb | 114 +++ .../ruby_lokalise_api/rest/comments_spec.rb | 123 +++ .../rest/contributors_spec.rb | 110 +++ .../rest/custom_translation_statuses_spec.rb | 108 +++ spec/lib/ruby_lokalise_api/rest/files_spec.rb | 93 +++ spec/lib/ruby_lokalise_api/rest/jwts_spec.rb | 18 + spec/lib/ruby_lokalise_api/rest/keys_spec.rb | 210 +++++ .../ruby_lokalise_api/rest/languages_spec.rb | 144 ++++ .../lib/ruby_lokalise_api/rest/orders_spec.rb | 82 ++ .../rest/payment_cards_spec.rb | 75 ++ .../ruby_lokalise_api/rest/projects_spec.rb | 134 ++++ .../rest/queued_processes_spec.rb | 46 ++ .../rest/screenshots_spec.rb | 121 +++ .../ruby_lokalise_api/rest/segments_spec.rb | 71 ++ .../ruby_lokalise_api/rest/snapshots_spec.rb | 76 ++ spec/lib/ruby_lokalise_api/rest/tasks_spec.rb | 125 +++ .../rest/team_user_billing_details_spec.rb | 67 ++ .../rest/team_user_groups_spec.rb | 167 ++++ .../ruby_lokalise_api/rest/team_users_spec.rb | 71 ++ spec/lib/ruby_lokalise_api/rest/teams_spec.rb | 25 + .../rest/translation_providers_spec.rb | 38 + .../rest/translations_spec.rb | 70 ++ .../ruby_lokalise_api/rest/webhooks_spec.rb | 105 +++ .../ruby_lokalise_api/utils/classes_spec.rb | 25 + spec/spec_helper.rb | 34 +- spec/support/expectations.rb | 76 ++ spec/support/fixtures.rb | 23 + spec/support/stubs.rb | 73 ++ spec/support/test_client.rb | 8 +- spec/support/vcr.rb | 15 - 646 files changed, 16326 insertions(+), 16647 deletions(-) delete mode 100644 lib/ruby_lokalise_api/base_request.rb delete mode 100644 lib/ruby_lokalise_api/collections/branch.rb create mode 100644 lib/ruby_lokalise_api/collections/branches.rb delete mode 100644 lib/ruby_lokalise_api/collections/contributor.rb create mode 100644 lib/ruby_lokalise_api/collections/contributors.rb delete mode 100644 lib/ruby_lokalise_api/collections/custom_translation_status.rb create mode 100644 lib/ruby_lokalise_api/collections/custom_translation_statuses.rb delete mode 100644 lib/ruby_lokalise_api/collections/file.rb create mode 100644 lib/ruby_lokalise_api/collections/files.rb delete mode 100644 lib/ruby_lokalise_api/collections/key.rb delete mode 100644 lib/ruby_lokalise_api/collections/key_comment.rb create mode 100644 lib/ruby_lokalise_api/collections/key_comments.rb create mode 100644 lib/ruby_lokalise_api/collections/keys.rb delete mode 100644 lib/ruby_lokalise_api/collections/order.rb create mode 100644 lib/ruby_lokalise_api/collections/orders.rb delete mode 100644 lib/ruby_lokalise_api/collections/payment_card.rb create mode 100644 lib/ruby_lokalise_api/collections/payment_cards.rb delete mode 100644 lib/ruby_lokalise_api/collections/project.rb delete mode 100644 lib/ruby_lokalise_api/collections/project_comment.rb create mode 100644 lib/ruby_lokalise_api/collections/project_comments.rb delete mode 100644 lib/ruby_lokalise_api/collections/project_language.rb create mode 100644 lib/ruby_lokalise_api/collections/project_languages.rb create mode 100644 lib/ruby_lokalise_api/collections/projects.rb delete mode 100644 lib/ruby_lokalise_api/collections/queued_process.rb create mode 100644 lib/ruby_lokalise_api/collections/queued_processes.rb delete mode 100644 lib/ruby_lokalise_api/collections/screenshot.rb create mode 100644 lib/ruby_lokalise_api/collections/screenshots.rb delete mode 100644 lib/ruby_lokalise_api/collections/segment.rb create mode 100644 lib/ruby_lokalise_api/collections/segments.rb delete mode 100644 lib/ruby_lokalise_api/collections/snapshot.rb create mode 100644 lib/ruby_lokalise_api/collections/snapshots.rb delete mode 100644 lib/ruby_lokalise_api/collections/system_language.rb create mode 100644 lib/ruby_lokalise_api/collections/system_languages.rb delete mode 100644 lib/ruby_lokalise_api/collections/task.rb create mode 100644 lib/ruby_lokalise_api/collections/tasks.rb delete mode 100644 lib/ruby_lokalise_api/collections/team.rb delete mode 100644 lib/ruby_lokalise_api/collections/team_user.rb delete mode 100644 lib/ruby_lokalise_api/collections/team_user_group.rb create mode 100644 lib/ruby_lokalise_api/collections/team_user_groups.rb create mode 100644 lib/ruby_lokalise_api/collections/team_users.rb create mode 100644 lib/ruby_lokalise_api/collections/teams.rb delete mode 100644 lib/ruby_lokalise_api/collections/translation.rb delete mode 100644 lib/ruby_lokalise_api/collections/translation_provider.rb create mode 100644 lib/ruby_lokalise_api/collections/translation_providers.rb create mode 100644 lib/ruby_lokalise_api/collections/translations.rb delete mode 100644 lib/ruby_lokalise_api/collections/webhook.rb create mode 100644 lib/ruby_lokalise_api/collections/webhooks.rb create mode 100644 lib/ruby_lokalise_api/concerns/attrs_loadable.rb create mode 100644 lib/ruby_lokalise_api/concerns/hash_accessible.rb create mode 100644 lib/ruby_lokalise_api/concerns/unsupportable.rb create mode 100644 lib/ruby_lokalise_api/data/collection_attributes.yml rename lib/ruby_lokalise_api/data/{attributes.yml => resource_attributes.yml} (81%) create mode 100644 lib/ruby_lokalise_api/endpoints/base_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/branches_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/files_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/keys_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/main_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/orders_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/projects_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/segments_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/teams_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/translations_endpoint.rb create mode 100644 lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb create mode 100644 lib/ruby_lokalise_api/generics.rb delete mode 100644 lib/ruby_lokalise_api/oauth2/refresh.rb delete mode 100644 lib/ruby_lokalise_api/oauth2/token.rb create mode 100644 lib/ruby_lokalise_api/resources/comment.rb delete mode 100644 lib/ruby_lokalise_api/resources/key_comment.rb create mode 100644 lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb rename lib/ruby_lokalise_api/resources/{project_comment.rb => oauth2_token.rb} (51%) create mode 100644 lib/ruby_lokalise_api/response.rb create mode 100644 lib/ruby_lokalise_api/rest.rb delete mode 100644 lib/ruby_lokalise_api/rest/jwt.rb create mode 100644 lib/ruby_lokalise_api/rest/jwts.rb delete mode 100644 lib/ruby_lokalise_api/utils/attribute_helpers.rb create mode 100644 lib/ruby_lokalise_api/utils/attributes.rb create mode 100644 lib/ruby_lokalise_api/utils/classes.rb delete mode 100644 lib/ruby_lokalise_api/utils/endpoint_helpers.rb create mode 100644 lib/ruby_lokalise_api/utils/keys.rb create mode 100644 lib/ruby_lokalise_api/utils/loaders.rb delete mode 100644 lib/ruby_lokalise_api/utils/string_utils.rb create mode 100644 lib/ruby_lokalise_api/utils/strings.rb create mode 100644 spec/fixtures/branches/branch.json create mode 100644 spec/fixtures/branches/branch2.json create mode 100644 spec/fixtures/branches/branches.json create mode 100644 spec/fixtures/branches/branches_next_page.json create mode 100644 spec/fixtures/branches/branches_paginated.json create mode 100644 spec/fixtures/branches/create_branch.json create mode 100644 spec/fixtures/branches/destroy_branch.json create mode 100644 spec/fixtures/branches/merge_branch.json create mode 100644 spec/fixtures/branches/update_branch.json create mode 100644 spec/fixtures/comments/comment.json create mode 100644 spec/fixtures/comments/comment2.json create mode 100644 spec/fixtures/comments/comments.json create mode 100644 spec/fixtures/comments/comments_next_page.json create mode 100644 spec/fixtures/comments/comments_paginated.json create mode 100644 spec/fixtures/comments/destroy_comment.json create mode 100644 spec/fixtures/comments/multiple_created_comments.json create mode 100644 spec/fixtures/comments/project_comments.json create mode 100644 spec/fixtures/comments/project_comments_next_page.json create mode 100644 spec/fixtures/comments/project_comments_paginated.json create mode 100644 spec/fixtures/comments/single_created_comment.json create mode 100644 spec/fixtures/contributors/contributor.json create mode 100644 spec/fixtures/contributors/contributor2.json create mode 100644 spec/fixtures/contributors/contributors.json create mode 100644 spec/fixtures/contributors/contributors_next_page.json create mode 100644 spec/fixtures/contributors/contributors_paginated.json create mode 100644 spec/fixtures/contributors/create_contributor.json create mode 100644 spec/fixtures/contributors/destroy_contributor.json create mode 100644 spec/fixtures/contributors/update_contributor.json create mode 100644 spec/fixtures/cts/colors.json create mode 100644 spec/fixtures/cts/create_status.json create mode 100644 spec/fixtures/cts/destroy_status.json create mode 100644 spec/fixtures/cts/destroy_status2.json create mode 100644 spec/fixtures/cts/status.json create mode 100644 spec/fixtures/cts/statuses.json create mode 100644 spec/fixtures/cts/update_status.json create mode 100644 spec/fixtures/cts/update_status2.json create mode 100644 spec/fixtures/errors/invalid_token.json create mode 100644 spec/fixtures/errors/not_found.json create mode 100644 spec/fixtures/files/destroy_file.json create mode 100644 spec/fixtures/files/doc_files.json create mode 100644 spec/fixtures/files/download_files.json create mode 100644 spec/fixtures/files/files.json create mode 100644 spec/fixtures/files/files_page1.json create mode 100644 spec/fixtures/files/files_page2.json create mode 100644 spec/fixtures/files/upload_file.json create mode 100644 spec/fixtures/files/upload_file_reloaded.json create mode 100644 spec/fixtures/jwts/create_jwt.json create mode 100644 spec/fixtures/keys/create_keys.json create mode 100644 spec/fixtures/keys/destroy_key.json create mode 100644 spec/fixtures/keys/destroy_keys.json create mode 100644 spec/fixtures/keys/key.json create mode 100644 spec/fixtures/keys/key2.json create mode 100644 spec/fixtures/keys/keys.json create mode 100644 spec/fixtures/keys/keys_page1.json create mode 100644 spec/fixtures/keys/keys_page2.json create mode 100644 spec/fixtures/keys/update_key.json create mode 100644 spec/fixtures/keys/update_key2.json create mode 100644 spec/fixtures/keys/update_keys.json create mode 100644 spec/fixtures/languages/create_project_languages.json create mode 100644 spec/fixtures/languages/destroy_language.json create mode 100644 spec/fixtures/languages/project_language.json create mode 100644 spec/fixtures/languages/project_languages.json create mode 100644 spec/fixtures/languages/project_languages_page1.json create mode 100644 spec/fixtures/languages/project_languages_page2.json create mode 100644 spec/fixtures/languages/system_languages_page1.json create mode 100644 spec/fixtures/languages/system_languages_page2.json create mode 100644 spec/fixtures/languages/update_project_language.json create mode 100644 spec/fixtures/orders/create_order.json create mode 100644 spec/fixtures/orders/order.json create mode 100644 spec/fixtures/orders/orders.json create mode 100644 spec/fixtures/orders/orders_page2.json create mode 100644 spec/fixtures/orders/orders_page3.json create mode 100644 spec/fixtures/payment_cards/create_payment_card.json create mode 100644 spec/fixtures/payment_cards/destroy_payment_card.json create mode 100644 spec/fixtures/payment_cards/payment_card.json create mode 100644 spec/fixtures/payment_cards/payment_cards.json create mode 100644 spec/fixtures/payment_cards/payment_cards_page2.json create mode 100644 spec/fixtures/payment_cards/payment_cards_page3.json create mode 100644 spec/fixtures/processes/process.json create mode 100644 spec/fixtures/processes/processes.json create mode 100644 spec/fixtures/processes/processes_page1.json create mode 100644 spec/fixtures/processes/processes_page2.json create mode 100644 spec/fixtures/projects/create_project.json create mode 100644 spec/fixtures/projects/destroy_project.json create mode 100644 spec/fixtures/projects/empty_project.json create mode 100644 spec/fixtures/projects/empty_project2.json create mode 100644 spec/fixtures/projects/project.json create mode 100644 spec/fixtures/projects/projects.json create mode 100644 spec/fixtures/projects/projects_next_page.json create mode 100644 spec/fixtures/projects/update_project.json create mode 100644 spec/fixtures/projects/update_project2.json create mode 100644 spec/fixtures/screenshots/create_screenshots.json create mode 100644 spec/fixtures/screenshots/destroy_screenshot.json create mode 100644 spec/fixtures/screenshots/screenshot.json rename spec/fixtures/{ => screenshots}/screenshot_base64.txt (100%) create mode 100644 spec/fixtures/screenshots/screenshots.json create mode 100644 spec/fixtures/screenshots/screenshots_page1.json create mode 100644 spec/fixtures/screenshots/screenshots_page2.json create mode 100644 spec/fixtures/screenshots/update_screenshot.json create mode 100644 spec/fixtures/segments/segment.json create mode 100644 spec/fixtures/segments/segments.json create mode 100644 spec/fixtures/segments/update_segment.json create mode 100644 spec/fixtures/snapshots/create_snapshot.json create mode 100644 spec/fixtures/snapshots/destroy_snapshot.json create mode 100644 spec/fixtures/snapshots/restore_snapshot.json create mode 100644 spec/fixtures/snapshots/restore_snapshot2.json create mode 100644 spec/fixtures/snapshots/snapshots.json create mode 100644 spec/fixtures/snapshots/snapshots_page1.json create mode 100644 spec/fixtures/snapshots/snapshots_page2.json create mode 100644 spec/fixtures/tasks/create_task.json create mode 100644 spec/fixtures/tasks/destroy_task.json create mode 100644 spec/fixtures/tasks/task.json create mode 100644 spec/fixtures/tasks/tasks.json create mode 100644 spec/fixtures/tasks/tasks_page1.json create mode 100644 spec/fixtures/tasks/tasks_page2.json create mode 100644 spec/fixtures/tasks/update_task.json create mode 100644 spec/fixtures/tasks/update_task2.json create mode 100644 spec/fixtures/team_user_billing_details/create_billing_details.json create mode 100644 spec/fixtures/team_user_billing_details/team_user_billing_details.json create mode 100644 spec/fixtures/team_user_billing_details/update_billing_details.json create mode 100644 spec/fixtures/team_user_groups/add_members_to_group.json create mode 100644 spec/fixtures/team_user_groups/add_projects_to_group.json create mode 100644 spec/fixtures/team_user_groups/create_team_user_group.json create mode 100644 spec/fixtures/team_user_groups/destroy_team_user_group.json create mode 100644 spec/fixtures/team_user_groups/remove_members_from_group.json create mode 100644 spec/fixtures/team_user_groups/remove_projects_from_group.json create mode 100644 spec/fixtures/team_user_groups/team_user_group.json create mode 100644 spec/fixtures/team_user_groups/team_user_groups.json create mode 100644 spec/fixtures/team_user_groups/team_user_groups_page1.json create mode 100644 spec/fixtures/team_user_groups/team_user_groups_page2.json create mode 100644 spec/fixtures/team_user_groups/update_team_user_group.json create mode 100644 spec/fixtures/team_users/destroy_team_user.json create mode 100644 spec/fixtures/team_users/team_user.json create mode 100644 spec/fixtures/team_users/team_users.json create mode 100644 spec/fixtures/team_users/team_users_page1.json create mode 100644 spec/fixtures/team_users/team_users_page2.json create mode 100644 spec/fixtures/team_users/update_team_user.json create mode 100644 spec/fixtures/teams/teams.json create mode 100644 spec/fixtures/teams/teams_page1.json create mode 100644 spec/fixtures/teams/teams_page2.json create mode 100644 spec/fixtures/translation_providers/translation_provider.json create mode 100644 spec/fixtures/translation_providers/translation_providers.json create mode 100644 spec/fixtures/translation_providers/translation_providers_page1.json create mode 100644 spec/fixtures/translation_providers/translation_providers_page2.json create mode 100644 spec/fixtures/translations/translation.json create mode 100644 spec/fixtures/translations/translations.json create mode 100644 spec/fixtures/translations/translations_page3.json create mode 100644 spec/fixtures/translations/translations_page4.json create mode 100644 spec/fixtures/translations/update_translation.json delete mode 100644 spec/fixtures/vcr_cassettes/add_project_to_group_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/add_projects_to_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/add_user_to_group_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/add_users_to_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_branches.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_branches_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_comments.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_comments_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_contributors.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_contributors_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_files_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_key_segments.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_key_segments_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_keys.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_keys_gzip.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_keys_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_orders.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_orders_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_payment_cards.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_payment_cards_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_project_languages.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_project_languages_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_projects.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_projects_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_queued_processes.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_screenshots.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_screenshots_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_snapshots.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_snapshots_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_system_languages.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_system_languages_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_tasks.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_tasks_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_team_users_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_translation_providers.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_translation_providers_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_translation_statuses.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_translation_statuses_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_translations_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/all_webhooks_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/another_key_segment.yml delete mode 100644 spec/fixtures/vcr_cassettes/another_team_user.yml delete mode 100644 spec/fixtures/vcr_cassettes/another_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/another_translation.yml delete mode 100644 spec/fixtures/vcr_cassettes/branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/comment.yml delete mode 100644 spec/fixtures/vcr_cassettes/contributor.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_comment.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_contributor.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_key.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_language.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_screenshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_snapshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_task.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_another_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_branch_to_merge.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_branch_to_merge2.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_comments.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_contributors.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_keys.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_keys_collection.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_languages.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_order.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_order_dry_run.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_screenshots.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_snapshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_snapshot_for_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_task.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_team_user_billing_details.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/create_webhook.yml delete mode 100644 spec/fixtures/vcr_cassettes/created_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_all_keys_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_another_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_comment.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_comment_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_contributor.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_contributor_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_key.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_key_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_keys.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_language.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_language_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_project_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_restored_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_screenshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_screenshot_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_snapshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_snapshot_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_task.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_task_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_team_user.yml delete mode 100644 spec/fixtures/vcr_cassettes/delete_team_user_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_another_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_another_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_file.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_payment_card.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/destroy_webhook.yml delete mode 100644 spec/fixtures/vcr_cassettes/download_files.yml delete mode 100644 spec/fixtures/vcr_cassettes/empty_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/empty_project_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/error_invalid_token.yml delete mode 100644 spec/fixtures/vcr_cassettes/error_not_found.yml delete mode 100644 spec/fixtures/vcr_cassettes/error_unknown_code.yml delete mode 100644 spec/fixtures/vcr_cassettes/files.yml delete mode 100644 spec/fixtures/vcr_cassettes/jwt.yml delete mode 100644 spec/fixtures/vcr_cassettes/key.yml delete mode 100644 spec/fixtures/vcr_cassettes/key_segment.yml delete mode 100644 spec/fixtures/vcr_cassettes/key_segment_params.yml delete mode 100644 spec/fixtures/vcr_cassettes/language.yml delete mode 100644 spec/fixtures/vcr_cassettes/merge_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/merge_branch_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/new_payment_card.yml delete mode 100644 spec/fixtures/vcr_cassettes/new_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/oauth2/new_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/oauth2/refresh.yml delete mode 100644 spec/fixtures/vcr_cassettes/oauth2/refresh_error.yml delete mode 100644 spec/fixtures/vcr_cassettes/oauth2/token.yml delete mode 100644 spec/fixtures/vcr_cassettes/oauth2/token_error.yml delete mode 100644 spec/fixtures/vcr_cassettes/order.yml delete mode 100644 spec/fixtures/vcr_cassettes/payment_card.yml delete mode 100644 spec/fixtures/vcr_cassettes/project.yml delete mode 100644 spec/fixtures/vcr_cassettes/project_comments.yml delete mode 100644 spec/fixtures/vcr_cassettes/queued_process.yml delete mode 100644 spec/fixtures/vcr_cassettes/regenerate_webhook_secret.yml delete mode 100644 spec/fixtures/vcr_cassettes/regenerate_webhook_secret_2.yml delete mode 100644 spec/fixtures/vcr_cassettes/reload_key_segment.yml delete mode 100644 spec/fixtures/vcr_cassettes/remove_project_from_group_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/remove_projects_from_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/remove_user_from_group_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/remove_users_from_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/restore_snapshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/restore_snapshot_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/restore_snapshot_for_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/restored_updated_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/screenshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/task.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_user.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_user_billing_details.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_user_groups.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_user_groups_pagination.yml delete mode 100644 spec/fixtures/vcr_cassettes/team_users.yml delete mode 100644 spec/fixtures/vcr_cassettes/teams.yml delete mode 100644 spec/fixtures/vcr_cassettes/translation.yml delete mode 100644 spec/fixtures/vcr_cassettes/translation_provider.yml delete mode 100644 spec/fixtures/vcr_cassettes/translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/translation_status_colors.yml delete mode 100644 spec/fixtures/vcr_cassettes/translations.yml delete mode 100644 spec/fixtures/vcr_cassettes/translations_next_page.yml delete mode 100644 spec/fixtures/vcr_cassettes/translations_prev_page.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_another_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_another_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_another_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_branch.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_contributor.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_contributor_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_key.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_key_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_key_segment.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_key_segment_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_keys.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_language.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_language_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_project.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_project_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_screenshot.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_screenshot_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_task.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_task_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_team_user.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_team_user_billing_details.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_team_user_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_team_user_group.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_translation.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_translation_chained.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_translation_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/update_webhook.yml delete mode 100644 spec/fixtures/vcr_cassettes/upload_file.yml delete mode 100644 spec/fixtures/vcr_cassettes/upload_file_queued_reload.yml delete mode 100644 spec/fixtures/vcr_cassettes/upload_file_status.yml delete mode 100644 spec/fixtures/vcr_cassettes/webhook.yml delete mode 100644 spec/fixtures/vcr_cassettes/webhook_2.yml delete mode 100644 spec/fixtures/vcr_cassettes/webhooks.yml create mode 100644 spec/fixtures/webhooks/create_webhook.json create mode 100644 spec/fixtures/webhooks/destroy_webhook.json create mode 100644 spec/fixtures/webhooks/regenerate_webhook_secret.json create mode 100644 spec/fixtures/webhooks/update_webhook.json create mode 100644 spec/fixtures/webhooks/webhook.json create mode 100644 spec/fixtures/webhooks/webhooks.json create mode 100644 spec/fixtures/webhooks/webhooks_page1.json create mode 100644 spec/fixtures/webhooks/webhooks_page2.json delete mode 100644 spec/lib/ruby_lokalise_api/client/branches_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/comments_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/contributors_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/custom_translation_statuses_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/files_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/jwt_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/keys_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/languages_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/orders_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/payment_cards_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/projects_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/queued_processes_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/screenshots_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/segments_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/snapshots_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/tasks_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/team_user_billing_details_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/team_user_groups_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/team_users_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/teams_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/translation_providers_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/translations_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/client/webhooks_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/client_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/branches_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/contributors_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/files_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/key_comments_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/keys_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/orders_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/payment_cards_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/project_comments_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/project_languages_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/projects_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/queued_processes_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/screenshots_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/snapshots_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/tasks_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/team_user_groups_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/team_users_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/teams_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/translation_providers_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/translations_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/collections/webhooks_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/custom_json_parser_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/endpoints/base_endpoint_spec.rb delete mode 100644 spec/lib/ruby_lokalise_api/error_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/generics_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/oauth2_client_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/base_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/branch_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/comment_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/contributor_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/custom_translation_status_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/file_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/jwt_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/key_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/oauth2_refreshed_token_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/oauth2_token_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/order_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/payment_cards_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/project_language_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/project_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/queued_process_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/screenshot_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/segment_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/snapshot_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/system_language_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/task_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/team_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/team_user_billing_details_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/team_user_group_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/team_user_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/translation_provider_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/translation_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/resources/webhook_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/branches_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/comments_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/contributors_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/custom_translation_statuses_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/files_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/jwts_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/keys_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/languages_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/orders_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/payment_cards_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/projects_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/queued_processes_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/screenshots_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/segments_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/snapshots_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/tasks_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/team_user_billing_details_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/team_user_groups_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/team_users_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/teams_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/translation_providers_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/translations_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/rest/webhooks_spec.rb create mode 100644 spec/lib/ruby_lokalise_api/utils/classes_spec.rb create mode 100644 spec/support/expectations.rb create mode 100644 spec/support/fixtures.rb create mode 100644 spec/support/stubs.rb delete mode 100644 spec/support/vcr.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df8e6e8..f695b87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,19 +13,18 @@ jobs: matrix: os: [ubuntu-latest] ruby: - - 2.7 - '3.0' - 3.1 - 3.2 runs-on: ${{ matrix.os }} env: LOKALISE_API_TOKEN: 123abc - LOKALISE_PROJECT_ID: 672198945b7d72fc048021.15940510 OAUTH2_CLIENT_ID: fake OAUTH2_CLIENT_SECRET: fake OAUTH2_TOKEN: fake OAUTH2_REFRESH_TOKEN: fake OAUTH2_CODE: fake + OAUTH2_TOKEN_REFRESHED: fake steps: - uses: actions/checkout@v3 - name: Set up Ruby @@ -33,4 +32,6 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - run: bundle exec rake spec \ No newline at end of file + - run: bundle exec rake spec + - name: Coveralls + uses: coverallsapp/github-action@v2 \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 71f294a..b0f05f4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,9 +7,6 @@ AllCops: TargetRubyVersion: 2.7 NewCops: enable -Layout/SpaceInsideHashLiteralBraces: - EnforcedStyle: no_space - Metrics/BlockLength: Max: 36 Exclude: @@ -17,7 +14,7 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 2 - + Layout/LineLength: AllowURI: true Exclude: @@ -27,35 +24,15 @@ Metrics/MethodLength: CountComments: false Max: 10 -Metrics/ModuleLength: - Max: 150 - -Metrics/ClassLength: - Max: 150 - Metrics/ParameterLists: - Max: 5 + Max: 4 CountKeywordArgs: true - -Style/CollectionMethods: - Enabled: true - PreferredMethods: - collect: 'map' - collect!: 'map!' - inject: 'reduce' - find: 'detect' - find_all: 'select' - delete: 'gsub' - -Style/Documentation: - Enabled: false + Exclude: + - ./lib/ruby_lokalise_api/rest/segments.rb Layout/DotPosition: EnforcedStyle: trailing -Layout/AccessModifierIndentation: - Enabled: false - Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: 'no_comma' @@ -68,11 +45,21 @@ RSpec/MultipleExpectations: RSpec/ExampleLength: Max: 35 -RSpec/FilePath: +Style/Documentation: Enabled: false -RSpec/MessageSpies: - EnforcedStyle: receive +RSpec/FilePath: + CustomTransform: + OAuth2: oauth2 + OAuth2Client: oauth2_client + OAuth2Token: oauth2_token + OAuth2RefreshedToken: oauth2_refreshed_token + +Gemspec/DevelopmentDependencies: + EnforcedStyle: gemspec + Exclude: + - ./docs/Gemfile RSpec/MultipleMemoizedHelpers: - Max: 10 \ No newline at end of file + Exclude: + - ./spec/lib/ruby_lokalise_api/resources/project_spec.rb \ No newline at end of file diff --git a/docs/Gemfile b/docs/Gemfile index fcc6f0e..9079772 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -17,7 +17,7 @@ gem 'minima', '~> 2.0' # If you want to use GitHub Pages, remove the "gem "jekyll"" above and # uncomment the line below. To upgrade, run `bundle update github-pages`. -gem 'github-pages', '~> 227', group: :jekyll_plugins +gem 'github-pages', '~> 228', group: :jekyll_plugins # If you have any plugins, put them here! group :jekyll_plugins do diff --git a/docs/_data/api_items.yml b/docs/_data/api_items.yml index 09b8d50..e3572c0 100644 --- a/docs/_data/api_items.yml +++ b/docs/_data/api_items.yml @@ -66,8 +66,8 @@ - title: JWT path: jwt sub_paths: - - title: Get OTA JWT - path: get-ota-jwt + - title: Create JWT + path: create-jwt - title: Translation keys path: keys sub_paths: diff --git a/docs/additional_info/changelog.md b/docs/additional_info/changelog.md index a919cb6..9bb60f2 100644 --- a/docs/additional_info/changelog.md +++ b/docs/additional_info/changelog.md @@ -1,5 +1,76 @@ # Changelog +## 8.0.0 + +In this version **SDK has been fully rewritten** to make it more robust, better tested, and even more comfortable to work with. While most of the methods have similar signatures, there are a few major changes. + +Breaking changes: + +* Method `translation_statuses` has been renamed to `custom_translation_statuses` +* Method `translation_status` has been renamed to `custom_translation_status` +* Method `create_translation_status` has been renamed to `create_custom_translation_status` +* Method `update_translation_status` has been renamed to `update_custom_translation_status` +* Method `destroy_translation_status` has been renamed to `destroy_custom_translation_status` +* Method `translation_status_colors` has been renamed to `custom_translation_status_colors` +* Method `language` has been renamed to `project_language` +* Method `create_languages` has been renamed to `create_project_languages` +* Method `update_language` has been renamed to `update_project_language` +* Method `destroy_language` has been renamed to `destroy_project_language` +* Method `destroy_all` has been removed from `Keys` collection +* Method `jwt` has been renamed to `create_jwt`: + +```ruby +token = @client.create_jwt project_id, service: :ota + +token.jwt # => '123abcd' +``` + +* `raw_data` method has been removed. All resources respond to the methods named after the corresponding attributes and also support `[]` notation. Therefore both versions should work: + +```ruby +branch = @client.branch project_id, branch_id + +branch.name # => 'my-branch' +branch[:name] # => 'my-branch' +``` + +Updates: + +* Added many new instance methods like `update`, `destroy`, and `reload_data`. + +```ruby +params = { + lang_name: 'Updated custom language', + plural_forms: %w[one many] +} + +language = @client.project_language project_id, language_id + +updated_language = language.update params + +updated_language.lang_name # => 'Updated custom language' +``` + +* Individual projects now respond to many new methods like `merge_branch`, `restore_snapshot`, and so on. Please browse documentation for a specific endpoint to learn about new features. + +```ruby +project = @client.project project_id + +restored_project = project.restore_snapshot snapshot_id + +restored_project.name # => 'Project copy' +``` + +* Methods like `destroy` now return objects, not hashes. However, these objects also respond to the `[]` method to preserve backwards compatibility. + +```ruby +response = @client.destroy_screenshot project_id, screen_id +response.screenshot_deleted # => true +response[:screenshot_deleted] # => true +``` + +* Test only with Ruby 3+ (though the SDK should still work with version 2.7+). Next major version will require Ruby 3+. + ## 7.2.0 (11-Jan-2023) * Updated the `jwt` method. It is now mandatory to provide the project ID to request JWT for: diff --git a/docs/additional_info/exception_handling.md b/docs/additional_info/exception_handling.md index b976a04..fd0545d 100644 --- a/docs/additional_info/exception_handling.md +++ b/docs/additional_info/exception_handling.md @@ -22,6 +22,4 @@ The gem may raise the following custom exceptions: ## API Rate Limits -[Access to all endpoints is limited](https://developers.lokalise.com/reference/api-rate-limits) to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and the corresponding exception will be raised that you should handle properly. To handle such errors, we recommend an exponential backoff mechanism with a limited number of retries. You can use [lokalise_rails backoff mechanism](https://github.com/bodrovis/lokalise_rails/blob/master/lib/lokalise_rails/task_definition/base.rb#L63) as an example. - -Only one concurrent request per token is allowed. +[Access to all endpoints is limited](https://developers.lokalise.com/reference/api-rate-limits) to 6 requests per second from 14 September, 2021. This limit is applied per API token and per IP address. If you exceed the limit, a 429 HTTP status code will be returned and the corresponding exception will be raised that you should handle properly. To handle such errors, we recommend an exponential backoff mechanism with a limited number of retries. You can use [lokalise_rails backoff mechanism](https://github.com/bodrovis/lokalise_rails/blob/master/lib/lokalise_rails/task_definition/base.rb#L63) as an example. \ No newline at end of file diff --git a/docs/additional_info/oauth2.md b/docs/additional_info/oauth2.md index f4d21be..463658f 100644 --- a/docs/additional_info/oauth2.md +++ b/docs/additional_info/oauth2.md @@ -36,7 +36,7 @@ The `auth` method returns a URL looking like this: https://app.lokalise.com/oauth2/auth?client_id=12345&scope=read_projects ``` -Your customers have to visit this URL and allow access to proceed. After allowing access, the customer will be presented with a secret code that has to be used in the following step. +**Your customers have to visit this URL and allow access to proceed**. After allowing access, the customer will be presented with a secret code that has to be used in the following step. ## Generating OAuth 2 token @@ -80,4 +80,8 @@ require 'ruby_lokalise_api' This is because with OAuth2 tokens, a different authorization header must be sent. -Now you can send requests on the user's behalf! \ No newline at end of file +Now you can send requests on the user's behalf! + +```ruby +projects = @client.projects page: 2, limit: 3 +``` \ No newline at end of file diff --git a/docs/api/branches.md b/docs/api/branches.md index 4b4bbf3..a817129 100644 --- a/docs/api/branches.md +++ b/docs/api/branches.md @@ -10,13 +10,25 @@ ## params (hash) ### :page and :limit # Output: - ## Collection of comments available in the branches project + ## Collection of branches ``` For example: ```ruby -@client.branches project_id, limit: 1, page: 1 +branches = @client.branches '123.abc', limit: 1, page: 1 + +branches.project_id # => '123.abc' +branches[0].branch_id # => 123 +branches[0].name # => 'branch_name' +``` + +Alternatively: + +```ruby +project = @client.project '123.abc' + +branches = project.branches limit: 1, page: 1 ``` ## Fetch branch @@ -31,6 +43,25 @@ For example: ## Branch inside the given project ``` +For example: + +```ruby +branch_id = 1234 + +branch = @client.branch '123.abc', branch_id + +branch.branch_id # => 1234 +branch.name # => 'branch_name' +``` + +Alternatively: + +```ruby +project = @client.project '123.abc' + +branch = project.branch branch_id +``` + ## Create branch [Doc](https://developers.lokalise.com/reference/retrieve-a-branch) @@ -47,7 +78,18 @@ For example: For example: ```ruby -@client.create_branch project_id, name: 'ruby-branch' +branch = @client.create_branch '123.abc', name: 'ruby-branch' + +branch.branch_id # => 1234 +branch.name # => 'ruby-branch' +``` + +Alternatively: + +```ruby +project = @client.project '123.abc' + +branch = project.create_branch name: 'ruby-branch' ``` ## Update branch @@ -64,17 +106,27 @@ For example: ## Updated branch ``` -Alternatively: +For example: ```ruby -branch = @client.branch('project_id', 'branch_id') -branch.update params +branch_id = 1234 + +branch = @client.update_branch '123.abc', branch_id, name: 'updated-ruby-branch' + +branch.name # => 'updated-ruby-branch' ``` -For example: +Alternatively: ```ruby -@client.update_branch project_id, branch_id, name: 'updated-ruby-branch' +branch = @client.branch '123.abc', branch_id +updated_branch = branch.update params + +# OR + +project = @client.project '123.abc' + +branch = project.update_branch branch_id, name: 'updated-ruby-branch' ``` ## Delete branch @@ -86,14 +138,33 @@ For example: ## project_id (string, required) ## branch_id (string or integer, required) # Output: - ## Hash with the project's id and "branch_deleted"=>true + ## Generic object with `branch_deleted` method +``` + +For example: + +```ruby +branch_id = 1234 + +result = @client.destroy_branch '123.abc', branch_id + +result.project_id # => '123.abc' +result.branch_deleted # => true ``` Alternatively: ```ruby -branch = @client.branch('project_id', 'branch_id') -branch.destroy +branch = @client.branch '123.abc', branch_id +result = branch.destroy + +# OR + +project = @client.project '123.abc' + +result = project.destroy_branch branch_id + +result.branch_deleted # => true ``` ## Merge branch @@ -106,18 +177,33 @@ branch.destroy ## branch_id (string or integer, required) ## params (hash) # Output: - ## Hash with the project's id, "branch_merged"=>true, and branch attributes + ## Generic object with the project's id, "branch_merged"=>true, and branch attributes ``` -Alternatively: +For example: ```ruby -branch = @client.branch('project_id', 'branch_id') -branch.merge params +branch_source = 1234 +data = { + force_conflict_resolve_using: 'source', + target_branch_id: 6789 +} + +result = @client.merge_branch '123.abc', branch_source, data + +result.branch_merged # => true +result.branch['branch_id'] # => 1234 +result.target_branch['branch_id'] # => 6789 ``` -For example: +Alternatively: ```ruby -@client.merge_branch project_id, branch_id, force_conflict_resolve_using: 'master' +branch = @client.branch '123.abc', branch_source +result = branch.merge data + +# OR + +project = @client.project '123.abc' +result = project.merge_branch branch_source, data ``` diff --git a/docs/api/comments.md b/docs/api/comments.md index 660b5ee..dff95fc 100644 --- a/docs/api/comments.md +++ b/docs/api/comments.md @@ -13,6 +13,18 @@ ## Collection of comments available in the given project ``` +For example: + +```ruby +project_id = '123.abc' +key_id = 1234 + +comments = test_client.project_comments project_id, key_id, page: 2, limit: 3 + +comments[0].comment_id # => 789 +comments[0].comment # => '

Hi!

' +``` + ## Fetch key comments [Doc](https://developers.lokalise.com/reference/list-key-comments) @@ -30,7 +42,31 @@ For example: ```ruby -@client.comments project_id, key_id, limit: 1, page: 2 +project_id = '123.abc' +key_id = 1234 + +comments = @client.comments project_id, key_id, limit: 1, page: 2 + +comments[0].comment_id # => 789 +comments[0].comment # => '

Hi!

' +``` + +Alternatively: + +```ruby +params = { + page: 2, + limit: 3 +} + +project = @client.project project_id + +comments = project.key_comments key_id, params + +# OR + +key = @client.key project_id, key_id +comments = key.key_comments params ``` ## Create key comments @@ -50,10 +86,27 @@ For example: For example: ```ruby -@client.create_comments project_id, key_id, [ +params = [ {comment: 'demo comment'}, {comment: 'another comment'} ] + +comments = @client.create_comments project_id, key_id, params + +comments[0].comment # => 'demo comment' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +comments = project.create_comments key_id, params + +# OR + +key = @client.key project_id, key_id +comments = key.create_comments params ``` ## Fetch key comment @@ -69,6 +122,28 @@ For example: ## Comment for the key in the given project ``` +For example: + +```ruby +comment = @client.comment project_id, key_id, comment_id + +comment.comment_id # => 1234 +comment.comment # => '

Hi!

' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +comment = project.key_comment key_id, comment_id + +# OR + +key = @client.key project_id, key_id +comment = key.key_comment comment_id +``` + ## Delete key comment [Doc](https://developers.lokalise.com/reference/delete-a-comment) @@ -79,12 +154,31 @@ For example: ## key_id (string, required) ## comment_id (string, required) # Output: - ## Hash with the project's id and "comment_deleted"=>true + ## Generic object with the project id and "comment_deleted"=>true +``` + +For example: + +```ruby +response = @client.destroy_comment project_id, key_id, comment_id + +response.comment_deleted # => true ``` Alternatively: ```ruby -comment = @client.comment('project_id', 'comment_id') -comment.destroy +comment = @client.comment project_id, key_id, comment_id + +response = comment.destroy + +# OR + +project = @client.project project_id +response = project.destroy_comment key_id, comment_id + +# OR + +key = @client.key project_id, key_id +response = key.destroy_comment comment_id ``` diff --git a/docs/api/contributors.md b/docs/api/contributors.md index d9cefd7..8d1b768 100644 --- a/docs/api/contributors.md +++ b/docs/api/contributors.md @@ -16,7 +16,20 @@ For example: ```ruby -@client.contributors project_id, limit: 1, page: 2 +project_id = '123.abc' + +contributors = @client.contributors project_id, limit: 1, page: 2 + +contributors[0].fullname # => 'John Doe' +contributors[0].email # => 'test@example.com' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +contributors = project.contributors limit: 1, page: 2 ``` ## Fetch a single contributor @@ -31,6 +44,27 @@ For example: ## Contributor in the given project ``` +For example: + +```ruby +project_id = '123.abc' +contributor_id = '1234' + +contributor = @client.contributor project_id, contributor_id + +contributor.user_id # => 1234 +contributor.fullname # => 'John Doe' +contributor.email # => 'test@example.com' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +contributor = project.contributor contributor_id +``` + ## Create contributors [Doc](https://developers.lokalise.com/reference/create-contributors) @@ -54,15 +88,28 @@ For example: For example: ```ruby -@client.create_contributors project_id, - email: 'rspec@test.com', - fullname: 'Rspec test', - languages: [{ - lang_iso: 'en' - }, - { - lang_iso: 'ru' - }] +params = { + email: 'test@example.com', + fullname: 'John Doe', + languages: [{ + lang_iso: 'en' + }, + { + lang_iso: 'lv' + }] +} + +contributors = @client.create_contributors project_id, params + +contributors[0].fullname # => 'John Doe' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +contributors = project.create_contributors params ``` ## Update contributor @@ -84,17 +131,24 @@ For example: ## Updated contributor ``` -Alternatively: +For example: ```ruby -contributor = @client.contributor('project_id', 'contributor_id') -contributor.update(params) +params = { languages: [{lang_iso: 'en'}] } + +contributor = @client.update_contributor project_id, contributor_id, params ``` -For example: +Alternatively: ```ruby -@client.update_contributor project_id, contributor_id, languages: [{lang_iso: 'en'}] +contributor = @client.contributor project_id, contributor_id +contributor.update params + +# OR + +project = @client.project project_id +project.update_contributor contributor_id, params ``` ## Delete contributor @@ -106,12 +160,25 @@ For example: ## project_id (string, required) ## contributor_id (string, required) # Output: - ## Hash with the project's id and "contributor_deleted"=>true + ## Generic object with the project id and "contributor_deleted"=>true ``` -Alternatively: +For example: ```ruby -contributor = @client.contributor('project_id', 'id') -contributor.destroy +response = @client.destroy_contributor project_id, contributor_id + +response.contributor_deleted # => true ``` + +Alternatively: + +```ruby +contributor = @client.contributor project_id, contributor_id +response = contributor.destroy + +# OR + +project = @client.project project_id +response = project.destroy_contributor contributor_id +``` \ No newline at end of file diff --git a/docs/api/custom-translation-statuses.md b/docs/api/custom-translation-statuses.md index 8599fb8..7690e29 100644 --- a/docs/api/custom-translation-statuses.md +++ b/docs/api/custom-translation-statuses.md @@ -7,18 +7,30 @@ [Doc](https://developers.lokalise.com/reference/list-all-custom-translation-statuses) ```ruby -@client.translation_statuses(project_id, params = {}) # Input: - ## project_id (string, required) - ## params (hash) - ### :page and :limit - # Output: - ## Collection of translation statuses for the project +@client.custom_translation_statuses(project_id, params = {}) # Input: + ## project_id (string, required) + ## params (hash) + ### :page and :limit + # Output: + ## Collection of custom translation statuses for the project ``` For example: ```ruby -@client.translation_statuses project_id, limit: 1, page: 2 +project_id = '123.abc' +params = { limit: 1, page: 2 } + +statuses = @client.custom_translation_statuses project_id, params +statuses[0].color # => '#0079bf' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +statuses = project.custom_translation_statuses params ``` ## Fetch a single translation status @@ -26,11 +38,31 @@ For example: [Doc](https://developers.lokalise.com/reference/retrieve-a-custom-translation-status) ```ruby -@client.translation_status(project_id, status_id) # Input: - ## project_id (string, required) - ## status_id (string or integer, required) - # Output: - ## Translation status inside the given project +@client.custom_translation_status(project_id, status_id) # Input: + ## project_id (string, required) + ## status_id (string or integer, required) + # Output: + ## Translation status inside the given project +``` + +For example: + +```ruby +project_id = '123.abc' +status_id = '1234' + +status = @client.custom_translation_status project_id, status_id + +status.color # => '#0079bf' +status.title # => 'approved' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +status = project.custom_translation_status status_id ``` ## Create translation status @@ -38,21 +70,35 @@ For example: [Doc](https://developers.lokalise.com/reference/create-a-custom-translation-status) ```ruby -@client.create_translation_status(project_id, params) # Input: - ## project_id (string, required) - ## params (hash, required) - ### :title (string, required) - title of the new status - ### :color (string, required) - HEX color code of the new status. Lokalise allows a very limited number of color codes to set. Check the official docs or use `#translation_status_colors` method listed below to find the list of supported colors - # Output: - ## Created translation status +@client.create_custom_translation_status(project_id, params) # Input: + ## project_id (string, required) + ## params (hash, required) + ### :title (string, required) - title of the new status + ### :color (string, required) - HEX color code of the new status. Lokalise allows a very limited number of color codes to set. Check the official docs or use `#translation_status_colors` method listed below to find the list of supported colors + # Output: + ## Created translation status ``` For example: ```ruby -@client.create_translation_status project_id, - title: "Demo status", - color: '#f2d600' +params = { + title: "approved", + color: '#f2d600' +} + +status = @client.create_custom_translation_status project_id, params + +status.color # => '#f2d600' +status.title # => 'approved' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +status = project.create_custom_translation_status params ``` ## Update translation status @@ -60,29 +106,38 @@ For example: [Doc](https://developers.lokalise.com/reference/update-a-custom-translation-status) ```ruby -@client.update_translation_status(project_id, status_id, params) # Input: - ## project_id (string, required) - ## status_id (string or integer, required) - ## params (hash, required) - ### :title (string, required) - title of the new status - ### :color (string, required) - HEX color code of the new status - # Output: - ## Updated translation status +@client.update_custom_translation_status(project_id, status_id, params) # Input: + ## project_id (string, required) + ## status_id (string or integer, required) + ## params (hash, required) + ### :title (string, required) - title of the new status + ### :color (string, required) - HEX color code of the new status + # Output: + ## Updated translation status ``` -Alternatively: +For example: ```ruby -status = @client.translation_status(project_id, status_id) -status.update(params) +params = { + title: 'Updated status', + color: '#c377e0' +} + +status = @client.update_custom_translation_status project_id, status_id, params +status.color # => '#c377e0' ``` -For example: +Alternatively: ```ruby -@client.update_translation_status project_id, status_id, - title: 'Updated status', - color: '#c377e0' +status = @client.custom_translation_status project_id, status_id +status.update params + +# OR + +project = @client.project project_id +status = project.update_custom_translation_status status_id, params ``` ## Delete translation status @@ -90,18 +145,31 @@ For example: [Doc](https://developers.lokalise.com/reference/delete-a-custom-translation-status) ```ruby -@client.destroy_translation_status(project_id, status_id) # Input: - ## project_id (string, required) - ## status_id (string or integer, required) - # Output: - ## Result of the delete operation +@client.destroy_custom_translation_status(project_id, status_id) # Input: + ## project_id (string, required) + ## status_id (string or integer, required) + # Output: + ## Result of the delete operation +``` + +For example: + +```ruby +response = @client.destroy_custom_translation_status project_id, status_id + +response.custom_translation_status_deleted # => true ``` Alternatively: ```ruby -status = @client.translation_status(project_id, status_id) -status.destroy +status = @client.custom_translation_status project_id, status_id +response = status.destroy + +# OR + +project = @client.project project_id +response = project.destroy_custom_translation_status status_id ``` ## Supported color codes for translation statuses @@ -111,8 +179,23 @@ status.destroy As long as Lokalise supports only very limited array of color hexadecimal codes for custom translation statuses, this method can be used to fetch all permitted values. ```ruby -@client.translation_status_colors(project_id) # Input: - ## project_id (string, required) - # Output: - ## Array of color codes in HEX format +@client.custom_translation_status_colors(project_id) # Input: + ## project_id (string, required) + # Output: + ## Object responding to colors method that return an array of color codes in HEX format ``` + +For example: + +```ruby +response = test_client.custom_translation_status_colors project_id + +response.colors[0] # => '#61bd4f' +``` + +Alternatively: + +```ruby +project = @client.project project_id +response = project.custom_translation_status_colors +``` \ No newline at end of file diff --git a/docs/api/files.md b/docs/api/files.md index c681656..d024ba5 100644 --- a/docs/api/files.md +++ b/docs/api/files.md @@ -16,14 +16,26 @@ For example: ```ruby -@client.files project_id, limit: 1, page: 1 +project_id = '123.abc' + +files = @client.files project_id, limit: 3, page: 2 + +files[0].filename # => 'demo.json' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +files = project.files limit: 3, page: 2 ``` ## Download translation files [Doc](https://developers.lokalise.com/reference/download-files) -Exports project files as a `.zip` bundle and makes them available to download (the link is valid for 12 months). +Exports project files as a `.zip` bundle and makes them available for downloading (the link is valid for 12 months). ```ruby @client.download_files(project_id, params) # Input: @@ -32,23 +44,38 @@ Exports project files as a `.zip` bundle and makes them available to download (t ### :format (string, required) - one of the file formats supported by Lokalise (json, xml, po etc). ### Find the list of other supported params at https://developers.lokalise.com/reference/download-files # Output: - ## Hash with the project id and a "bundle_url" link + ## Generic object with project id and a "bundle_url" link ``` For example: ```ruby -@client.download_files project_id, - format: 'yaml', - original_filenames: true, - filter_langs: ['fr', 'en'] +params = { + format: 'yaml', + original_filenames: true, + filter_langs: ['fr', 'en'] +} + +response = @client.download_files project_id, params + +response.bundle_url # => 'https://...' ``` +Alternatively: + +```ruby +project = @client.project project_id + +response = project.download_files params +``` + +If you need a simple way to upload and download translation files in your Ruby scripts, take advantage of the [lokalise_manager gem](https://github.com/bodrovis/lokalise_manager). + ## Upload translation file [Doc](https://developers.lokalise.com/reference/upload-a-file) -Starting from July 2020, **background uploading is the only method of importing translation files**. +Please note that file uploading is performed in the background. ```ruby @client.upload_file(project_id, params) # Input: @@ -67,16 +94,19 @@ To encode your data in Base64, use `Base64.strict_encode64()` method. After the uploading process is completed, a `QueuedProcess` resource will be returned. This resource contains a status of the import job, process ID to manually check the status, and some other attributes: ```ruby -queued_process = @client.upload_file project_id, - data: 'Base-64 encoded data... ZnI6DQogI...', - filename: 'my_file.yml', - lang_iso: 'en' +params = { + data: 'Base-64 encoded data... ZnI6DQogI...', + filename: 'my_file.yml', + lang_iso: 'en' +} + +queued_process = @client.upload_file project_id, params queued_process.status # => 'queued' queued_process.process_id # => 'ff1876382b7ba81f2bb465da8f030196ec401fa6' ``` -Your job is to periodically reload data for the queued process and check the `status` attribute: +You can periodically reload data for the queued process and check the `status` attribute: ```ruby reloaded_process = queued_process.reload_data # loads new data from the API @@ -102,13 +132,27 @@ def uploaded?(q_process) false # if all 5 checks failed, return false (probably something is wrong) end +params = { + data: 'Base-64 encoded data... ZnI6DQogI...', + filename: 'my_file.yml', + lang_iso: 'en' +} + process = @client.upload_file project_id, - data: 'Base-64 encoded data... ZnI6DQogI...', - filename: 'my_file.yml', - lang_iso: 'en' + uploaded? process ``` +Alternatively: + +```ruby +project = @client.project project_id + +process = project.upload_file params +``` + +If you need a simple way to upload and download translation files in your Ruby scripts, take advantage of the [lokalise_manager gem](https://github.com/bodrovis/lokalise_manager). + ## Delete a file [Doc](https://developers.lokalise.com/reference/delete-a-file) @@ -120,11 +164,21 @@ This endpoint does not support "software localization" projects. ## project_id (string, required) ## file_id (string or integer, required) # Output: - ## Hash with project_id and "file_deleted" set to "true" + ## Generic with project_id and "file_deleted" set to "true" ``` For example: ```ruby -@client.destroy_file project_id, file_id +response = @client.destroy_file project_id, file_id + +response.file_deleted # => true +``` + +Alternatively: + +```ruby +project = @client.project project_id + +response = project.destroy_file file_id ``` \ No newline at end of file diff --git a/docs/api/getting-started.md b/docs/api/getting-started.md index 89e651b..c512ff5 100644 --- a/docs/api/getting-started.md +++ b/docs/api/getting-started.md @@ -1,6 +1,6 @@ # Getting Started -## Installation and Requirements +## Installation and requirements This gem requires [Ruby 2.7+](https://www.ruby-lang.org/en/) and [RubyGems package manager](https://rubygems.org/pages/download). @@ -8,7 +8,7 @@ Install it by running: gem install ruby-lokalise-api -## Initializing the Client +## Initializing the client In order to perform API requests, you require a special token that can be obtained in your [personal profile](https://lokalise.com/profile#apitokens) (*API tokens* section). @@ -24,35 +24,36 @@ Now the `@client` can be used to perform API requests! Learn more about addition ## Objects and models -Individual objects are represented as instances of Ruby classes which are called *models*. Each model responds to the methods that are named after the API object's attributes. [This file](https://github.com/lokalise/ruby-lokalise-api/blob/master/lib/ruby-lokalise-api/data/attributes.json) lists all objects and their methods. +Individual objects are represented as instances of Ruby classes which are called *models*. Each model responds to the methods that are named after the API object's attributes. [This file](https://github.com/lokalise/ruby-lokalise-api/blob/master/lib/ruby-lokalise-api/data/resource_attributes.json) lists all objects and their methods. Here is an example: ```ruby -project = client.project '123' -project.name -project.description -project.created_by +project = @client.project '123' + +project.name # => 'Demo project' +project.description # => 'Sample description' +project.created_by # => 12345 ``` Many resources have common methods like `project_id` and `branch`: ```ruby -webhook = client.webhook project_id, '123.abc' -webhook.project_id -webhook.branch -``` +project_id = '123.abc' +webhook_id = '678def' -To get access to raw data returned by the API, use `#raw_data`: +webhook = client.webhook project_id, webhook_id -```ruby -project.raw_data +webhook.project_id # => '123.abc' +webhook.branch # => 'develop' ``` Models support method chaining, meaning you can fetch a resource, update and delete it in one line: ```ruby -@client.project('123').update(name: 'New name').destroy +response = @client.project('123.abc').update(name: 'New project name').destroy + +response.project_deleted # => true ``` ### Reloading data @@ -60,11 +61,18 @@ Models support method chaining, meaning you can fetch a resource, update and del Most of the resources can be reloaded using the `#reload_data` method. This method will fetch the latest data for the resource: ```ruby -project = client.project '123' +project = client.project '123.abc' + +project.name # => 'Initial project name' + # do something else... + # project might be updated via UI, so load new data: reloaded_project = project.reload_data -# now `reloaded_project` has fresh data from the API + +# now `reloaded_project` has fresh data from the API! + +reloaded_project.name # => 'Updated project name' ``` ## Collections of resources and pagination @@ -73,7 +81,7 @@ Fetching (or creating/updating) multiple objects will return a *collection* of o ```ruby project = @client.projects.collection.first # => Get the first project -project.name +project.name # => 'First project in collection' ``` Bulk fetches support [pagination](https://developers.lokalise.com/reference/api-pagination). There are two common parameters available: @@ -111,9 +119,21 @@ On top of that, you may easily fetch the next or the previous page of the collec These methods return instances of the same collection class or `nil` if the next/previous page is unavailable. Methods respect the parameters you've initially passed: ```ruby -translations = @client.translations 'project_id', limit: 4, page: 2, disable_references: 0 # => we passed three parameters here +project_id = '123.abc' + +params = { + limit: 4, + page: 2, + disable_references: 0 +} + +translations = @client.translations project_id, params # => we passed three parameters here -translations.prev_page # => will load the previous page while preserving the `limit` and `disable_references` params +prev_page_translations = translations.prev_page # will load the previous page while preserving the `limit` and `disable_references` params + +first_translation = prev_page_translations.first # get first translation from the collection + +first_translation.translation # => 'Translation text' ``` ## Branching @@ -121,5 +141,5 @@ translations.prev_page # => will load the previous page while preserving the `li If you are using [project branching feature](https://docs.lokalise.com/en/articles/3391861-project-branching), simply add branch name separated by semicolon to your project ID in any endpoint to access the branch. For example, in order to access `new-feature` branch for the project with an id `123abcdef.01`: ```ruby -@client.files '123abcdef.01:new-feature' -``` +files = @client.files '123abcdef.01:new-feature' +``` \ No newline at end of file diff --git a/docs/api/jwt.md b/docs/api/jwt.md index 66840fd..27595a1 100644 --- a/docs/api/jwt.md +++ b/docs/api/jwt.md @@ -1,20 +1,31 @@ # JWT -## Get OTA JWT +## Create JWT [Doc](https://developers.lokalise.com/reference/create-service-jwt) ```ruby -@client.jwt(project_id, params = {}) # Input: - ## project_id (string, required) - ## params (hash) - # Output: - ## A JWT resource +@client.create_jwt(project_id, params = {}) # Input: + ## project_id (string, required) + ## params (hash) + # Output: + ## A JWT resource ``` For example: ```ruby -resp = @client.jwt("123.abcd") -resp.jwt # => 'eyJ0eXAiOi...` +project_id = "123.abcd" + +response = @client.create_jwt project_id, service: :ota + +response.jwt # => 'eyJ0eXAiOi...` +``` + +Alternatively: + +```ruby +project = @client.project project_id + +response = project.create_jwt service: :ota ``` \ No newline at end of file diff --git a/docs/api/keys.md b/docs/api/keys.md index 8e426d8..83e427d 100644 --- a/docs/api/keys.md +++ b/docs/api/keys.md @@ -16,7 +16,23 @@ For example: ```ruby -@client.keys project_id, limit: 2, page: 3 +project_id = '123.abc' +params = { + limit: 2, + page: 3 +} + +keys = @client.keys project_id, params + +keys[0].key_id # => 1234 +``` + +Alternatively: + +```ruby +project = @client.project project_id + +keys = project.keys params ``` ## Fetch a single project key @@ -36,7 +52,23 @@ For example: For example: ```ruby -@client.key project_id, 44_596_066, disable_references: 0 +project_id = '123.abc' +key_id = 44_596_066 +params = { + disable_references: 0 +} + +key = @client.key project_id, key_id, params + +key.key_name['ios'] # => 'demo_key_name' +key.translations[0]['language_iso'] # => 'en' +``` + +Alternatively: + +```ruby +project = @client.project project_id +key = project.key key_id, params ``` ## Create project keys @@ -57,16 +89,34 @@ For example: For example: ```ruby -@client.create_keys project_id, [{key_name: 'first_key', platforms: %w[ios]}, - { - key_name: 'second_key', - platforms: %w[web], - translations: [{ - "language_iso": "en", - "translation": "Welcome" - }] - } - ] +params = [ + { + key_name: 'first_key', + platforms: %w[ios] + }, + { + key_name: 'second_key', + platforms: %w[web], + translations: [ + { + "language_iso": "en", + "translation": "Welcome" + } + ] + } +] + +keys = @client.create_keys project_id, params + +keys[0].key_id # => 1234 +keys.errors[0]['message'] # => 'This key name is already taken' +``` + +Alternatively: + +```ruby +project = @client.project project_id +keys = project.create_keys params ``` ## Update project key @@ -83,17 +133,29 @@ For example: ## Updated key ``` -Alternatively: +For example: ```ruby -key = @client.key('project_id', 'key_id') -key.update(params) +params = { + key_name: 'updated_key_name', + description: 'Demo description' +} + +key = @client.update_key project_id, key_id, params + +key.key_id # => 1234 ``` -For example: +Alternatively: ```ruby -@client.update_key project_id, key_id, key_name: 'updated_key_name', description: 'Demo description' +key = @client.key project_id, key_id +key.update params + +# OR + +project = @client.project project_id +key = project.update_key key_id, params ``` ## Bulk update project keys @@ -113,16 +175,30 @@ For example: For example: ```ruby -client.update_keys '123.abc', [ - { - key_id: 456, - description: 'bulk updated' - }, - { - key_id: 769, - tags: %w[bulk update] - } -] +params = { + use_automations: false, + keys: [ + { + key_id: 456, + description: 'bulk updated' + }, + { + key_id: 769, + tags: %w[bulk update] + } + ] +} + +keys = client.update_keys project_id, params + +keys[1].tags # => ['bulk', 'update'] +``` + +Alternatively: + +```ruby +project = @client.project project_id +keys = project.update_keys params ``` ## Delete project key @@ -134,14 +210,27 @@ client.update_keys '123.abc', [ ## project_id (string, required) ## key_id (string, required) # Output: - ## Hash with project_id and "key_removed" set to "true" + ## Generic with project_id and "key_removed" set to "true" +``` + +For example: + +```ruby +response = client.destroy_key project_id, key_id + +response.key_removed # => true ``` Alternatively: ```ruby -key = @client.key('project_id', 'key_id') -key.destroy +key = @client.key project_id, key_id +response = key.destroy + +# OR + +project = @client.project project_id +response = project.destroy_key key_id ``` ## Bulk delete project keys @@ -153,18 +242,21 @@ key.destroy ## project_id (string, required) ## key_ids (array, required) # Output: - ## Hash with project_id and "keys_removed" set to "true" + ## Generic with project_id and "keys_removed" set to "true" ``` -Alternatively: +For example: ```ruby -keys = @client.keys('project_id') -keys.destroy_all # => will effectively destroy all keys in the project +key_ids = [1234, 5678] + +response = @client.destroy_keys project_id, key_ids +response.keys_removed # => true ``` -For example: +Alternatively: ```ruby -@client.destroy_keys project_id, [1234, 5678] -``` +project = @client.project project_id +response = project.destroy_keys key_ids +``` \ No newline at end of file diff --git a/docs/api/languages.md b/docs/api/languages.md index fab2d6c..9f91467 100644 --- a/docs/api/languages.md +++ b/docs/api/languages.md @@ -15,7 +15,14 @@ For example: ```ruby -@client.system_languages limit: 10, page: 3 +params = { + limit: 10, + page: 3 +} + +languages = @client.system_languages params + +languages[0].lang_name # => 'Abkhaz' ``` ## Fetch project languages @@ -34,7 +41,23 @@ For example: For example: ```ruby -@client.project_languages project_id, limit: 1, page: 2 +project_id = '123.abc' +params = { + imit: 1, + page: 2 +} + +languages = @client.project_languages project_id, params + +languages[0].lang_iso # => 'fr' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +languages = project.languages params ``` ## Fetch a single project language @@ -42,11 +65,29 @@ For example: [Doc](https://developers.lokalise.com/reference/retrieve-a-language) ```ruby -@client.language(project_id, language_id) # Input: - ## project_id (string, required) - ## language_id (string, required) - # Output: - ## A single language in the given project +@client.project_language(project_id, language_id) # Input: + ## project_id (string, required) + ## language_id (string, required) + # Output: + ## A single language in the given project +``` + +For example: + +```ruby +project_id = '123.abc' +language_id = '1234' + +language = client.project_language project_id, language_id + +language.lang_iso # => 'fr' +``` + +Alternatively: + +```ruby +project = @client.project project_id +language = project.language language_id ``` ## Create project languages @@ -54,21 +95,35 @@ For example: [Doc](https://developers.lokalise.com/reference/create-languages) ```ruby -@client.create_languages(project_id, params) # Input: - ## project_id (string, required) - ## params (array of hashes or hash, required) - contains parameter of newly created languages. Pass array of hashes to create multiple languages, or a hash to create a single language - ### :lang_iso (string, required) - ### :custom_iso (string) - ### :custom_name (string) - ### :custom_plural_forms (array) - can contain only plural forms initially supported by Lokalise - # Output: - ## Collection of newly created languages +@client.create_project_languages(project_id, params) # Input: + ## project_id (string, required) + ## params (array of hashes or hash, required) - contains parameter of newly created languages. Pass array of hashes to create multiple languages, or a hash to create a single language + ### :lang_iso (string, required) + ### :custom_iso (string) + ### :custom_name (string) + ### :custom_plural_forms (array) - can contain only plural forms initially supported by Lokalise + # Output: + ## Collection of newly created languages ``` For example: ```ruby -@client.create_languages project_id, lang_iso: 'ab', custom_name: 'Demo lang' +params = [{ + lang_iso: 'de' +}, { + lang_iso: 'nl' +}] + +languages = @client.create_project_languages project_id, params +languages[0].lang_iso # => 'de' +``` + +Alternatively: + +```ruby +project = @client.project project_id +languages = project.create_languages params ``` ## Update project language @@ -76,30 +131,39 @@ For example: [Doc](https://developers.lokalise.com/reference/update-a-language) ```ruby -@client.update_language(project_id, language_id, params) # Input: - ## project_id (string, required) - ## language_id (string, required) - ## params (hash, required) - ### :lang_iso (string, required) - ### :custom_name (string) - ### :plural_forms (array) - can contain only plural forms initially supported by Lokalise - # Output: - ## Updated language +@client.update_project_language(project_id, language_id, params) # Input: + ## project_id (string, required) + ## language_id (string, required) + ## params (hash, required) + ### :lang_iso (string, required) + ### :custom_name (string) + ### :plural_forms (array) - can contain only plural forms initially supported by Lokalise + # Output: + ## Updated language ``` -Alternatively: +For example: ```ruby -language = @client.language('project_id', 'lang_id') -language.update(params) +params = { + lang_name: 'Updated custom language', + plural_forms: %w[one] +} + +language = @client.update_project_language project_id, language_id, params +language.lang_name # => 'Updated custom language' ``` -For example: +Alternatively: ```ruby -@client.update_language project_id, new_language_id, - lang_name: 'Updated custom language', - plural_forms: %w[one] +language = @client.project_language project_id, language_id +language.update params + +# OR + +project = @client.project project_id +language = @client.update_language language_id, params ``` ## Delete project language @@ -107,16 +171,28 @@ For example: [Doc](https://developers.lokalise.com/reference/delete-a-language) ```ruby -@client.destroy_language(project_id, language_id) # Input: - ## project_id (string, required) - ## language_id (string, required) - # Output: - ## Hash with the project's id and "language_deleted"=>true +@client.destroy_project_language(project_id, language_id) # Input: + ## project_id (string, required) + ## language_id (string, required) + # Output: + ## Generic with the project id and "language_deleted"=>true ``` -Alternatively: +For example: ```ruby -language = @client.language('project_id', 'lang_id') -language.destroy +response = @client.destroy_project_language project_id, language_id +response.language_deleted # => true ``` + +Alternatively: + +```ruby +language = @client.language project_id, language_id +response = language.destroy + +# OR + +project = @client.project project_id +response = project.destroy_language language_id +``` \ No newline at end of file diff --git a/docs/api/orders.md b/docs/api/orders.md index e1f65d5..8e18081 100644 --- a/docs/api/orders.md +++ b/docs/api/orders.md @@ -16,7 +16,11 @@ For example: ```ruby -@client.orders team_id, limit: 1, page: 1 +team_id = '1234' + +orders = @client.orders team_id, limit: 3, page: 1 + +orders[0].order_id # => '201903198B2' ``` ## Fetch a single order @@ -31,6 +35,17 @@ For example: ## A single order ``` +For example: + +```ruby +team_id = '1234' +order_id = '201903198B2' + +order = @client.order team_id, order_id + +order.status # => 'completed' +``` + ## Create an order [Doc](https://developers.lokalise.com/reference/create-an-order) @@ -57,19 +72,21 @@ For example: For example: ```ruby -@client.create_order team_id, - project_id: project_id, - card_id: payment_card_id, - briefing: 'Some briefing', - source_language_iso: 'en', - target_language_isos: [ - 'ru' - ], - keys: [ - 1234, - 5678 - ], - provider_slug: 'gengo', - translation_tier: '1', - dry_run: true +params = { + project_id: '963054665b7c313dd9b323.35886655', + card_id: 1774, + briefing: 'Some briefing', + source_language_iso: 'en', + target_language_isos: %w[fr], + keys: [1234, 4567], + provider_slug: 'gengo', + translation_tier: 1, + dry_run: true, + translation_style: 'friendly' +} + +order = @client.create_order team_id, params + +order.provider_slug # => 'gengo' +order.total # => 123.45 ``` \ No newline at end of file diff --git a/docs/api/payment-cards.md b/docs/api/payment-cards.md index 3c51b31..4fba47f 100644 --- a/docs/api/payment-cards.md +++ b/docs/api/payment-cards.md @@ -15,7 +15,9 @@ For example: ```ruby -@client.payment_cards limit: 1, page: 1 +cards = @client.payment_cards limit: 3, page: 1 + +cards[0].last4 # => '1234' ``` ## Fetch a single payment card @@ -29,6 +31,17 @@ For example: ## A single payment card ``` +For example: + +```ruby +card_id = '6789' + +card = @client.payment_card card_id + +card.last4 # => '1234' +card.brand # => 'Visa' +``` + ## Create a payment card [Doc](https://developers.lokalise.com/reference/create-a-card) @@ -48,10 +61,17 @@ For example: For example: ```ruby -@client.create_payment_card number: '4242424242424242', - cvc: '123', - exp_month: 1, - exp_year: 2030 +params = { + number: '4242424242424242', + cvc: '123', + exp_month: '12', + exp_year: '2020' +} + +card = @client.create_payment_card params + +card.last4 # => '4242' +card.brand # => 'Visa' ``` ## Delete a payment card @@ -62,12 +82,19 @@ For example: @client.destroy_payment_card(card_id) # Input: ## card_id (integer, string, required) # Output: - ## Hash containing card id and `card_deleted => true` attribute + ## Generic containing card id and `card_deleted => true` attribute ``` -Alternatively: +For example: ```ruby -card = @client.payment_card('card_id') -card.destroy +response = @client.destroy_payment_card card_id +response.card_deleted # => true ``` + +Alternatively: + +```ruby +card = @client.payment_card card_id +response = card.destroy +``` \ No newline at end of file diff --git a/docs/api/projects.md b/docs/api/projects.md index 3bf0e41..dabb923 100644 --- a/docs/api/projects.md +++ b/docs/api/projects.md @@ -16,7 +16,14 @@ For example: ```ruby -@client.projects limit: 1, page: 2 +params = { + limit: 1, + page: 2 +} + +projects = @client.projects + +projects[0].project_id # => '123.abc' ``` ## Fetch a single project @@ -30,6 +37,17 @@ For example: ## A single project ``` +For example: + +```ruby +project_id = '123.abc' + +project = @client.project project_id + +project.project_type # => 'localization_files' +project.name # => 'Demo project' +``` + ## Create a project [Doc](https://developers.lokalise.com/reference/create-a-project) @@ -48,7 +66,15 @@ For example: For example: ```ruby -@client.create_project name: 'Demo project', description: 'My first project' +params = { + name: 'Demo project', + description: 'My first project' +} + +project = @client.create_project params + +project.name # => 'Demo project' +project.description # => 'My first project' ``` ## Update a project @@ -65,19 +91,24 @@ For example: ## An updated project ``` -Alternatively: +For example: ```ruby -project = @client.project('project_id') -project.update(params) +params = { + name: 'Updated project name', + description: 'Updated project desc' +} + +project = @client.update_project project_id, params + +project.name # => 'Updated project name' ``` -For example: +Alternatively: ```ruby -@client.update_project new_project_id, - name: 'Updated project name', - description: 'Updated project desc' +project = @client.project project_id +project.update params ``` ## Empty a project @@ -90,14 +121,22 @@ Deletes *all* keys and translations from the project. @client.empty_project(project_id) # Input: ## project_id (string, required) # Output: - ## A project containing its id and a `keys_deleted => true` attribute + ## Generic containing project id and a `keys_deleted => true` attribute +``` + +For example: + +```ruby +response = @client.empty_project project_id + +response.keys_deleted # => true ``` Alternatively: ```ruby -project = @client.project('project_id') -project.empty +project = @client.project project_id +response = project.empty ``` ## Delete a project @@ -108,12 +147,19 @@ project.empty @client.destroy_project(project_id) # Input: ## project_id (string, required) # Output: - ## A project containing its id and a `project_deleted => true` attribute + ## Generic containing project id and a `project_deleted => true` attribute ``` -Alternatively: +For example: ```ruby -project = @client.project('project_id') -project.destroy +response = client.destroy_project project_id +response.project_deleted # => true ``` + +Alternatively: + +```ruby +project = @client.project project_id +response = project.destroy +``` \ No newline at end of file diff --git a/docs/api/queued-processes.md b/docs/api/queued-processes.md index 8e7ca41..870d0b1 100644 --- a/docs/api/queued-processes.md +++ b/docs/api/queued-processes.md @@ -11,6 +11,27 @@ ## Collection of queued processes ``` +For example: + +```ruby +project_id = '123.abc' +params = { + page: 2, + limit: 3 +} + +processes = @client.queued_processes project_id, params + +processes[0].status # => 'finished' +``` + +Alternatively: + +```ruby +project = @client.project project_id +processes = project.queued_processes params +``` + ## Fetch a single queued process [Doc](https://developers.lokalise.com/reference/retrieve-a-process) @@ -22,3 +43,21 @@ # Output: ## Queued process resource ``` + +For example: + +```ruby +project_id = '123.abc' +process_id = '1234' + +process = @client.queued_process project_id, process_id + +process.status # => 'finished' +``` + +Alternatively: + +```ruby +project = @client.project project_id +process = project.queued_process process_id +``` \ No newline at end of file diff --git a/docs/api/screenshots.md b/docs/api/screenshots.md index f39eb37..d38cd33 100644 --- a/docs/api/screenshots.md +++ b/docs/api/screenshots.md @@ -16,7 +16,22 @@ For example: ```ruby -@client.screenshots project_id, limit: 1, page: 1 +project_id = '123.abc' +params = { + limit: 3, + page: 1 +} + +screenshots = @client.screenshots project_id, params + +screenshots[0].screenshot_id # => 1234 +``` + +Alternatively: + +```ruby +project = @client.project project_id +screenshots = project.screenshots params ``` ## Fetch a single screenshot @@ -31,6 +46,25 @@ For example: ## A single screenshot ``` +For example: + +```ruby +project_id = '123.abc' +screenshot_id = '1234' + +screenshot = @client.screenshot project_id, screenshot_id + +screenshot.keys[0]['key_id'] # => 6789 +screenshot.width # => 572 +``` + +Alternatively: + +```ruby +project = @client.project project_id +screenshot = project.screenshot screenshot_id +``` + ## Create screenshots [Doc](https://developers.lokalise.com/reference/create-screenshots) @@ -52,7 +86,21 @@ For example: For example: ```ruby -@client.create_screenshots project_id, data: 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAA...', title: 'My screen' +params = { + data: 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAA...', + title: 'My screen' +} + +screenshots = @client.create_screenshots project_id, params + +screenshots[0].title # => 'My screen' +``` + +Alternatively: + +```ruby +project = @client.project project_id +screenshots = project.create_screenshots params ``` ## Update screenshot @@ -72,19 +120,29 @@ For example: ## Updated screenshot ``` -Alternatively: +For example: ```ruby -screenshot = @client.screenshot('project_id', 'screen_id') -screenshot.update(params) +params = { + tags: %w[demo sample], + description: 'Sample screen' +} + +screenshot = @client.update_screenshot project_id, screenshot_id, params + +screenshot.tags # => ['demo', 'sample'] ``` -For example: +Alternatively: ```ruby -@client.update_screenshot project_id, screenshot_id, - tags: %w[demo sample], - description: 'Sample screen' +screenshot = @client.screenshot project_id, screenshot_id +screenshot.update params + +# OR + +project = @client.project project_id +screenshot = project.update_screenshot screenshot_id, params ``` ## Delete screenshot @@ -96,12 +154,24 @@ For example: ## project_id (string, required) ## screenshot_id (string, required) # Output: - ## Hash with the project id and "screenshot_deleted" set to "true" + ## Generic with the project id and "screenshot_deleted" set to "true" ``` -Alternatively: +For example: ```ruby -screenshot = @client.screenshot('project_id', 'screen_id') -screenshot.destroy +response = @client.destroy_screenshot project_id, screen_id +response.screenshot_deleted # => true ``` + +Alternatively: + +```ruby +screenshot = @client.screenshot project_id, screen_id +response = screenshot.destroy + +# OR + +project = @client.project project_id +response = project.destroy_screenshot screen_id +``` \ No newline at end of file diff --git a/docs/api/segments.md b/docs/api/segments.md index 9451c79..bcba148 100644 --- a/docs/api/segments.md +++ b/docs/api/segments.md @@ -23,7 +23,23 @@ For example: ```ruby -@client.segments '123.abc', 1234, 'en', disable_references: '1' +project_id = '123.abc' +key_id = 1234 +language_iso = 'en' +params = { + disable_references: 1 +} + +segments = @client.segments project_id, key_id, language_iso, params + +segments[0].segment_number # => 1 +``` + +Alternatively: + +```ruby +project = @client.project project_id +segments = project.segments key_id, language_iso, params ``` ## Fetch a single segment @@ -43,7 +59,23 @@ For example: For example: ```ruby -@client.segment '123.abc', 1234, 'en', 4, disable_references: '1' +project_id = '123.abc' +key_id = 1234 +language_iso = 'en' +segment_number = 1 + +segment = @client.segment project_id, key_id, language_iso, segment_number, params + +segment.segment_number # => 1 +segment.value # => 'My text.' +``` + +Alternatively: + +```ruby +project = @client.project project_id + +segment = project.segment key_id, language_iso, segment_number, params ``` ## Update segment @@ -66,14 +98,29 @@ For example: For example: ```ruby -@client.update_segment '123.abc', 1234, 'en', 4, - value: 'Updated via API', - is_reviewed: true +project_id = '123.abc' +key_id = 1234 +language_iso = 'en' +segment_number = 1 +params = { + value: 'Updated.', + is_fuzzy: false +} + +segment = @client.update_segment project_id, key_id, language_iso, segment_number, params + +segment.is_fuzzy # => false +segment.value # => 'Updated.' ``` Alternatively: ```ruby -segment = @client.segment '123.abc', 1234, 'en', 4, disable_references: '1' -segment.update(value: 'Updated segment') +segment = @client.segment project_id, key_id, language_iso, segment_number +segment.update params + +# OR + +project = @client.project project_id +segment = project.update_segment key_id, language_iso, segment_number, params ``` \ No newline at end of file diff --git a/docs/api/snapshots.md b/docs/api/snapshots.md index 34bfa40..8868b3e 100644 --- a/docs/api/snapshots.md +++ b/docs/api/snapshots.md @@ -17,7 +17,22 @@ For example: ```ruby -@client.snapshots project_id, limit: 1, page: 2 +project_id = '123.abc' +params = { + limit: 1, + page: 2 +} + +snapshots = @client.snapshots project_id, params + +snapshots[0].snapshot_id # => 5678 +``` + +Alternatively: + +```ruby +project = @client.project project_id +snapshots = project.snapshots params ``` ## Create snapshot @@ -36,7 +51,20 @@ For example: For example: ```ruby -@client.create_snapshot project_id, title: 'My snapshot' +params = { + title: 'My snapshot' +} + +snapshot = @client.create_snapshot project_id, params + +snapshot.title # => 'My snapshot' +``` + +Alternatively: + +```ruby +project = @client.project project_id +snapshot = project.create_snapshot params ``` ## Restore snapshot @@ -51,11 +79,24 @@ For example: ## Information about the restored project from the specified snapshot ``` +For example: + +```ruby +restored_project = test_client.restore_snapshot project_id, snapshot_id + +restored_project.name # => 'Project copy' +``` + Alternatively: ```ruby -snapshot = @client.snapshots('project_id').first # you can't fetch a single snapshot -snapshot.restore +snapshot = @client.snapshots(project_id).first +restored_project = snapshot.restore + +# OR + +project = @client.project project_id +restored_project = project.restore_snapshot snapshot_id ``` ## Delete snapshot @@ -67,12 +108,20 @@ snapshot.restore ## project_id (string, required) ## snapshot_id (string, required) # Output: - ## Hash with the project id and "snapshot_deleted" set to "true" + ## Generic with the project id and "snapshot_deleted" set to "true" ``` -Alternatively: +For example: ```ruby -snapshot = @client.snapshots('project_id').first # you can't fetch a single snapshot -snapshot.destroy +response = @client.destroy_snapshot project_id, snapshot_id + +response.snapshot_deleted # => true ``` + +Alternatively: + +```ruby +snapshot = @client.snapshots(project_id).first +response = snapshot.destroy +``` \ No newline at end of file diff --git a/docs/api/tasks.md b/docs/api/tasks.md index f10a1a4..668a496 100644 --- a/docs/api/tasks.md +++ b/docs/api/tasks.md @@ -17,7 +17,22 @@ For example: ```ruby -@client.tasks project_id, limit: 2, page: 2 +project_id = '123.abc' +params = { + limit: 3, + page: 2 +} + +tasks = @client.tasks project_id, params + +tasks[0].task_id # => '1234' +``` + +Alternatively: + +```ruby +project = @client.project project_id +tasks = project.tasks params ``` ## Fetch a single task @@ -32,6 +47,25 @@ For example: ## Single task for the project ``` +For example: + +```ruby +project_id = '123.abc' +task_id = '1234' + +task = @client.task project_id, task_id + +task.title # => 'Demo' +task.status # => 'created' +``` + +Alternatively: + +```ruby +project = @client.project project_id +task = project.task task_id +``` + ## Create task [Doc](https://developers.lokalise.com/reference/create-a-task) @@ -54,14 +88,29 @@ For example: For example: ```ruby -@client.create_task project_id, title: 'My first task', - keys: [1234, 5678], - languages: [ - { - language_iso: 'ru', - users: ['20181'] - } - ] +params = { + title: 'Demo task', + keys: %w[1234 5678], + languages: [ + { + language_iso: 'de', + users: %w[1234] + } + ], + source_language_iso: 'en', + task_type: 'translation' +} + +task = @client.create_task project_id, params + +task.status # => 'created' +``` + +Alternatively: + +```ruby +project = @client.project project_id +task = project.create_task params ``` ## Update task @@ -79,17 +128,29 @@ For example: ``` -Alternatively: +For example: ```ruby -task = @client.task('project_id', 'task_id') -task.update(params) +params = { + description: 'Updated task', + auto_close_task: true +} + +task = @client.update_task project_id, task_id, params + +task.description # => 'Updated task' ``` -For example: +Alternatively: ```ruby -@client.update_task project_id, task_id, description: 'Updated task', auto_close_task: true +task = @client.task project_id, task_id +task.update params + +# OR + +project = @client.project project_id +task = project.update_task params ``` ## Delete task @@ -101,13 +162,26 @@ For example: ## project_id (string, required) ## task_id (string, required) # Output: - ## Hash with the project id and "task_deleted" set to "true" + ## Generic with the project id and "task_deleted" set to "true" ``` -Alternatively: +For example: ```ruby -task = @client.task('project_id', 'task_id') -task.destroy +response = client.destroy_task project_id, task_id + +response.task_deleted # => true ``` + +Alternatively: + +```ruby +task = @client.task project_id, task_id +response = task.destroy + +# OR + +project = @client.project project_id +response = project.destroy_task task_id +``` \ No newline at end of file diff --git a/docs/api/team-user-billing-details.md b/docs/api/team-user-billing-details.md index 33c9815..2d4d4ca 100644 --- a/docs/api/team-user-billing-details.md +++ b/docs/api/team-user-billing-details.md @@ -14,7 +14,12 @@ For example: ```ruby -@client.team_user_billing_details '1234' +team_id = '1234' + +details = @client.team_user_billing_details team_id + +details.company # => 'Lokalise' +details.address1 # => 'Address line 1' ``` ## Create team user billing details @@ -42,9 +47,17 @@ For example: For example: ```ruby -@client.create_team_user_billing_details 12345, billing_email: 'ruby@example.com', - country_code: 'LV', - zip: 'LV-1111' +team_id = '1234' + +params = { + billing_email: 'ruby@example.com', + country_code: 'LV', + zip: 'LV-1111' +} + +details = @client.create_team_user_billing_details team_id, params + +details.zip # => 'LV-1111' ``` ## Update team user billing details @@ -72,9 +85,15 @@ For example: For example: ```ruby -@client.update_team_user_billing_details 12345, billing_email: 'ruby_rspec@example.com', - country_code: 'LV', - zip: 'LV-1111', - address1: 'Addr line 1', - city: 'Riga' +params = { + billing_email: 'ruby@example.com', + country_code: 'LV', + zip: 'LV-1111', + address1: 'Addr line 1', + city: 'Riga' +} + +details = @client.update_team_user_billing_details team_id, params + +details.billing_email # => 'ruby@example.com' ``` \ No newline at end of file diff --git a/docs/api/team-user-groups.md b/docs/api/team-user-groups.md index 0c91621..eeb029a 100644 --- a/docs/api/team-user-groups.md +++ b/docs/api/team-user-groups.md @@ -16,7 +16,15 @@ For example: ```ruby -@client.team_user_groups team_id, limit: 1, page: 2 +team_id = '1234' +params = { + limit: 1, + page: 2 +} + +groups = @client.team_user_groups team_id, params + +groups[0].group_id # => '5678' ``` ## Fetch a single group @@ -31,6 +39,17 @@ For example: ## Group ``` +For example: + +```ruby +team_id = '1234' +group_id = '5678' + +group = test_client.team_user_group team_id, group_id + +group.name # => 'Demo' +``` + ## Create group [Doc](https://developers.lokalise.com/reference/create-a-group) @@ -51,13 +70,20 @@ For example: For example: ```ruby -@client.create_team_user_group team_id, name: 'My group', - is_reviewer: false, - is_admin: false, - languages: { - reference: [123], - contributable: [640] - } +params = { + name: 'SDK', + is_reviewer: true, + is_admin: false, + languages: { + reference: [], + contributable: [640] + } +} + +group = @client.create_team_user_group team_id, params + +group.name # => 'SDK' +group.permissions['is_admin'] # => false ``` ## Update group @@ -78,20 +104,29 @@ For example: ## Updated group ``` -Alternatively: +For example: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.update(params) +params = { + name: 'Updated SDK', + is_reviewer: true, + is_admin: false, + languages: { + reference: [], + contributable: [640] + } +} + +group = @client.update_team_user_group team_id, group_id, params + +group.name # => 'Updated SDK' ``` -For example: +Alternatively: ```ruby -@client.update_team_user_group team_id, second_group_id, - name: 'Updated group', - is_admin: true, - is_reviewer: true +group = @client.team_user_group team_id, group_id +updated_group = group.update params ``` ## Add projects to group @@ -105,11 +140,21 @@ For example: ## project_ids (string or array, required) - project ids that you would like to add to this group ``` +For example: + +```ruby +project_ids = %w[123.abc 567.def] + +group = client.add_projects_to_group team_id, group_id, project_ids + +group.projects # => ['123.abc', '567.def'] +``` + Alternatively: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.add_projects projects: [project_id1, project_id2] +group = @client.team_user_group team_id, group_id +updated_group = group.add_projects project_ids ``` ## Remove projects from group @@ -123,11 +168,21 @@ group.add_projects projects: [project_id1, project_id2] ## project_ids (string or array, required) - project ids that you would like to remove from this group ``` +For example: + +```ruby +project_ids = %w[123.abc 567.def] + +group = @client.remove_projects_from_group team_id, group_id, project_ids + +group.projects # => [] +``` + Alternatively: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.remove_projects projects: [project_id1, project_id2] +group = @client.team_user_group team_id, group_id +updated_group = group.remove_projects project_ids ``` ## Add users to group @@ -141,11 +196,21 @@ group.remove_projects projects: [project_id1, project_id2] ## user_ids (string or array, required) - user ids that you would like to add to this group ``` +For example: + +```ruby +user_ids = %w[1234 6789] +group = @client.add_members_to_group team_id, group_id, user_ids + +group.members # => ['1234', '6789'] +``` + Alternatively: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.add_users users: [user_id1, user_id2] +group = @client.team_user_group team_id, group_id + +updated_group = group.add_users user_ids ``` ## Remove users from group @@ -159,11 +224,21 @@ group.add_users users: [user_id1, user_id2] ## user_ids (string or array, required) - user ids that you would like to add to this group ``` +For example: + +```ruby +user_ids = %w[1234 6789] + +group = @client.remove_members_from_group team_id, group_id, user_ids + +group.members # => [] +``` + Alternatively: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.remove_users users: [user_id1, user_id2] +group = @client.team_user_group team_id, group_id +updated_group = group.remove_users user_ids ``` ## Destroy group @@ -178,9 +253,17 @@ group.remove_users users: [user_id1, user_id2] ## Hash with "team_id" and "group_deleted" set to "true" ``` -Alternatively: +For example: ```ruby -group = @client.team_user_group('team_id', 'group_id') -group.destroy +response = @client.destroy_team_user_group team_id, group_id + +response.group_deleted # => true ``` + +Alternatively: + +```ruby +group = @client.team_user_group team_id, group_id +response = group.destroy +``` \ No newline at end of file diff --git a/docs/api/team-users.md b/docs/api/team-users.md index 3911ac9..7eeb94e 100644 --- a/docs/api/team-users.md +++ b/docs/api/team-users.md @@ -16,7 +16,15 @@ For example: ```ruby -@client.team_users team_id, limit: 1, page: 3 +team_id = '1234' +params = { + limit: 1, + page: 3 +} + +users = @client.team_users team_id, params + +users[0].user_id # => 5678 ``` ## Fetch a single team user @@ -31,6 +39,17 @@ For example: ## Team user ``` +For example: + +```ruby +team_id = '1234' +user_id = '6789' + +user = @client.team_user team_id, user_id + +user.fullname # => 'John Doe' +``` + ## Update team user [Doc](https://developers.lokalise.com/reference/update-a-team-user) @@ -45,17 +64,23 @@ For example: ## Updated team user ``` -Alternatively: +For example: ```ruby -user = @client.team_user('team_id', 'user_id') -user.update(params) +params = { + role: 'admin' +} + +user = @client.update_team_user team_id, team_user_id, params + +user.role # => 'admin' ``` -For example: +Alternatively: ```ruby -@client.update_team_user team_id, team_user_id, role: 'admin' +user = @client.team_user team_id, user_id +user.update params ``` ## Delete team user @@ -67,12 +92,19 @@ For example: ## team_id (string, required) ## user_id (string, required) # Output: - ## Hash with "team_id" and "team_user_deleted" set to "true" + ## Generic with "team_id" and "team_user_deleted" set to "true" ``` -Alternatively: +For example: ```ruby -user = @client.team_user('team_id', 'user_id') -user.destroy +response = @client.destroy_team_user team_id, user_id +response.team_user_deleted # => true ``` + +Alternatively: + +```ruby +user = @client.team_user team_id, user_id +response = user.destroy +``` \ No newline at end of file diff --git a/docs/api/teams.md b/docs/api/teams.md index dcb49ae..953dc21 100644 --- a/docs/api/teams.md +++ b/docs/api/teams.md @@ -15,5 +15,12 @@ For example: ```ruby -@client.teams page: 2, limit: 1 +params = { + page: 3, + limit: 2 +} + +teams = @client.teams params + +teams[0].plan # => 'Trial' ``` \ No newline at end of file diff --git a/docs/api/translation-providers.md b/docs/api/translation-providers.md index 781e91d..e2fe130 100644 --- a/docs/api/translation-providers.md +++ b/docs/api/translation-providers.md @@ -16,7 +16,15 @@ For example: ```ruby -@client.translation_providers team_id, limit: 1, page: 2 +team_id = '1234' +params = { + limit: 2, + page: 1 +} + +providers = @client.translation_providers team_id, params + +providers[0].name # => 'Gengo' ``` ## Fetch a single translation provider @@ -30,3 +38,12 @@ For example: # Output: ## Single provider for the team ``` + +For example: + +```ruby +provider = @client.translation_provider team_id, provider_id + +provider.slug # => 'gengo' +provider.pairs[0]['price_per_word'] # => 0.069 +``` \ No newline at end of file diff --git a/docs/api/translations.md b/docs/api/translations.md index 10d570a..b1db014 100644 --- a/docs/api/translations.md +++ b/docs/api/translations.md @@ -17,8 +17,25 @@ For example: ```ruby -@client.translations project_id, limit: 4, page: 2, disable_references: 0, - filter_is_reviewed: 0 +project_id = '123.abc' + +params = { + limit: 4, + page: 2, + disable_references: 0, + filter_is_reviewed: 0 +} + +translations = @client.translations project_id, params + +translations[0].translation_id # => 1234 +``` + +Alternatively: + +```ruby +project = @client.project project_id +translations = project.translations params ``` ## Fetch a single translation @@ -35,6 +52,28 @@ For example: ## Single translation for the project ``` +For example: + +```ruby +project_id = '123.abc' +translation_id = '1234' +params = { + disable_references: 1 +} + +translation = test_client.translation project_id, translation_id, params + +translation.language_iso # => 'en' +translation.is_reviewed # => true +``` + +Alternatively: + +```ruby +project = @client.project project_id +translation = project.translation translation_id, params +``` + ## Update translation [Doc](https://developers.lokalise.com/reference/update-a-translation) @@ -51,16 +90,27 @@ For example: ## Updated translation ``` -Alternatively: +For example: ```ruby -translation = @client.translation('project_id', 'translation_id') -translation.update(params) +params = { + translation: 'Updated translation', + is_reviewed: true +} + +updated_translation = @client.update_translation project_id, translation_id, params + +updated_translation.translation # => 'Updated translation' ``` -For example: +Alternatively: ```ruby -@client.update_translation project_id, translation_id, translation: 'Updated translation', - is_reviewed: true +translation = @client.translation project_id, translation_id +translation.update params + +# OR + +project = @client.project project_id +updated_translation = project.update_translation translation_id, params ``` \ No newline at end of file diff --git a/docs/api/webhooks.md b/docs/api/webhooks.md index 9dff85a..40a43a2 100644 --- a/docs/api/webhooks.md +++ b/docs/api/webhooks.md @@ -16,7 +16,22 @@ For example: ```ruby -@client.webhooks project_id, limit: 1, page: 2 +project_id = '123.abc' +params = { + limit: 3, + page: 2 +} + +webhooks = @client.webhooks project_id, params + +webhooks[0].webhook_id # => '12345' +``` + +Alternatively: + +```ruby +project = @client.project project_id +webhooks = project.webhooks params ``` ## Fetch a single webhook @@ -31,6 +46,25 @@ For example: ## Webhook for the given project ``` +For example: + +```ruby +project_id = '123.abc' +webhook_id = '1234' + +webhook = test_client.webhook project_id, webhook_id + +webhook.url # => 'https://example.com' +webhook.events # => ['project.translation.proofread'] +``` + +Alternatively: + +```ruby +project = @client.project project_id +webhook = project.webhook webhook_id +``` + ## Create webhook [Doc](https://developers.lokalise.com/reference/create-a-webhook) @@ -49,9 +83,21 @@ For example: For example: ```ruby -@client.create_webhook project_id, - url: 'http://example.com', - events: ['project.imported', 'project.exported'] +params = { + url: 'http://example.com', + events: ['project.imported', 'project.exported'] +} + +webhook = @client.create_webhook project_id, params + +webhook.url # => 'https://example.com' +``` + +Alternatively: + +```ruby +project = @client.project project_id +webhook = project.create_webhook params ``` ## Update webhook @@ -70,19 +116,28 @@ For example: ## Updated webhook ``` -Alternatively: +For example: ```ruby -webhook = @client.webhook(project_id, webhook_id) -webhook.update(params) +params = { + url: 'http://updated.example.com' +} + +webhook = @client.update_webhook project_id, webhook_id, params + +webhook.url # => 'http://updated.example.com' ``` -For example: +Alternatively: ```ruby -@client.update_webhook project_id, - new_webhook_id, - url: 'http://updated.example.com' +webhook = @client.webhook project_id, webhook_id +webhook.update params + +# OR + +project = @client.project project_id +webhook = project.update_webhook webhook_id, params ``` ## Delete webhook @@ -97,11 +152,23 @@ For example: ## Result of the delete operation ``` +For example: + +```ruby +response = @client.destroy_webhook project_id, webhook_id +response.webhook_deleted # => true +``` + Alternatively: ```ruby -webhook = @client.webhook(project_id, webhook_id) -webhook.destroy +webhook = @client.webhook project_id, webhook_id +response = webhook.destroy + +# OR + +project = @client.project project_id +response = project.destroy_webhook webhook_id ``` ## Regenerate webhook secret @@ -113,12 +180,25 @@ webhook.destroy ## project_id (string, required) ## webhook_id (string, required) # Output: - ## Hash containing `project_id` and new `secret` + ## Generic containing `project_id` and new `secret` ``` -Alternatively: +For example: ```ruby -webhook = @client.webhook(project_id, webhook_id) -webhook.regenerate_secret +response = @client.regenerate_webhook_secret project_id, webhook_id + +response.secret # => '123abc' ``` + +Alternatively: + +```ruby +webhook = @client.webhook project_id, webhook_id +response = webhook.regenerate_secret + +# OR + +project = @client.project project_id +response = @client.regenerate_webhook_secret webhook_id +``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index d1a19a4..58507f3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,14 +19,18 @@ require 'ruby_lokalise_api' @client = RubyLokaliseApi.client 'YOUR_TOKEN_HERE' project = @client.project '123.abc' -project.name +project.name # => 'My Project' process = @client.upload_file project_id, data: 'Base-64 encoded data... ZnI6DQogI...', filename: 'my_file.yml', lang_iso: 'en' -process.status +process.status # => 'queued' + +reloaded_process = process.reload_data + +reloaded_process.status # => 'completed' {% endhighlight %} Looking for a Rails integration? Try the [lokalise_rails gem](https://github.com/bodrovis/lokalise_rails). Also you can use a [lokalise_manager gem](https://github.com/bodrovis/lokalise_manager) which allows to exchange translation files between Lokalise and *any* Ruby script. diff --git a/lib/ruby_lokalise_api.rb b/lib/ruby_lokalise_api.rb index 2a506c7..ffb7098 100644 --- a/lib/ruby_lokalise_api.rb +++ b/lib/ruby_lokalise_api.rb @@ -4,15 +4,19 @@ require 'faraday' require 'faraday/gzip' require 'yaml' -require 'addressable' +require 'addressable/template' loader = Zeitwerk::Loader.for_gem loader.inflector.inflect( 'oauth2' => 'OAuth2', - 'oauth2_client' => 'OAuth2Client' + 'oauth2_client' => 'OAuth2Client', + 'oauth2_endpoint' => 'OAuth2Endpoint', + 'oauth2_token' => 'OAuth2Token', + 'oauth2_refreshed_token' => 'OAuth2RefreshedToken' ) loader.setup +# Official Ruby client for Lokalise APIv2 module RubyLokaliseApi class << self # Initializes a new Client object diff --git a/lib/ruby_lokalise_api/base_client.rb b/lib/ruby_lokalise_api/base_client.rb index 2572282..7794ceb 100644 --- a/lib/ruby_lokalise_api/base_client.rb +++ b/lib/ruby_lokalise_api/base_client.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module RubyLokaliseApi + # This class contains the base client. Inherited by Client (regular API client) + # and OAuth2Client (used for OAuth-2 based authentication) class BaseClient attr_reader :token, :token_header attr_accessor :timeout, :open_timeout @@ -11,39 +13,5 @@ def initialize(token, params = {}) @open_timeout = params.fetch(:open_timeout, nil) @token_header = '' end - - # rubocop:disable Metrics/ParameterLists - # Constructs request to perform the specified action - # @param klass The actual class to call the method upon - # @param method [Symbol] The method to call (:new, :update, :create etc) - # @param endpoint_ids [Array, Hash] IDs that are used to generate the proper path to the endpoint - # @param params [Array, Hash] Request parameters - # @param object_key [String, Symbol] Key that should be used to wrap parameters into - # @param initial_ids [Array] IDs that should be used to generate base endpoint path. - # The base path is used for method chaining - def construct_request(klass, method, endpoint_ids, params = {}, object_key = nil, initial_ids = nil) - path = klass.endpoint(*endpoint_ids) - formatted_params = format_params(params, object_key) - formatted_params[:_initial_path] = klass.endpoint(*initial_ids) if initial_ids - klass.send method, self, path, formatted_params - end - # rubocop:enable Metrics/ParameterLists - - # Converts `params` to hash with arrays under the `object_key` key. - # Used in bulk operations - # - # @return [Hash] - def format_params(params, object_key) - return params unless object_key - - params = [params] unless params.is_a?(Array) - {object_key => params} - end - - def base_url; end - - def compression?; end - - alias c_r construct_request end end diff --git a/lib/ruby_lokalise_api/base_request.rb b/lib/ruby_lokalise_api/base_request.rb deleted file mode 100644 index 4266604..0000000 --- a/lib/ruby_lokalise_api/base_request.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module BaseRequest - include RubyLokaliseApi::JsonHandler - include RubyLokaliseApi::Connection - - def get(path, client, params = {}) - respond_with( - connection(client).get(prepare(path), params), - client - ) - end - - def post(path, client, params = {}) - respond_with( - connection(client).post(prepare(path), custom_dump(params)), - client - ) - end - - def put(path, client, params = {}) - respond_with( - connection(client).put(prepare(path), custom_dump(params)), - client - ) - end - - def patch(path, client, params = {}) - respond_with( - connection(client).patch(prepare(path), params.any? ? custom_dump(params) : nil), - client - ) - end - - def delete(path, client, params = {}) - respond_with( - # Rubocop tries to replace `delete` with `gsub` but that's a different method here! - # rubocop:disable Style/CollectionMethods - connection(client).delete(prepare(path)) do |req| - # rubocop:enable Style/CollectionMethods - req.body = custom_dump params - end, - client - ) - end - - private - - # Get rid of double slashes in the `path`, leading and trailing slash - def prepare(path) - path.delete_prefix('/').gsub(%r{//}, '/').gsub(%r{/+\z}, '') - end - - def raise_on_error!(response, body) - return unless !response.success? || (body.respond_to?(:has_key?) && body.key?('error')) - - respond_with_error(response.status, body) - end - - def respond_with(response, _client) - body = custom_load response.body - raise_on_error! response, body - body - end - - def respond_with_error(code, body) - raise(RubyLokaliseApi::Error, body['error'] || body) unless RubyLokaliseApi::Error::ERRORS.key? code - - raise RubyLokaliseApi::Error::ERRORS[code].from_response(body) - end - end -end diff --git a/lib/ruby_lokalise_api/client.rb b/lib/ruby_lokalise_api/client.rb index f1a4484..3fd0d94 100644 --- a/lib/ruby_lokalise_api/client.rb +++ b/lib/ruby_lokalise_api/client.rb @@ -1,43 +1,14 @@ # frozen_string_literal: true module RubyLokaliseApi + # Regular API client used to perform requests with a basic API token class Client < BaseClient - include RubyLokaliseApi::Rest::Branches - include RubyLokaliseApi::Rest::Comments - include RubyLokaliseApi::Rest::Contributors - include RubyLokaliseApi::Rest::CustomTranslationStatuses - include RubyLokaliseApi::Rest::Files - include RubyLokaliseApi::Rest::Jwt - include RubyLokaliseApi::Rest::Keys - include RubyLokaliseApi::Rest::Languages - include RubyLokaliseApi::Rest::Orders - include RubyLokaliseApi::Rest::PaymentCards - include RubyLokaliseApi::Rest::Projects - include RubyLokaliseApi::Rest::QueuedProcesses - include RubyLokaliseApi::Rest::Screenshots - include RubyLokaliseApi::Rest::Segments - include RubyLokaliseApi::Rest::Snapshots - include RubyLokaliseApi::Rest::Tasks - include RubyLokaliseApi::Rest::TeamUserBillingDetails - include RubyLokaliseApi::Rest::TeamUserGroups - include RubyLokaliseApi::Rest::TeamUsers - include RubyLokaliseApi::Rest::Teams - include RubyLokaliseApi::Rest::TranslationProviders - include RubyLokaliseApi::Rest::Translations - include RubyLokaliseApi::Rest::Webhooks + include RubyLokaliseApi::Rest def initialize(token, params = {}) super(token, params) @token_header = 'x-api-token' end - - def base_url - 'https://api.lokalise.com/api2/' - end - - def compression? - true - end end end diff --git a/lib/ruby_lokalise_api/collections/base.rb b/lib/ruby_lokalise_api/collections/base.rb index a1388c4..d0cb375 100644 --- a/lib/ruby_lokalise_api/collections/base.rb +++ b/lib/ruby_lokalise_api/collections/base.rb @@ -2,116 +2,143 @@ module RubyLokaliseApi module Collections + # Base collection. Collection is an array of resources. The actual resources can be found + # by calling the `.collection` method class Base - using RubyLokaliseApi::Utils::StringUtils - - extend RubyLokaliseApi::Request - extend RubyLokaliseApi::Utils::AttributeHelpers - include RubyLokaliseApi::Utils::AttributeHelpers - extend RubyLokaliseApi::Utils::EndpointHelpers - - attr_reader :total_pages, :total_results, :results_per_page, :current_page, :collection, - :project_id, :team_id, :request_params, :client, :path, :branch, :user_id - - # Initializes a new collection based on the response - # - # @param response [Hash] - # @param params [Hash] - # @return [RubyLokaliseApi::Collections::Base] - def initialize(response, params = {}) - produce_collection_for response - populate_pagination_data_for response - @request_params = params - popular_common_attrs response + include Enumerable + extend Forwardable + + using RubyLokaliseApi::Utils::Classes + extend RubyLokaliseApi::Utils::Attributes + extend RubyLokaliseApi::Concerns::AttrsLoadable + include RubyLokaliseApi::Utils::Keys + + ATTRS_FILENAME = 'collection_attributes.yml' + + def_delegators :collection, :[], :last, :each + + attr_reader :total_pages, :total_results, :results_per_page, :current_page, + :collection + + def initialize(response) + @self_endpoint = response.endpoint + + populate_common_attrs_from response + produce_collection_from response end - class << self - # Performs a batch query fetching multiple records - def all(client, path, params = {}) - new get(path, client, params), - params - end + # Tries to fetch the next page for paginated collection + # Returns a new collection or nil if the next page is not available + def next_page + return nil if last_page? + + self.class.new( + reinit_endpoint( + override_req_params: { page: current_page + 1 } + ).do_get + ) + end + + # Tries to fetch the previous page for paginated collection + # Returns a new collection or nil if the previous page is not available + def prev_page + return nil if first_page? + + self.class.new( + reinit_endpoint( + override_req_params: { page: current_page - 1 } + ).do_get + ) end + # Checks whether the next page is available # @return [Boolean] def next_page? - @current_page.positive? && @current_page < @total_pages + current_page.positive? && current_page < total_pages end + # Checks whether the current page is the last one # @return [Boolean] def last_page? !next_page? end + # Checks whether the previous page is available # @return [Boolean] def prev_page? - @current_page > 1 + current_page > 1 end + # Checks whether the current page is the first one # @return [Boolean] def first_page? !prev_page? end - # @return [Integer] - def next_page - return nil if last_page? + private - fetch_page @current_page + 1 + # This method is utilized to recreate an endpoint for the current collection + def reinit_endpoint(req_params: @self_endpoint.req_params, override_req_params: {}) + @self_endpoint.reinitialize( + req_params: req_params.merge(override_req_params) + ) end - # @return [Integer] - def prev_page - return nil if first_page? + def populate_common_attrs_from(response) + supported_attrs.each do |attrib| + instance_variable_set "@#{attrib}", response.content[attrib] + end + + headers = response.headers - fetch_page @current_page - 1 + return unless headers.any? + + @total_results = headers[:'x-pagination-total-count'] + @total_pages = headers[:'x-pagination-page-count'] + @results_per_page = headers[:'x-pagination-limit'] + @current_page = headers[:'x-pagination-page'] end - private + def produce_collection_from(response) + content = response.content + return unless content + + data_key_plural = collection_key_for klass: self.class.base_name + + resources_data = content[data_key_plural] + other_data = content.reject { |key, _| key == data_key_plural } - def populate_pagination_data_for(response) - @total_results = response['x-pagination-total-count'].to_i - @total_pages = response['x-pagination-page-count'].to_i - @results_per_page = response['x-pagination-limit'].to_i - @current_page = response['x-pagination-page'].to_i + @collection = build_collection resources_data, other_data end - # Gets the specified page - def fetch_page(page_num) - self.class.all @client, - @path, - @request_params.merge(page: page_num) + def build_collection(resources_data, other_data) + resources_data.map do |raw_resource| + self.class.const_get(:RESOURCE).new(resource_data(raw_resource, other_data)) + end end - # Dynamically produces collection of resources based on the given response - # Collection example: `{ "content": {"comments": [ ... ]} }` - def produce_collection_for(response) - return unless response['content'] + def resource_data(raw_resource, other_data) + RubyLokaliseApi::Response.new( + raw_resource.merge(other_data), + resource_endpoint.new( + @self_endpoint.client, + query: query_for(raw_resource, other_data) + ) + ) + end - model_class = self.class.name.base_class_name - data_key_plural = data_key_for model_class: model_class, plural: true, collection: true + def query_for(raw_resource, other_data) + main_params = self.class.const_get(:RESOURCE).const_get(:MAIN_PARAMS).to_array - # Fetch collection data and instantiate an individual resource for each object - # We also preserve the `client` to be able to chain API methods later - @collection = response['content'][data_key_plural].map do |raw_model| - Module.const_get("RubyLokaliseApi::Resources::#{model_class}").new 'content' => raw_model, - 'client' => response['client'], - 'base_path' => response['path'] + main_params.map do |param| + other_data[param.to_s] || raw_resource[param.to_s] || nil end end - def popular_common_attrs(response) - @client = response['client'] - @path = response['path'] - - return unless response['content'] + def resource_endpoint + klass = self.class - content = response['content'] - # Project, team id, user id, and branch may not be present in some cases - @project_id = content['project_id'] - @team_id = content['team_id'] - @user_id = content['user_id'] - @branch = content['branch'] + klass.const_defined?(:RESOURCES_ENDPOINT) ? klass.const_get(:RESOURCES_ENDPOINT) : klass.const_get(:ENDPOINT) end end end diff --git a/lib/ruby_lokalise_api/collections/branch.rb b/lib/ruby_lokalise_api/collections/branch.rb deleted file mode 100644 index f284d02..0000000 --- a/lib/ruby_lokalise_api/collections/branch.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Branch < Base - DATA_KEY_PLURAL = 'Branches' - - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'branches'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/branches.rb b/lib/ruby_lokalise_api/collections/branches.rb new file mode 100644 index 0000000..f6278d2 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/branches.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Branches < Base + ENDPOINT = RubyLokaliseApi::Endpoints::BranchesEndpoint + RESOURCE = RubyLokaliseApi::Resources::Branch + DATA_KEY = 'branches' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/contributor.rb b/lib/ruby_lokalise_api/collections/contributor.rb deleted file mode 100644 index 205b573..0000000 --- a/lib/ruby_lokalise_api/collections/contributor.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Contributor < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'contributors'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/contributors.rb b/lib/ruby_lokalise_api/collections/contributors.rb new file mode 100644 index 0000000..3941679 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/contributors.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Contributors < Base + ENDPOINT = RubyLokaliseApi::Endpoints::ContributorsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Contributor + end + end +end diff --git a/lib/ruby_lokalise_api/collections/custom_translation_status.rb b/lib/ruby_lokalise_api/collections/custom_translation_status.rb deleted file mode 100644 index a16fc1a..0000000 --- a/lib/ruby_lokalise_api/collections/custom_translation_status.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class CustomTranslationStatus < Base - DATA_KEY_PLURAL = 'CustomTranslationStatuses' - - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'custom_translation_statuses'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/custom_translation_statuses.rb b/lib/ruby_lokalise_api/collections/custom_translation_statuses.rb new file mode 100644 index 0000000..1fd4331 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/custom_translation_statuses.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class CustomTranslationStatuses < Base + ENDPOINT = RubyLokaliseApi::Endpoints::CustomTranslationStatusesEndpoint + RESOURCE = RubyLokaliseApi::Resources::CustomTranslationStatus + end + end +end diff --git a/lib/ruby_lokalise_api/collections/file.rb b/lib/ruby_lokalise_api/collections/file.rb deleted file mode 100644 index e5b880b..0000000 --- a/lib/ruby_lokalise_api/collections/file.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class File < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'files'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/files.rb b/lib/ruby_lokalise_api/collections/files.rb new file mode 100644 index 0000000..792ae4f --- /dev/null +++ b/lib/ruby_lokalise_api/collections/files.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Files < Base + ENDPOINT = RubyLokaliseApi::Endpoints::FilesEndpoint + RESOURCE = RubyLokaliseApi::Resources::File + end + end +end diff --git a/lib/ruby_lokalise_api/collections/key.rb b/lib/ruby_lokalise_api/collections/key.rb deleted file mode 100644 index 7ef89fa..0000000 --- a/lib/ruby_lokalise_api/collections/key.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Key < Base - # Destroys all keys in the collection - # @return [Hash] - def destroy_all - keys = collection.map(&:key_id) - RubyLokaliseApi::Resources::Key.destroy @client, @path, keys: keys - end - - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'keys'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/key_comment.rb b/lib/ruby_lokalise_api/collections/key_comment.rb deleted file mode 100644 index 2891d12..0000000 --- a/lib/ruby_lokalise_api/collections/key_comment.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class KeyComment < Base - class << self - def endpoint(project_id, key_id, *_args) - path_from projects: project_id, - keys: [key_id, 'comments'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/key_comments.rb b/lib/ruby_lokalise_api/collections/key_comments.rb new file mode 100644 index 0000000..1d9b8c1 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/key_comments.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class KeyComments < Base + ENDPOINT = RubyLokaliseApi::Endpoints::KeyCommentsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Comment + DATA_KEY = 'comments' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/keys.rb b/lib/ruby_lokalise_api/collections/keys.rb new file mode 100644 index 0000000..089b26d --- /dev/null +++ b/lib/ruby_lokalise_api/collections/keys.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Keys < Base + ENDPOINT = RubyLokaliseApi::Endpoints::KeysEndpoint + RESOURCE = RubyLokaliseApi::Resources::Key + end + end +end diff --git a/lib/ruby_lokalise_api/collections/order.rb b/lib/ruby_lokalise_api/collections/order.rb deleted file mode 100644 index 3306dae..0000000 --- a/lib/ruby_lokalise_api/collections/order.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Order < Base - class << self - def endpoint(team_id, *_args) - path_from teams: [team_id, 'orders'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/orders.rb b/lib/ruby_lokalise_api/collections/orders.rb new file mode 100644 index 0000000..c9fbc01 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/orders.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Orders < Base + ENDPOINT = RubyLokaliseApi::Endpoints::OrdersEndpoint + RESOURCE = RubyLokaliseApi::Resources::Order + end + end +end diff --git a/lib/ruby_lokalise_api/collections/payment_card.rb b/lib/ruby_lokalise_api/collections/payment_card.rb deleted file mode 100644 index f357dac..0000000 --- a/lib/ruby_lokalise_api/collections/payment_card.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class PaymentCard < Base - class << self - def endpoint(*_args) - path_from payment_cards: nil - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/payment_cards.rb b/lib/ruby_lokalise_api/collections/payment_cards.rb new file mode 100644 index 0000000..7d0f098 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/payment_cards.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class PaymentCards < Base + ENDPOINT = RubyLokaliseApi::Endpoints::PaymentCardsEndpoint + RESOURCE = RubyLokaliseApi::Resources::PaymentCard + end + end +end diff --git a/lib/ruby_lokalise_api/collections/project.rb b/lib/ruby_lokalise_api/collections/project.rb deleted file mode 100644 index 1d18bf4..0000000 --- a/lib/ruby_lokalise_api/collections/project.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Project < Base - class << self - def endpoint(*_args) - path_from projects: nil - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/project_comment.rb b/lib/ruby_lokalise_api/collections/project_comment.rb deleted file mode 100644 index c573062..0000000 --- a/lib/ruby_lokalise_api/collections/project_comment.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class ProjectComment < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'comments'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/project_comments.rb b/lib/ruby_lokalise_api/collections/project_comments.rb new file mode 100644 index 0000000..8b114ab --- /dev/null +++ b/lib/ruby_lokalise_api/collections/project_comments.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class ProjectComments < Base + ENDPOINT = RubyLokaliseApi::Endpoints::ProjectCommentsEndpoint + RESOURCES_ENDPOINT = RubyLokaliseApi::Endpoints::KeyCommentsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Comment + DATA_KEY = 'comments' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/project_language.rb b/lib/ruby_lokalise_api/collections/project_language.rb deleted file mode 100644 index 5b51c58..0000000 --- a/lib/ruby_lokalise_api/collections/project_language.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class ProjectLanguage < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'languages'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/project_languages.rb b/lib/ruby_lokalise_api/collections/project_languages.rb new file mode 100644 index 0000000..6b39e57 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/project_languages.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class ProjectLanguages < Base + ENDPOINT = RubyLokaliseApi::Endpoints::ProjectLanguagesEndpoint + RESOURCE = RubyLokaliseApi::Resources::ProjectLanguage + DATA_KEY = 'languages' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/projects.rb b/lib/ruby_lokalise_api/collections/projects.rb new file mode 100644 index 0000000..079be6b --- /dev/null +++ b/lib/ruby_lokalise_api/collections/projects.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Projects < Base + ENDPOINT = RubyLokaliseApi::Endpoints::ProjectsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Project + end + end +end diff --git a/lib/ruby_lokalise_api/collections/queued_process.rb b/lib/ruby_lokalise_api/collections/queued_process.rb deleted file mode 100644 index a1392c5..0000000 --- a/lib/ruby_lokalise_api/collections/queued_process.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class QueuedProcess < Base - DATA_KEY_PLURAL = 'Processes' - - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'processes'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/queued_processes.rb b/lib/ruby_lokalise_api/collections/queued_processes.rb new file mode 100644 index 0000000..61bb878 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/queued_processes.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class QueuedProcesses < Base + ENDPOINT = RubyLokaliseApi::Endpoints::QueuedProcessesEndpoint + RESOURCE = RubyLokaliseApi::Resources::QueuedProcess + DATA_KEY = 'processes' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/screenshot.rb b/lib/ruby_lokalise_api/collections/screenshot.rb deleted file mode 100644 index d071bef..0000000 --- a/lib/ruby_lokalise_api/collections/screenshot.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Screenshot < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'screenshots'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/screenshots.rb b/lib/ruby_lokalise_api/collections/screenshots.rb new file mode 100644 index 0000000..a0eb679 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/screenshots.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Screenshots < Base + ENDPOINT = RubyLokaliseApi::Endpoints::ScreenshotsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Screenshot + end + end +end diff --git a/lib/ruby_lokalise_api/collections/segment.rb b/lib/ruby_lokalise_api/collections/segment.rb deleted file mode 100644 index c2789b4..0000000 --- a/lib/ruby_lokalise_api/collections/segment.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Segment < Base - class << self - def endpoint(project_id, key_id, lang_iso, *_args) - path_from projects: project_id, - keys: key_id, - segments: lang_iso - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/segments.rb b/lib/ruby_lokalise_api/collections/segments.rb new file mode 100644 index 0000000..f862d94 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/segments.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Segments < Base + ENDPOINT = RubyLokaliseApi::Endpoints::SegmentsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Segment + end + end +end diff --git a/lib/ruby_lokalise_api/collections/snapshot.rb b/lib/ruby_lokalise_api/collections/snapshot.rb deleted file mode 100644 index 423a229..0000000 --- a/lib/ruby_lokalise_api/collections/snapshot.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Snapshot < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'snapshots'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/snapshots.rb b/lib/ruby_lokalise_api/collections/snapshots.rb new file mode 100644 index 0000000..1afbc63 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/snapshots.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Snapshots < Base + ENDPOINT = RubyLokaliseApi::Endpoints::SnapshotsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Snapshot + end + end +end diff --git a/lib/ruby_lokalise_api/collections/system_language.rb b/lib/ruby_lokalise_api/collections/system_language.rb deleted file mode 100644 index 93fde10..0000000 --- a/lib/ruby_lokalise_api/collections/system_language.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class SystemLanguage < Base - class << self - def endpoint(*_args) - path_from system: 'languages' - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/system_languages.rb b/lib/ruby_lokalise_api/collections/system_languages.rb new file mode 100644 index 0000000..1e4c1d6 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/system_languages.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class SystemLanguages < Base + ENDPOINT = RubyLokaliseApi::Endpoints::SystemLanguagesEndpoint + RESOURCE = RubyLokaliseApi::Resources::SystemLanguage + DATA_KEY = 'languages' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/task.rb b/lib/ruby_lokalise_api/collections/task.rb deleted file mode 100644 index 51ad42d..0000000 --- a/lib/ruby_lokalise_api/collections/task.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Task < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'tasks'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/tasks.rb b/lib/ruby_lokalise_api/collections/tasks.rb new file mode 100644 index 0000000..e451792 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/tasks.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Tasks < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TasksEndpoint + RESOURCE = RubyLokaliseApi::Resources::Task + end + end +end diff --git a/lib/ruby_lokalise_api/collections/team.rb b/lib/ruby_lokalise_api/collections/team.rb deleted file mode 100644 index 65bd775..0000000 --- a/lib/ruby_lokalise_api/collections/team.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Team < Base - class << self - def endpoint(*_args) - path_from teams: nil - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/team_user.rb b/lib/ruby_lokalise_api/collections/team_user.rb deleted file mode 100644 index ff3a928..0000000 --- a/lib/ruby_lokalise_api/collections/team_user.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class TeamUser < Base - class << self - def endpoint(team_id, *_args) - path_from teams: [team_id, 'users'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/team_user_group.rb b/lib/ruby_lokalise_api/collections/team_user_group.rb deleted file mode 100644 index f568529..0000000 --- a/lib/ruby_lokalise_api/collections/team_user_group.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class TeamUserGroup < Base - DATA_KEY = 'UserGroup' - - class << self - def endpoint(team_id, *_args) - path_from teams: [team_id, 'groups'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/team_user_groups.rb b/lib/ruby_lokalise_api/collections/team_user_groups.rb new file mode 100644 index 0000000..bda9acf --- /dev/null +++ b/lib/ruby_lokalise_api/collections/team_user_groups.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class TeamUserGroups < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TeamUserGroupsEndpoint + RESOURCE = RubyLokaliseApi::Resources::TeamUserGroup + DATA_KEY = 'user_groups' + end + end +end diff --git a/lib/ruby_lokalise_api/collections/team_users.rb b/lib/ruby_lokalise_api/collections/team_users.rb new file mode 100644 index 0000000..091efaf --- /dev/null +++ b/lib/ruby_lokalise_api/collections/team_users.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class TeamUsers < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TeamUsersEndpoint + RESOURCE = RubyLokaliseApi::Resources::TeamUser + end + end +end diff --git a/lib/ruby_lokalise_api/collections/teams.rb b/lib/ruby_lokalise_api/collections/teams.rb new file mode 100644 index 0000000..b7c913c --- /dev/null +++ b/lib/ruby_lokalise_api/collections/teams.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Teams < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TeamsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Team + end + end +end diff --git a/lib/ruby_lokalise_api/collections/translation.rb b/lib/ruby_lokalise_api/collections/translation.rb deleted file mode 100644 index 4a34300..0000000 --- a/lib/ruby_lokalise_api/collections/translation.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Translation < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'translations'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/translation_provider.rb b/lib/ruby_lokalise_api/collections/translation_provider.rb deleted file mode 100644 index 85a1045..0000000 --- a/lib/ruby_lokalise_api/collections/translation_provider.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class TranslationProvider < Base - class << self - def endpoint(team_id, *_args) - path_from teams: [team_id, 'translation_providers'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/translation_providers.rb b/lib/ruby_lokalise_api/collections/translation_providers.rb new file mode 100644 index 0000000..dd7c878 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/translation_providers.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class TranslationProviders < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TranslationProvidersEndpoint + RESOURCE = RubyLokaliseApi::Resources::TranslationProvider + end + end +end diff --git a/lib/ruby_lokalise_api/collections/translations.rb b/lib/ruby_lokalise_api/collections/translations.rb new file mode 100644 index 0000000..9c8d04a --- /dev/null +++ b/lib/ruby_lokalise_api/collections/translations.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Translations < Base + ENDPOINT = RubyLokaliseApi::Endpoints::TranslationsEndpoint + RESOURCE = RubyLokaliseApi::Resources::Translation + end + end +end diff --git a/lib/ruby_lokalise_api/collections/webhook.rb b/lib/ruby_lokalise_api/collections/webhook.rb deleted file mode 100644 index ddfe171..0000000 --- a/lib/ruby_lokalise_api/collections/webhook.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Collections - class Webhook < Base - class << self - def endpoint(project_id, *_args) - path_from projects: [project_id, 'webhooks'] - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/collections/webhooks.rb b/lib/ruby_lokalise_api/collections/webhooks.rb new file mode 100644 index 0000000..2b2ec02 --- /dev/null +++ b/lib/ruby_lokalise_api/collections/webhooks.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Collections + class Webhooks < Base + ENDPOINT = RubyLokaliseApi::Endpoints::WebhooksEndpoint + RESOURCE = RubyLokaliseApi::Resources::Webhook + end + end +end diff --git a/lib/ruby_lokalise_api/concerns/attrs_loadable.rb b/lib/ruby_lokalise_api/concerns/attrs_loadable.rb new file mode 100644 index 0000000..2ec1ed7 --- /dev/null +++ b/lib/ruby_lokalise_api/concerns/attrs_loadable.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Concerns + module AttrsLoadable + class << self + def extended(klass) + klass.class_exec do + define_method :supported_attrs do + that_klass = self.class + that_klass.const_defined?(:ATTRS) ? that_klass.const_get(:ATTRS) : [] + end + end + end + end + + def inherited(subclass) + klass_attributes = attributes_for subclass, const_get(:ATTRS_FILENAME) + + if klass_attributes&.any? + subclass.class_exec do + const_set :ATTRS, klass_attributes + attr_reader(*klass_attributes) + end + end + + super + end + end + end +end diff --git a/lib/ruby_lokalise_api/concerns/hash_accessible.rb b/lib/ruby_lokalise_api/concerns/hash_accessible.rb new file mode 100644 index 0000000..da7a35b --- /dev/null +++ b/lib/ruby_lokalise_api/concerns/hash_accessible.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Concerns + # Adds the `[]` method for invariant access + module HashAccessible + def [](raw_key_attr) + key_attr = :"@#{raw_key_attr}" + + return nil unless instance_variables.include?(key_attr) && respond_to?(raw_key_attr.to_sym) + + instance_variable_get(key_attr) + end + end + end +end diff --git a/lib/ruby_lokalise_api/concerns/unsupportable.rb b/lib/ruby_lokalise_api/concerns/unsupportable.rb new file mode 100644 index 0000000..550e1fa --- /dev/null +++ b/lib/ruby_lokalise_api/concerns/unsupportable.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Concerns + # Allows to undefine certain methods + module Unsupportable + def no_support_for(methods) + return unless methods.any? + + methods.each do |method| + undef_method(method) + end + end + end + end +end diff --git a/lib/ruby_lokalise_api/connection.rb b/lib/ruby_lokalise_api/connection.rb index 1e01d4c..1e7f3d8 100644 --- a/lib/ruby_lokalise_api/connection.rb +++ b/lib/ruby_lokalise_api/connection.rb @@ -1,40 +1,49 @@ # frozen_string_literal: true module RubyLokaliseApi + # Module to setup connection using Faraday module Connection - def connection(client) - Faraday.new(options(client), request_params_for(client)) do |faraday| + + # Creates a new Faraday object with specified params + def connection(endpoint) + Faraday.new(options(endpoint), request_params_for(endpoint.client)) do |faraday| faraday.adapter Faraday.default_adapter - faraday.request(:gzip) if client.compression? + faraday.request(:gzip) end end private - def options(client) - params = __base_options(client) + def options(endpoint) + params = __base_options(endpoint) + client = endpoint.client if client.respond_to?(:token) && client.respond_to?(:token_header) params[:headers][client.token_header] = client.token end - params[:headers][:accept_encoding] = 'gzip,deflate,br' if client.compression? + params[:headers][:accept_encoding] = 'gzip,deflate,br' params end - def __base_options(client) + def __base_options(endpoint) { headers: { accept: 'application/json', user_agent: "ruby-lokalise-api gem/#{RubyLokaliseApi::VERSION}" }, - url: client.base_url + url: endpoint.base_url } end # Allows to customize request params per-client def request_params_for(client) - {request: {timeout: client.timeout, open_timeout: client.open_timeout}} + { + request: { + timeout: client.timeout, + open_timeout: client.open_timeout + } + } end end end diff --git a/lib/ruby_lokalise_api/data/collection_attributes.yml b/lib/ruby_lokalise_api/data/collection_attributes.yml new file mode 100644 index 0000000..1e06490 --- /dev/null +++ b/lib/ruby_lokalise_api/data/collection_attributes.yml @@ -0,0 +1,52 @@ +branches: + - project_id + - branch +contributors: + - project_id + - branch +comments: + - project_id + - branch +custom_translation_statuses: + - project_id + - branch +files: + - project_id + - branch +keys: + - project_id + - branch + - errors +orders: + - team_id +payment_cards: + - user_id +project_languages: + - project_id + - branch +queued_processes: + - project_id + - branch +segments: + - project_id + - key_id + - language_iso +screenshots: + - project_id + - branch + - errors +snapshots: + - project_id + - branch +tasks: + - project_id + - branch +team_users: + - team_id +team_user_groups: + - team_id +translations: + - project_id + - branch +webhooks: + - project_id \ No newline at end of file diff --git a/lib/ruby_lokalise_api/data/attributes.yml b/lib/ruby_lokalise_api/data/resource_attributes.yml similarity index 81% rename from lib/ruby_lokalise_api/data/attributes.yml rename to lib/ruby_lokalise_api/data/resource_attributes.yml index 0ca0a72..1420f6e 100644 --- a/lib/ruby_lokalise_api/data/attributes.yml +++ b/lib/ruby_lokalise_api/data/resource_attributes.yml @@ -1,4 +1,5 @@ branch: + - project_id - branch_id - name - created_at @@ -6,6 +7,8 @@ branch: - created_by - created_by_email comment: + - project_id + - branch - comment_id - key_id - comment @@ -14,6 +17,8 @@ comment: - added_at - added_at_timestamp contributor: + - project_id + - branch - user_id - email - fullname @@ -24,15 +29,22 @@ contributor: - languages - admin_rights custom_translation_status: + - project_id + - branch - status_id - title - color file: + - branch + - project_id + - file_id - filename - key_count jwt: - jwt key: + - branch + - project_id - key_id - created_at - created_at_timestamp @@ -56,15 +68,21 @@ key: - modified_at_timestamp - translations_modified_at - translations_modified_at_timestamp -language: - - lang_id - - lang_iso - - lang_name - - is_rtl - - plural_forms +o_auth2_token: + - access_token + - refresh_token + - expires_in + - token_type +o_auth2_refreshed_token: + - access_token + - scope + - expires_in + - token_type order: + - team_id - order_id - project_id + - branch - card_id - status - created_at @@ -84,6 +102,7 @@ order: - payment_method - dry_run payment_card: + - user_id - card_id - last4 - brand @@ -91,6 +110,7 @@ payment_card: - created_at_timestamp project: - project_id + - project_type - name - description - created_at @@ -102,7 +122,17 @@ project: - base_language_iso - settings - statistics +project_language: + - project_id + - branch + - lang_id + - lang_iso + - lang_name + - is_rtl + - plural_forms queued_process: + - project_id + - branch - process_id - type - status @@ -113,8 +143,11 @@ queued_process: - created_at_timestamp - details screenshot: + - project_id + - branch - screenshot_id - key_ids + - keys - url - title - description @@ -124,6 +157,9 @@ screenshot: - created_at - created_at_timestamp segment: + - project_id + - key_id + - language_iso - segment_number - language_iso - modified_at @@ -137,13 +173,23 @@ segment: - words - custom_translation_statuses snapshot: + - project_id + - branch - snapshot_id - title - created_at - created_at_timestamp - created_by - created_by_email +system_language: + - lang_id + - lang_iso + - lang_name + - is_rtl + - plural_forms task: + - branch + - project_id - task_id - title - description @@ -157,6 +203,7 @@ task: - created_at_timestamp - created_by - created_by_email + - source_language_iso - can_be_parent - task_type - parent_task_id @@ -180,6 +227,7 @@ team: - quota_usage - quota_allowed team_user: + - team_id - user_id - email - fullname @@ -187,6 +235,7 @@ team_user: - created_at_timestamp - role team_user_billing_details: + - team_id - billing_email - country_code - zip @@ -198,6 +247,7 @@ team_user_billing_details: - company - vatnumber team_user_group: + - team_id - group_id - name - permissions @@ -207,6 +257,10 @@ team_user_group: - projects - members translation: + - project_id + - branch + - segment_number + - reviewed_by - translation_id - key_id - language_iso @@ -217,10 +271,12 @@ translation: - translation - is_fuzzy - is_reviewed + - is_unverified - words - custom_translation_statuses - task_id translation_provider: + - team_id - provider_id - name - slug @@ -230,6 +286,8 @@ translation_provider: - tiers - pairs webhook: + - project_id + - branch - webhook_id - url - secret diff --git a/lib/ruby_lokalise_api/endpoints/base_endpoint.rb b/lib/ruby_lokalise_api/endpoints/base_endpoint.rb new file mode 100644 index 0000000..2b94367 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/base_endpoint.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class BaseEndpoint + using RubyLokaliseApi::Utils::Classes + include RubyLokaliseApi::Request + + attr_reader :client, :req_params, :uri + + BASE_URL = '' + PARTIAL_URI_TEMPLATE = '{/segments*}' + + def initialize(client, params = {}) + @query_params = params[:query].to_array + @client = client + @req_params = params[:req] + @uri = nil + end + + def reinitialize(query_params: nil, req_params: {}) + @query_params = query_params || @query_params + @req_params = req_params || @req_params + @uri = partial_uri(base_query(*@query_params)) + + self + end + + def base_url + self.class.const_get(:BASE_URL) + end + + def full_uri + base_url + uri + end + + private + + HTTP_METHODS_REGEXP = /\Ado_(get|post|put|delete|patch)\z/.freeze + + def respond_to_missing?(method, _include_all) + return true if HTTP_METHODS_REGEXP.match?(method.to_s) + + super + end + + def method_missing(method, *_args) + if method.to_s =~ HTTP_METHODS_REGEXP + send Regexp.last_match(1), self + else + super + end + end + + def base_query(*_args); end + + def partial_uri(*_args) + Addressable::Template.new partial_uri_template + end + + def partial_uri_template + self.class.const_get(:PARTIAL_URI_TEMPLATE) + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/branches_endpoint.rb b/lib/ruby_lokalise_api/endpoints/branches_endpoint.rb new file mode 100644 index 0000000..2cd9c26 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/branches_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class BranchesEndpoint < MainEndpoint + private + + def base_query(project_id, branch_id = nil, action = nil) + { + projects: project_id, + branches: [branch_id, action] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb b/lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb new file mode 100644 index 0000000..8deb60a --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class ContributorsEndpoint < MainEndpoint + private + + def base_query(project_id, contributor_id = nil) + { + projects: project_id, + contributors: contributor_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb b/lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb new file mode 100644 index 0000000..8c40b15 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class CustomTranslationStatusesEndpoint < MainEndpoint + private + + def base_query(project_id, status_id = nil) + { + projects: project_id, + custom_translation_statuses: status_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/files_endpoint.rb b/lib/ruby_lokalise_api/endpoints/files_endpoint.rb new file mode 100644 index 0000000..6fd281e --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/files_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class FilesEndpoint < MainEndpoint + private + + def base_query(project_id, action = nil) + { + projects: project_id, + files: action + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb b/lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb new file mode 100644 index 0000000..fafc5db --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class JwtsEndpoint < MainEndpoint + private + + def base_query(project_id) + { + projects: [project_id, :tokens] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb b/lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb new file mode 100644 index 0000000..ccf13bd --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class KeyCommentsEndpoint < MainEndpoint + private + + def base_query(project_id, key_id, comment_id = nil) + { + projects: project_id, + keys: key_id, + comments: comment_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/keys_endpoint.rb b/lib/ruby_lokalise_api/endpoints/keys_endpoint.rb new file mode 100644 index 0000000..23c616f --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/keys_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class KeysEndpoint < MainEndpoint + private + + def base_query(project_id, key_id = nil) + { + projects: project_id, + keys: key_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/main_endpoint.rb b/lib/ruby_lokalise_api/endpoints/main_endpoint.rb new file mode 100644 index 0000000..ff36274 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/main_endpoint.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class MainEndpoint < BaseEndpoint + BASE_URL = 'https://api.lokalise.com/api2' + + def initialize(client, params = {}) + super client, params + + @uri = partial_uri(base_query(*@query_params)) + end + + private + + def partial_uri(segments, *_args) + template = super + + template.expand( + segments: segments.to_a.flatten + ).to_s + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb b/lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb new file mode 100644 index 0000000..390d7fd --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + module OAuth2 + class OAuth2Endpoint < BaseEndpoint + BASE_URL = 'https://app.lokalise.com/oauth2' + PARTIAL_URI_TEMPLATE = '{/segments*}{?query*}' + + def initialize(client, params = {}) + super client, params + + @uri = partial_uri(base_query(*@query_params), params.fetch(:get, [])) + end + + private + + def partial_uri(segments, query) + template = super + + template.expand( + segments: segments.to_a.flatten, + query: query.filter { |_k, v| !v.nil? } + ).to_s + end + + def base_query(segment = nil) + [segment] + end + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/orders_endpoint.rb b/lib/ruby_lokalise_api/endpoints/orders_endpoint.rb new file mode 100644 index 0000000..ee10282 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/orders_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class OrdersEndpoint < MainEndpoint + private + + def base_query(team_id, order_id = nil) + { + teams: team_id, + orders: order_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb b/lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb new file mode 100644 index 0000000..e504fdb --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class PaymentCardsEndpoint < MainEndpoint + private + + def base_query(card_id = nil, *_args) + { + payment_cards: card_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb b/lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb new file mode 100644 index 0000000..1e5faf8 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class ProjectCommentsEndpoint < MainEndpoint + private + + def base_query(project_id) + { + projects: [project_id, :comments] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb b/lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb new file mode 100644 index 0000000..2aab657 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class ProjectLanguagesEndpoint < MainEndpoint + private + + def base_query(project_id, language_id = nil) + { + projects: project_id, + languages: language_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/projects_endpoint.rb b/lib/ruby_lokalise_api/endpoints/projects_endpoint.rb new file mode 100644 index 0000000..c41fcf8 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/projects_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class ProjectsEndpoint < MainEndpoint + private + + def base_query(project_id = nil, action = nil) + { + projects: [project_id, action] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb b/lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb new file mode 100644 index 0000000..08e9ae2 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class QueuedProcessesEndpoint < MainEndpoint + private + + def base_query(project_id, process_id = nil) + { + projects: project_id, + processes: process_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb b/lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb new file mode 100644 index 0000000..903512e --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class ScreenshotsEndpoint < MainEndpoint + private + + def base_query(project_id, screenshots_id = nil) + { + projects: project_id, + screenshots: screenshots_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/segments_endpoint.rb b/lib/ruby_lokalise_api/endpoints/segments_endpoint.rb new file mode 100644 index 0000000..a386479 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/segments_endpoint.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class SegmentsEndpoint < MainEndpoint + private + + def base_query(project_id, key_id, language_iso, segment_number = nil) + { + projects: project_id, + keys: key_id, + segments: [language_iso, segment_number] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb b/lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb new file mode 100644 index 0000000..1ba26e6 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class SnapshotsEndpoint < MainEndpoint + private + + def base_query(project_id, snapshot_id = nil) + { + projects: project_id, + snapshots: snapshot_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb b/lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb new file mode 100644 index 0000000..97ad498 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class SystemLanguagesEndpoint < MainEndpoint + private + + def base_query(*_args) + { + system: :languages + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb b/lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb new file mode 100644 index 0000000..37c4a0b --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TasksEndpoint < MainEndpoint + private + + def base_query(project_id, task_id = nil) + { + projects: project_id, + tasks: task_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb b/lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb new file mode 100644 index 0000000..673122f --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TeamUserBillingDetailsEndpoint < MainEndpoint + private + + def base_query(team_id) + { + teams: [team_id, :billing_details] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb b/lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb new file mode 100644 index 0000000..efd8010 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TeamUserGroupsEndpoint < MainEndpoint + private + + def base_query(team_id, group_id = nil, *actions) + { + teams: team_id, + groups: [group_id, actions] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb b/lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb new file mode 100644 index 0000000..e1aa9b9 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TeamUsersEndpoint < MainEndpoint + private + + def base_query(team_id, user_id = nil) + { + teams: team_id, + users: user_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/teams_endpoint.rb b/lib/ruby_lokalise_api/endpoints/teams_endpoint.rb new file mode 100644 index 0000000..d1ca7c6 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/teams_endpoint.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TeamsEndpoint < MainEndpoint + private + + def base_query(*_args) + [:teams] + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb b/lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb new file mode 100644 index 0000000..0c56276 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TranslationProvidersEndpoint < MainEndpoint + private + + def base_query(team_id, provider_id = nil) + { + teams: team_id, + translation_providers: provider_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/translations_endpoint.rb b/lib/ruby_lokalise_api/endpoints/translations_endpoint.rb new file mode 100644 index 0000000..99561e1 --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/translations_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class TranslationsEndpoint < MainEndpoint + private + + def base_query(project_id, translation_id = nil) + { + projects: project_id, + translations: translation_id + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb b/lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb new file mode 100644 index 0000000..e3c8c5e --- /dev/null +++ b/lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Endpoints + class WebhooksEndpoint < MainEndpoint + private + + def base_query(project_id, webhook_id = nil, *actions) + { + projects: project_id, + webhooks: [webhook_id, actions] + } + end + end + end +end diff --git a/lib/ruby_lokalise_api/error.rb b/lib/ruby_lokalise_api/error.rb index 1e01082..4a03845 100644 --- a/lib/ruby_lokalise_api/error.rb +++ b/lib/ruby_lokalise_api/error.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module RubyLokaliseApi + # Standard API errors class Error < StandardError ClientError = Class.new(self) ServerError = Class.new(self) diff --git a/lib/ruby_lokalise_api/generics.rb b/lib/ruby_lokalise_api/generics.rb new file mode 100644 index 0000000..fc500ff --- /dev/null +++ b/lib/ruby_lokalise_api/generics.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + # Simple generic objects to decorate certain responses (usually, related to data deletion) + class Generics + include RubyLokaliseApi::Concerns::HashAccessible + + DeletedResource = Class.new(self) + EmptiedResource = Class.new(self) + CustomStatusAvailableColors = Class.new(self) + DownloadBundle = Class.new(self) + MergedBranches = Class.new(self) + RegeneratedWebhookSecret = Class.new(self) + + def initialize(raw_data) + raw_data.each do |att, val| + instance_variable_set "@#{att}", val + + self.class.class_exec do + attr_reader att.to_sym + end + end + end + end +end diff --git a/lib/ruby_lokalise_api/json_handler.rb b/lib/ruby_lokalise_api/json_handler.rb index 6f1050b..fb6c1b4 100644 --- a/lib/ruby_lokalise_api/json_handler.rb +++ b/lib/ruby_lokalise_api/json_handler.rb @@ -3,9 +3,8 @@ require 'json' module RubyLokaliseApi + # JSON custom parser. Uses built-in JSON by default but can be overridden to any other parser module JsonHandler - # JSON custom parser. Uses built-in JSON by default but can be overridden to any other parser - # Converts Ruby object to JSON def custom_dump(obj) JSON.dump obj diff --git a/lib/ruby_lokalise_api/oauth2/auth.rb b/lib/ruby_lokalise_api/oauth2/auth.rb index 32eff85..bdf4efb 100644 --- a/lib/ruby_lokalise_api/oauth2/auth.rb +++ b/lib/ruby_lokalise_api/oauth2/auth.rb @@ -3,10 +3,10 @@ module RubyLokaliseApi module OAuth2 class Auth - include RubyLokaliseApi::BaseRequest - attr_reader :client_id, :client_secret, :timeout, :open_timeout + OAUTH2_ENDPOINT = RubyLokaliseApi::Endpoints::OAuth2::OAuth2Endpoint + def initialize(client_id, client_secret, params = {}) @client_id = client_id @client_secret = client_secret @@ -14,61 +14,55 @@ def initialize(client_id, client_secret, params = {}) @open_timeout = params[:open_timeout] end - def auth(scope:, redirect_uri: nil, state: nil) - scope = scope.join(' ') if scope.is_a?(Array) + def oauth2_endpoint + self.class.const_get(:OAUTH2_ENDPOINT) + end - params = { + def auth(scope:, redirect_uri: nil, state: nil) + get_params = { client_id: client_id, - scope: scope + scope: (scope.is_a?(Array) ? scope.join(' ') : scope), + state: state, + redirect_uri: redirect_uri } - params[:state] = state unless state.nil? - params[:redirect_uri] = redirect_uri unless redirect_uri.nil? - _build_url_from params + oauth2_endpoint.new(self, query: 'auth', get: get_params).full_uri end def token(code) - params = base_params.merge({ - code: code, - grant_type: 'authorization_code' - }) - - RubyLokaliseApi::OAuth2::Token.new post('token', self, params) - end - - def refresh(token) - params = base_params.merge({ - refresh_token: token, - grant_type: 'refresh_token' - }) + endpoint = oauth2_endpoint.new( + self, + query: :token, + req: common_params.merge( + grant_type: 'authorization_code', + code: code + ) + ) - RubyLokaliseApi::OAuth2::Refresh.new post('token', self, params) + RubyLokaliseApi::Resources::OAuth2Token.new endpoint.do_post end - def base_url - URI('https://app.lokalise.com/oauth2/') - end + def refresh(refresh_token) + endpoint = oauth2_endpoint.new( + self, + query: :token, + req: common_params.merge( + grant_type: 'refresh_token', + refresh_token: refresh_token + ) + ) - def compression? - false + RubyLokaliseApi::Resources::OAuth2RefreshedToken.new endpoint.do_post end private - def base_params + def common_params { - client_id: client_id, - client_secret: client_secret + client_id: @client_id, + client_secret: @client_secret } end - - def _build_url_from(params) - URI::HTTPS.build( - host: base_url.host, - path: "#{base_url.path}auth", - query: URI.encode_www_form(params) - ).to_s - end end end end diff --git a/lib/ruby_lokalise_api/oauth2/refresh.rb b/lib/ruby_lokalise_api/oauth2/refresh.rb deleted file mode 100644 index 69114ba..0000000 --- a/lib/ruby_lokalise_api/oauth2/refresh.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module OAuth2 - class Refresh - attr_reader :access_token, :expires_in, :scope, :token_type - - def initialize(raw_params) - @access_token = raw_params['access_token'] - @expires_in = raw_params['expires_in'] - @scope = raw_params['scope'] - @token_type = raw_params['token_type'] - end - end - end -end diff --git a/lib/ruby_lokalise_api/oauth2/token.rb b/lib/ruby_lokalise_api/oauth2/token.rb deleted file mode 100644 index 7c4a9f4..0000000 --- a/lib/ruby_lokalise_api/oauth2/token.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module OAuth2 - class Token - attr_reader :access_token, :refresh_token, :expires_in, :token_type - - def initialize(raw_params) - @access_token = raw_params['access_token'] - @refresh_token = raw_params['refresh_token'] - @expires_in = raw_params['expires_in'] - @token_type = raw_params['token_type'] - end - end - end -end diff --git a/lib/ruby_lokalise_api/oauth2_client.rb b/lib/ruby_lokalise_api/oauth2_client.rb index da08310..3493f05 100644 --- a/lib/ruby_lokalise_api/oauth2_client.rb +++ b/lib/ruby_lokalise_api/oauth2_client.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module RubyLokaliseApi + # Client used to perform API requests with an OAuth2 access token class OAuth2Client < Client + include RubyLokaliseApi::Rest + def initialize(token, params = {}) super(token, params) @token_header = 'Authorization' diff --git a/lib/ruby_lokalise_api/request.rb b/lib/ruby_lokalise_api/request.rb index 10edf92..300f08f 100644 --- a/lib/ruby_lokalise_api/request.rb +++ b/lib/ruby_lokalise_api/request.rb @@ -1,31 +1,79 @@ # frozen_string_literal: true module RubyLokaliseApi + # Contains methods to perform the actual HTTP requests module Request - include RubyLokaliseApi::BaseRequest + include RubyLokaliseApi::JsonHandler + include RubyLokaliseApi::Connection - # Lokalise returns pagination info in special headers - PAGINATION_HEADERS = %w[x-pagination-total-count x-pagination-page-count x-pagination-limit - x-pagination-page].freeze + # Sends a GET request + def get(endpoint) + respond_with( + connection(endpoint).get(prepare(endpoint.uri), endpoint.req_params), + endpoint + ) + end + + # Sends a POST request + def post(endpoint) + respond_with( + connection(endpoint).post(prepare(endpoint.uri), custom_dump(endpoint.req_params)), + endpoint + ) + end + + # Sends a PUT request + def put(endpoint) + respond_with( + connection(endpoint).put(prepare(endpoint.uri), custom_dump(endpoint.req_params)), + endpoint + ) + end + + # Sends a PATCH request + def patch(endpoint) + respond_with( + connection(endpoint).patch(prepare(endpoint.uri), + endpoint.req_params.nil? ? nil : custom_dump(endpoint.req_params)), + endpoint + ) + end + + # Sends a DELETE request + def delete(endpoint) + respond_with( + connection(endpoint).delete(prepare(endpoint.uri)) do |req| + req.body = custom_dump endpoint.req_params + end, + endpoint + ) + end private - def respond_with(response, client) + # Get rid of double slashes in the `path`, leading and trailing slash + def prepare(path) + path.delete_prefix('/').gsub(%r{//}, '/').gsub(%r{/+\z}, '') + end + + def raise_on_error!(response, body) + return unless !response.success? || (body.respond_to?(:has_key?) && body.key?('error')) + + respond_with_error(response.status, body) + end + + def respond_with(response, endpoint) body = custom_load response.body - uri = Addressable::URI.parse response.env.url + raise_on_error! response, body - extract_headers_from(response). - merge('content' => body, - 'client' => client, - 'path' => uri.path.gsub(%r{/api2/}, '')) - end - - # Keep only pagination headers - def extract_headers_from(response) - response. - headers. - to_h. - keep_if { |k, _v| PAGINATION_HEADERS.include?(k) } + + RubyLokaliseApi::Response.new(body, endpoint, response.headers) + end + + def respond_with_error(code, body) + raise(RubyLokaliseApi::Error, body['error'] || body) unless RubyLokaliseApi::Error::ERRORS.key? code + + raise RubyLokaliseApi::Error::ERRORS[code].from_response(body) end end end diff --git a/lib/ruby_lokalise_api/resources/base.rb b/lib/ruby_lokalise_api/resources/base.rb index 4928d63..bb0634d 100644 --- a/lib/ruby_lokalise_api/resources/base.rb +++ b/lib/ruby_lokalise_api/resources/base.rb @@ -1,218 +1,77 @@ # frozen_string_literal: true module RubyLokaliseApi + # Base resource class. A resource is an individual object returned by the API module Resources class Base - using RubyLokaliseApi::Utils::StringUtils + using RubyLokaliseApi::Utils::Classes + extend RubyLokaliseApi::Utils::Attributes + extend RubyLokaliseApi::Concerns::Unsupportable + extend RubyLokaliseApi::Concerns::AttrsLoadable + include RubyLokaliseApi::Concerns::HashAccessible + include RubyLokaliseApi::Utils::Keys - extend RubyLokaliseApi::Request - extend RubyLokaliseApi::Utils::AttributeHelpers - include RubyLokaliseApi::Utils::AttributeHelpers - extend RubyLokaliseApi::Utils::EndpointHelpers + ATTRS_FILENAME = 'resource_attributes.yml' - attr_reader :raw_data, :project_id, :client, :path, :branch, :user_id, :team_id, :key_id + def initialize(response) + @self_endpoint = response.endpoint - # Initializes a new resource based on the response. - # `endpoint_generator` is used in cases when a new instance is generated - # from a different resource. For example, restoring from a snapshot - # creates a totally different project which should have a new path. - # - # @param response [Hash] - # @param endpoint_generator [Proc] Generate proper paths for certain resources - # @return [RubyLokaliseApi::Resources::Base] - def initialize(response, endpoint_generator = nil) - populate_attributes_for response['content'] - extract_common_attributes_for response['content'] - @client = response['client'] - @path = infer_path_from response, endpoint_generator + populate_attrs_from response.content end - # Returns object attribute with [] notation by calling - # the corresponding method on the object if the - # instance variable named after the requested key exists - # - # @param raw_key_attr [String or Hash] - def [](raw_key_attr) - key_attr = raw_key_attr.to_s.to_sym + # Updates the current resource + def update(params) + self.class.new reinit_endpoint(params).do_put + end - return nil unless instance_variables.include?(:"@#{key_attr}") + # Deletes the current resource + def destroy + RubyLokaliseApi::Generics::DeletedResource.new( + reinit_endpoint.do_delete.content + ) + end - send key_attr + # Reloads the current resource with new values from the API + def reload_data + self.class.new reinit_endpoint.do_get end class << self - # Dynamically adds attribute readers for each inherited class. - # Attributes are defined in the `data/attributes.json` file. - # Also sets the `ATTRIBUTES` constant to assign values to each attribute later when - # the response arrives from the API - def inherited(subclass) - klass_attributes = attributes_for subclass - subclass.class_exec do - const_set :ATTRIBUTES, klass_attributes - attr_reader(*klass_attributes) - end - super - end - - # Defines CRUD instance methods. In the simplest case it delegates work to the - # class method. In more complex case it is possible to specify sub-path and the - # class method name to call. - # Usage: `supports :update, :destroy, [:complex_method, '/sub/path', :update]` - def supports(*methods) - methods.each do |m_data| - # `method_name` - the method that the resource should support - # `sub_path` - a string that has to be appended to a base path - # `c_method` - method name to delegate the work to - method_name, sub_path, c_method = - m_data.is_a?(Array) ? m_data : [m_data, '', m_data] - - define_method method_name do |params = {}| - path = instance_variable_get(:@path) - # If there's a sub_path which is a string, - # preserve the initial path to allow further chaining - params = params.merge(_initial_path: path) if sub_path - self.class.send c_method, instance_variable_get(:@client), - path + sub_path, params - end + # Delegates instance method calls to the client methods + def delegate_call(from, to = nil) + define_method(from) do |*args| + @self_endpoint.client.send((to || from), *read_main_params.push(*args)) end end - - # Fetches a single record - def find(client, path, params = {}) - new get(path, client, prepare_params(params)) - end - - # Creates one or multiple records - def create(client, path, params) - response = post path, client, prepare_params(params) - object_from response, params - end - - # Updates one or multiple records - def update(client, path, params) - response = put path, client, prepare_params(params) - object_from response, params - end - - # Destroys records by given ids - def destroy(client, path, params = {}) - delete(path, client, prepare_params(params))['content'] - end - - private - - # Filters out internal attributes that should not be sent to Lokalise - def prepare_params(params) - filter_attrs = %i[_initial_path] - params.reject { |key, _v| filter_attrs.include?(key) } - end - - # Instantiates a new resource or collection based on the given response - def object_from(response, params) - model_class = name.base_class_name - data_key_plural = data_key_for model_class: model_class, plural: true - # Preserve the initial path to allow chaining - response['path'] = params.delete(:_initial_path) if params.key?(:_initial_path) - - if response['content'].key?(data_key_plural) - produce_collection model_class, response, params - else - produce_resource model_class, response - end - end - - def produce_resource(model_class, response) - content = response['content'] - data_key_singular = data_key_for model_class: model_class - if content.key? data_key_singular - data = content.delete data_key_singular - - data.is_a?(Hash) ? content.merge!(data) : content[data_key_singular] = data - end - - new response - end - - def produce_collection(model_class, response, params) - Module.const_get("RubyLokaliseApi::Collections::#{model_class}").new(response, params) - end end - # Generates path for the individual resource based on the path for the collection - def infer_path_from(response, endpoint_generator = nil) - id_key = id_key_for self.class.name.base_class_name - data_key = data_key_for model_class: self.class.name.base_class_name - - path_with_id response, id_key, data_key, endpoint_generator - end + private - def path_with_id(response, id_key, data_key, endpoint_generator = nil) - # Some resources do not have ids at all - return unless response['content'] && (response['content'].key?(id_key) || response['content'].key?(data_key)) - - # ID of the resource - id = id_from response, id_key, data_key - - # If `endpoint_generator` is present, generate a new path - # based on the fetched id - if endpoint_generator - path = endpoint_generator.call project_id, id - return path.remove_trailing_slash + def read_main_params + self.class.const_get(:MAIN_PARAMS).to_array.map do |param| + instance_variable_get "@#{param}" end - - path = response['path'] || response['base_path'] - # If path already has id - just return it - return path if path.match?(/#{id}\z/) - - # Otherwise this looks like a collection path, so append the resource id to it - path.remove_trailing_slash + "/#{id}" end - def id_from(response, id_key, data_key) - # Content may be `{"project_id": '123', ...}` or {"snapshot": {"snapshot_id": '123', ...}} - # Sometimes there is an `id_key` but it has a value of `null` - # (for example when we do not place the actual order but only check its price). - # In rare cases the actual identifier does not have an "_id" suffix - # (for segments that have "segment_number" field instead) - # Therefore we must explicitly check if the key is present - content = response['content'] - return content[id_key] if content.respond_to?(:key?) && content&.key?(id_key) - - content[data_key][id_key] + def reinit_endpoint(req_params = {}) + @self_endpoint.reinitialize(query_params: read_main_params, req_params: req_params) end - # Store all resources attributes under the corresponding instance variables. - # `ATTRIBUTES` is defined inside resource-specific classes - def populate_attributes_for(content) + def populate_attrs_from(content) return unless content - data_key = data_key_for model_class: self.class.name.base_class_name + data_key = data_key_for klass: self.class.base_name - self.class.const_get(:ATTRIBUTES).each do |attr| - value = if content.key?(data_key) && content[data_key].is_a?(Hash) - content[data_key][attr] + supported_attrs.each do |attrib| + value = if content.key?(data_key) && content[data_key].is_a?(Hash) && content[data_key].key?(attrib) + content[data_key][attrib] else - content[attr] + content[attrib] end - instance_variable_set "@#{attr}", value + instance_variable_set "@#{attrib}", value end end - - # Extracts all common attributes that resources have. - # Some of them may be absent in certain cases. - # rubocop:disable Naming/MemoizedInstanceVariableName - def extract_common_attributes_for(content) - return unless content - - @raw_data = content - @project_id ||= content['project_id'] - @user_id ||= content['user_id'] - @team_id ||= content['team_id'] - @key_id ||= content['key_id'] - @branch ||= content['branch'] - end - # rubocop:enable Naming/MemoizedInstanceVariableName end end end diff --git a/lib/ruby_lokalise_api/resources/branch.rb b/lib/ruby_lokalise_api/resources/branch.rb index 465225a..5394f0f 100644 --- a/lib/ruby_lokalise_api/resources/branch.rb +++ b/lib/ruby_lokalise_api/resources/branch.rb @@ -3,28 +3,9 @@ module RubyLokaliseApi module Resources class Branch < Base - ID_KEY = 'branch_id' - supports :update, :destroy, [:reload_data, '', :find] + MAIN_PARAMS = %i[project_id branch_id].freeze - def merge(params = {}) - klass = self.class - klass.merge @client, klass.endpoint(project_id, branch_id, :merge), params - end - - class << self - def merge(client, path, params, *_args) - post(path, client, params)['content'] - end - - def endpoint(project_id, branch_id = nil, action = nil) - params = {projects: project_id, - branches: branch_id} - - params[:merge] = '' if action == :merge - - path_from params - end - end + delegate_call :merge, :merge_branch end end end diff --git a/lib/ruby_lokalise_api/resources/comment.rb b/lib/ruby_lokalise_api/resources/comment.rb new file mode 100644 index 0000000..aeed7e6 --- /dev/null +++ b/lib/ruby_lokalise_api/resources/comment.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Resources + class Comment < Base + MAIN_PARAMS = %i[project_id key_id comment_id].freeze + + no_support_for %i[update] + end + end +end diff --git a/lib/ruby_lokalise_api/resources/contributor.rb b/lib/ruby_lokalise_api/resources/contributor.rb index 0b2e6d6..8e710fe 100644 --- a/lib/ruby_lokalise_api/resources/contributor.rb +++ b/lib/ruby_lokalise_api/resources/contributor.rb @@ -3,15 +3,7 @@ module RubyLokaliseApi module Resources class Contributor < Base - ID_KEY = 'user_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def endpoint(project_id, contributor_id = nil) - path_from projects: project_id, - contributors: contributor_id - end - end + MAIN_PARAMS = %i[project_id user_id].freeze end end end diff --git a/lib/ruby_lokalise_api/resources/custom_translation_status.rb b/lib/ruby_lokalise_api/resources/custom_translation_status.rb index a7c6abf..f409f90 100644 --- a/lib/ruby_lokalise_api/resources/custom_translation_status.rb +++ b/lib/ruby_lokalise_api/resources/custom_translation_status.rb @@ -3,19 +3,7 @@ module RubyLokaliseApi module Resources class CustomTranslationStatus < Base - ID_KEY = 'status_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def colors(client, path, *_args) - get(path, client)['content']['colors'] - end - - def endpoint(project_id, status_id = nil) - path_from projects: project_id, - custom_translation_statuses: status_id - end - end + MAIN_PARAMS = %i[project_id status_id].freeze end end end diff --git a/lib/ruby_lokalise_api/resources/file.rb b/lib/ruby_lokalise_api/resources/file.rb index 2291c85..70704d4 100644 --- a/lib/ruby_lokalise_api/resources/file.rb +++ b/lib/ruby_lokalise_api/resources/file.rb @@ -3,22 +3,8 @@ module RubyLokaliseApi module Resources class File < Base - class << self - def download(client, path, params) - post(path, client, params)['content'] - end - - def upload(client, path, params) - klass = RubyLokaliseApi::Resources::QueuedProcess - klass.new post(path, client, params), - ->(project_id, id) { klass.endpoint(project_id, id) } - end - - def endpoint(project_id, action = '') - path_from projects: project_id, - files: action - end - end + MAIN_PARAMS = %i[project_id file_id].freeze + no_support_for %i[update reload_data] end end end diff --git a/lib/ruby_lokalise_api/resources/jwt.rb b/lib/ruby_lokalise_api/resources/jwt.rb index 49f9f2c..a7ac604 100644 --- a/lib/ruby_lokalise_api/resources/jwt.rb +++ b/lib/ruby_lokalise_api/resources/jwt.rb @@ -3,11 +3,8 @@ module RubyLokaliseApi module Resources class Jwt < Base - class << self - def endpoint(project_id, *_args) - path_from projects: project_id, tokens: '' - end - end + MAIN_PARAMS = :project_id + no_support_for %i[update destroy reload_data] end end end diff --git a/lib/ruby_lokalise_api/resources/key.rb b/lib/ruby_lokalise_api/resources/key.rb index 763ff7e..0697af9 100644 --- a/lib/ruby_lokalise_api/resources/key.rb +++ b/lib/ruby_lokalise_api/resources/key.rb @@ -3,15 +3,12 @@ module RubyLokaliseApi module Resources class Key < Base - ID_KEY = 'key_id' - supports :update, :destroy, [:reload_data, '', :find] + MAIN_PARAMS = %i[project_id key_id].freeze - class << self - def endpoint(project_id, key_id = nil) - path_from projects: project_id, - keys: key_id - end - end + delegate_call :key_comment, :comment + delegate_call :key_comments, :comments + delegate_call :create_comments + delegate_call :destroy_comment end end end diff --git a/lib/ruby_lokalise_api/resources/key_comment.rb b/lib/ruby_lokalise_api/resources/key_comment.rb deleted file mode 100644 index 3ddb6d7..0000000 --- a/lib/ruby_lokalise_api/resources/key_comment.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Resources - class KeyComment < Base - DATA_KEY = 'Comment' - ID_KEY = 'comment_id' - supports :destroy, [:reload_data, '', :find] - - class << self - def endpoint(project_id, key_id, comment_id = nil) - path_from projects: project_id, - keys: key_id, - comments: comment_id - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb b/lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb new file mode 100644 index 0000000..0a423e9 --- /dev/null +++ b/lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Resources + class OAuth2RefreshedToken < Base + no_support_for %i[update destroy reload_data] + end + end +end diff --git a/lib/ruby_lokalise_api/resources/project_comment.rb b/lib/ruby_lokalise_api/resources/oauth2_token.rb similarity index 51% rename from lib/ruby_lokalise_api/resources/project_comment.rb rename to lib/ruby_lokalise_api/resources/oauth2_token.rb index 08f9f9c..ef8ecdb 100644 --- a/lib/ruby_lokalise_api/resources/project_comment.rb +++ b/lib/ruby_lokalise_api/resources/oauth2_token.rb @@ -2,9 +2,8 @@ module RubyLokaliseApi module Resources - class ProjectComment < Base - ID_KEY = 'comment_id' - DATA_KEY = 'Comment' + class OAuth2Token < Base + no_support_for %i[update destroy reload_data] end end end diff --git a/lib/ruby_lokalise_api/resources/order.rb b/lib/ruby_lokalise_api/resources/order.rb index cc53810..56c054b 100644 --- a/lib/ruby_lokalise_api/resources/order.rb +++ b/lib/ruby_lokalise_api/resources/order.rb @@ -3,15 +3,8 @@ module RubyLokaliseApi module Resources class Order < Base - ID_KEY = 'order_id' - supports [:reload_data, '', :find] - - class << self - def endpoint(team_id, order_id = nil) - path_from teams: team_id, - orders: order_id - end - end + MAIN_PARAMS = %i[team_id order_id].freeze + no_support_for %i[update destroy] end end end diff --git a/lib/ruby_lokalise_api/resources/payment_card.rb b/lib/ruby_lokalise_api/resources/payment_card.rb index e6f8746..6e4ec42 100644 --- a/lib/ruby_lokalise_api/resources/payment_card.rb +++ b/lib/ruby_lokalise_api/resources/payment_card.rb @@ -3,14 +3,8 @@ module RubyLokaliseApi module Resources class PaymentCard < Base - ID_KEY = 'card_id' - supports :destroy, [:reload_data, '', :find] - - class << self - def endpoint(card_id = nil) - path_from payment_cards: card_id - end - end + MAIN_PARAMS = %i[card_id].freeze + no_support_for %i[update] end end end diff --git a/lib/ruby_lokalise_api/resources/project.rb b/lib/ruby_lokalise_api/resources/project.rb index d9fe6b8..b073048 100644 --- a/lib/ruby_lokalise_api/resources/project.rb +++ b/lib/ruby_lokalise_api/resources/project.rb @@ -3,22 +3,91 @@ module RubyLokaliseApi module Resources class Project < Base - ID_KEY = 'project_id' - supports :update, :destroy, [:reload_data, '', :find] - - def empty - self.class.empty @client, "#{@path}/empty" - end - - class << self - def empty(client, path, *_args) - put(path, client)['content'] - end - - def endpoint(project_id = nil, action = nil) - path_from projects: [project_id, action] - end - end + MAIN_PARAMS = :project_id + + delegate_call :empty, :empty_project + + delegate_call :branches + delegate_call :branch + delegate_call :create_branch + delegate_call :update_branch + delegate_call :destroy_branch + delegate_call :merge_branch + + delegate_call :key_comment, :comment + delegate_call :key_comments, :comments + delegate_call :project_comments + delegate_call :create_comments + delegate_call :destroy_comment + + delegate_call :contributor + delegate_call :contributors + delegate_call :create_contributors + delegate_call :update_contributor + delegate_call :destroy_contributor + + delegate_call :custom_translation_status + delegate_call :custom_translation_statuses + delegate_call :create_custom_translation_status + delegate_call :update_custom_translation_status + delegate_call :destroy_custom_translation_status + delegate_call :custom_translation_status_colors + + delegate_call :files + delegate_call :upload_file + delegate_call :download_files + delegate_call :destroy_file + + delegate_call :create_jwt + + delegate_call :keys + delegate_call :key + delegate_call :create_keys + delegate_call :update_key + delegate_call :update_keys + delegate_call :destroy_key + delegate_call :destroy_keys + + delegate_call :languages, :project_languages + delegate_call :language, :project_language + delegate_call :create_languages, :create_project_languages + delegate_call :update_language, :update_project_language + delegate_call :destroy_language, :destroy_project_language + + delegate_call :queued_process + delegate_call :queued_processes + + delegate_call :segments + delegate_call :segment + delegate_call :update_segment + + delegate_call :screenshots + delegate_call :screenshot + delegate_call :create_screenshots + delegate_call :update_screenshot + delegate_call :destroy_screenshot + + delegate_call :snapshots + delegate_call :create_snapshot + delegate_call :restore_snapshot + delegate_call :destroy_snapshot + + delegate_call :tasks + delegate_call :task + delegate_call :create_task + delegate_call :update_task + delegate_call :destroy_task + + delegate_call :translations + delegate_call :translation + delegate_call :update_translation + + delegate_call :webhooks + delegate_call :webhook + delegate_call :create_webhook + delegate_call :update_webhook + delegate_call :regenerate_webhook_secret + delegate_call :destroy_webhook end end end diff --git a/lib/ruby_lokalise_api/resources/project_language.rb b/lib/ruby_lokalise_api/resources/project_language.rb index 67ac28b..2bd2a5c 100644 --- a/lib/ruby_lokalise_api/resources/project_language.rb +++ b/lib/ruby_lokalise_api/resources/project_language.rb @@ -3,16 +3,8 @@ module RubyLokaliseApi module Resources class ProjectLanguage < Base - DATA_KEY = 'Language' - ID_KEY = 'lang_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def endpoint(project_id, language_id = nil) - path_from projects: project_id, - languages: language_id - end - end + MAIN_PARAMS = %i[project_id lang_id].freeze + DATA_KEY = 'language' end end end diff --git a/lib/ruby_lokalise_api/resources/queued_process.rb b/lib/ruby_lokalise_api/resources/queued_process.rb index 65c9cfa..41ecd56 100644 --- a/lib/ruby_lokalise_api/resources/queued_process.rb +++ b/lib/ruby_lokalise_api/resources/queued_process.rb @@ -3,16 +3,9 @@ module RubyLokaliseApi module Resources class QueuedProcess < Base - DATA_KEY = 'Process' - ID_KEY = 'process_id' - supports [:reload_data, '', :find] - - class << self - def endpoint(project_id, process_id = nil) - path_from projects: project_id, - processes: process_id - end - end + MAIN_PARAMS = %i[project_id process_id].freeze + no_support_for %i[update destroy] + DATA_KEY = 'process' end end end diff --git a/lib/ruby_lokalise_api/resources/screenshot.rb b/lib/ruby_lokalise_api/resources/screenshot.rb index 11610c9..99c3f90 100644 --- a/lib/ruby_lokalise_api/resources/screenshot.rb +++ b/lib/ruby_lokalise_api/resources/screenshot.rb @@ -3,15 +3,7 @@ module RubyLokaliseApi module Resources class Screenshot < Base - ID_KEY = 'screenshot_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def endpoint(project_id, screenshot_id = nil) - path_from projects: project_id, - screenshots: screenshot_id - end - end + MAIN_PARAMS = %i[project_id screenshot_id].freeze end end end diff --git a/lib/ruby_lokalise_api/resources/segment.rb b/lib/ruby_lokalise_api/resources/segment.rb index bc44feb..2c31dc4 100644 --- a/lib/ruby_lokalise_api/resources/segment.rb +++ b/lib/ruby_lokalise_api/resources/segment.rb @@ -3,17 +3,8 @@ module RubyLokaliseApi module Resources class Segment < Base - DATA_KEY = 'Segment' - ID_KEY = 'segment_number' - supports :update, [:reload_data, '', :find] - - class << self - def endpoint(project_id, key_id, lang_iso, segment_number = nil) - path_from projects: project_id, - keys: key_id, - segments: [lang_iso, segment_number] - end - end + MAIN_PARAMS = %i[project_id key_id language_iso segment_number].freeze + no_support_for %i[destroy] end end end diff --git a/lib/ruby_lokalise_api/resources/snapshot.rb b/lib/ruby_lokalise_api/resources/snapshot.rb index f780649..0d759d5 100644 --- a/lib/ruby_lokalise_api/resources/snapshot.rb +++ b/lib/ruby_lokalise_api/resources/snapshot.rb @@ -3,25 +3,10 @@ module RubyLokaliseApi module Resources class Snapshot < Base - ID_KEY = 'snapshot_id' - supports :destroy + MAIN_PARAMS = %i[project_id snapshot_id].freeze + no_support_for %i[update reload_data] - def restore - self.class.restore @client, @path - end - - class << self - def restore(client, path, *_args) - klass = RubyLokaliseApi::Resources::Project - klass.new post(path, client), - ->(project_id, *_ids) { klass.endpoint(project_id) } - end - - def endpoint(project_id, snapshot_id = nil) - path_from projects: project_id, - snapshots: snapshot_id - end - end + delegate_call :restore, :restore_snapshot end end end diff --git a/lib/ruby_lokalise_api/resources/system_language.rb b/lib/ruby_lokalise_api/resources/system_language.rb index 3212d7b..51ad8a7 100644 --- a/lib/ruby_lokalise_api/resources/system_language.rb +++ b/lib/ruby_lokalise_api/resources/system_language.rb @@ -3,7 +3,8 @@ module RubyLokaliseApi module Resources class SystemLanguage < Base - DATA_KEY = 'Language' + MAIN_PARAMS = [].freeze + no_support_for %i[update destroy reload_data] end end end diff --git a/lib/ruby_lokalise_api/resources/task.rb b/lib/ruby_lokalise_api/resources/task.rb index 8b42814..0f5c443 100644 --- a/lib/ruby_lokalise_api/resources/task.rb +++ b/lib/ruby_lokalise_api/resources/task.rb @@ -3,15 +3,7 @@ module RubyLokaliseApi module Resources class Task < Base - ID_KEY = 'task_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def endpoint(project_id, task_id = nil) - path_from projects: project_id, - tasks: task_id - end - end + MAIN_PARAMS = %i[project_id task_id].freeze end end end diff --git a/lib/ruby_lokalise_api/resources/team.rb b/lib/ruby_lokalise_api/resources/team.rb index 2b1a49e..a994c8c 100644 --- a/lib/ruby_lokalise_api/resources/team.rb +++ b/lib/ruby_lokalise_api/resources/team.rb @@ -3,6 +3,8 @@ module RubyLokaliseApi module Resources class Team < Base + MAIN_PARAMS = [].freeze + no_support_for %i[update destroy reload_data] end end end diff --git a/lib/ruby_lokalise_api/resources/team_user.rb b/lib/ruby_lokalise_api/resources/team_user.rb index 9acf531..99f7a59 100644 --- a/lib/ruby_lokalise_api/resources/team_user.rb +++ b/lib/ruby_lokalise_api/resources/team_user.rb @@ -3,15 +3,7 @@ module RubyLokaliseApi module Resources class TeamUser < Base - ID_KEY = 'user_id' - supports :update, :destroy, [:reload_data, '', :find] - - class << self - def endpoint(team_id, team_user_id = nil) - path_from teams: team_id, - users: team_user_id - end - end + MAIN_PARAMS = %i[team_id user_id].freeze end end end diff --git a/lib/ruby_lokalise_api/resources/team_user_billing_details.rb b/lib/ruby_lokalise_api/resources/team_user_billing_details.rb index 55c6746..a5f3664 100644 --- a/lib/ruby_lokalise_api/resources/team_user_billing_details.rb +++ b/lib/ruby_lokalise_api/resources/team_user_billing_details.rb @@ -3,11 +3,16 @@ module RubyLokaliseApi module Resources class TeamUserBillingDetails < Base - class << self - def endpoint(team_id) - path_from teams: team_id, - billing_details: '' - end + MAIN_PARAMS = %i[team_id].freeze + no_support_for %i[destroy] + + def update(params) + response = reinit_endpoint(params).do_put + + # We must patch content because the API does not return team_id and it's mandatory to build resource URL + response.patch_content_with 'team_id', @team_id + + self.class.new response end end end diff --git a/lib/ruby_lokalise_api/resources/team_user_group.rb b/lib/ruby_lokalise_api/resources/team_user_group.rb index 4119ca2..68853da 100644 --- a/lib/ruby_lokalise_api/resources/team_user_group.rb +++ b/lib/ruby_lokalise_api/resources/team_user_group.rb @@ -3,21 +3,13 @@ module RubyLokaliseApi module Resources class TeamUserGroup < Base - DATA_KEY = 'Group' - ID_KEY = 'group_id' - supports :update, :destroy, - [:add_projects, '/projects/add', :update], - [:remove_projects, '/projects/remove', :update], - [:add_users, '/members/add', :update], - [:remove_users, '/members/remove', :update], - [:reload_data, '', :find] + MAIN_PARAMS = %i[team_id group_id].freeze + DATA_KEY = 'group' - class << self - def endpoint(team_id, team_user_group_id = nil, *actions) - path_from teams: team_id, - groups: [team_user_group_id, *actions] - end - end + delegate_call :add_projects, :add_projects_to_group + delegate_call :remove_projects, :remove_projects_from_group + delegate_call :add_members, :add_members_to_group + delegate_call :remove_members, :remove_members_from_group end end end diff --git a/lib/ruby_lokalise_api/resources/translation.rb b/lib/ruby_lokalise_api/resources/translation.rb index 1efff13..0511f2b 100644 --- a/lib/ruby_lokalise_api/resources/translation.rb +++ b/lib/ruby_lokalise_api/resources/translation.rb @@ -3,15 +3,8 @@ module RubyLokaliseApi module Resources class Translation < Base - ID_KEY = 'translation_id' - supports :update, [:reload_data, '', :find] - - class << self - def endpoint(project_id, translation_id = nil) - path_from projects: project_id, - translations: translation_id - end - end + MAIN_PARAMS = %i[project_id translation_id].freeze + no_support_for %i[destroy] end end end diff --git a/lib/ruby_lokalise_api/resources/translation_provider.rb b/lib/ruby_lokalise_api/resources/translation_provider.rb index 9bbd5df..138d48e 100644 --- a/lib/ruby_lokalise_api/resources/translation_provider.rb +++ b/lib/ruby_lokalise_api/resources/translation_provider.rb @@ -3,15 +3,8 @@ module RubyLokaliseApi module Resources class TranslationProvider < Base - supports [:reload_data, '', :find] - ID_KEY = 'provider_id' - - class << self - def endpoint(team_id, provider_id = nil) - path_from teams: team_id, - translation_providers: provider_id - end - end + MAIN_PARAMS = %i[team_id provider_id].freeze + no_support_for %i[update destroy] end end end diff --git a/lib/ruby_lokalise_api/resources/webhook.rb b/lib/ruby_lokalise_api/resources/webhook.rb index 9e99ac5..679a5c6 100644 --- a/lib/ruby_lokalise_api/resources/webhook.rb +++ b/lib/ruby_lokalise_api/resources/webhook.rb @@ -3,23 +3,9 @@ module RubyLokaliseApi module Resources class Webhook < Base - ID_KEY = 'webhook_id' - supports :update, :destroy, [:reload_data, '', :find] + MAIN_PARAMS = %i[project_id webhook_id].freeze - def regenerate_secret - self.class.regenerate_secret @client, "#{@path}/secret/regenerate" - end - - class << self - def regenerate_secret(client, path, *_args) - patch(path, client)['content'] - end - - def endpoint(project_id, webhook_id = nil, *actions) - path_from projects: project_id, - webhooks: [webhook_id, *actions] - end - end + delegate_call :regenerate_secret, :regenerate_webhook_secret end end end diff --git a/lib/ruby_lokalise_api/response.rb b/lib/ruby_lokalise_api/response.rb new file mode 100644 index 0000000..dc43cc3 --- /dev/null +++ b/lib/ruby_lokalise_api/response.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + # This class is utilized to prepare Lokalise API response + class Response + # Lokalise returns pagination info in special headers + PAGINATION_HEADERS = %w[x-pagination-total-count x-pagination-page-count x-pagination-limit + x-pagination-page].freeze + + attr_reader :content, :endpoint, :headers + + def initialize(body, endpoint, raw_headers = {}) + @content = body + @endpoint = endpoint + @headers = extract_headers_from raw_headers + end + + # Adds attribute to the raw content returned by the API. + # Sometimes this is required to store important data like team_id or project_id + # that is not returned in the response but required to properly build resources URIs + def patch_content_with(attribute, value) + @content[attribute] = value + end + + # Sets endpoint to a new value. + # This is required in rare cases when the response contains a resource of different kind. + # For example, when restoring a snapshot, it returns a new project which means that + # initially we were working with a snapshots endpoint but the response should contain + # the projects endpoint to properly preserve method chaining + def patch_endpoint_with(new_endpoint) + @endpoint = new_endpoint + end + + # Returns an array of pagination headers + def pagination_headers + self.class.const_get(:PAGINATION_HEADERS) + end + + private + + # Keep only pagination headers + def extract_headers_from(raw_headers) + raw_headers. + to_h. + keep_if { |header, _value| pagination_headers.include?(header) }. + transform_keys(&:to_sym). + transform_values(&:to_i) + end + end +end diff --git a/lib/ruby_lokalise_api/rest.rb b/lib/ruby_lokalise_api/rest.rb new file mode 100644 index 0000000..4737a85 --- /dev/null +++ b/lib/ruby_lokalise_api/rest.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Rest + include Utils::Loaders + + include Rest::Branches + include Rest::Comments + include Rest::Contributors + include Rest::CustomTranslationStatuses + include Rest::Files + include Rest::Jwts + include Rest::Keys + include Rest::Languages + include Rest::Orders + include Rest::PaymentCards + include Rest::Projects + include Rest::QueuedProcesses + include Rest::Segments + include Rest::Screenshots + include Rest::Snapshots + include Rest::Tasks + include Rest::TeamUserBillingDetails + include Rest::Teams + include Rest::TeamUsers + include Rest::TeamUserGroups + include Rest::TranslationProviders + include Rest::Translations + include Rest::Webhooks + end +end diff --git a/lib/ruby_lokalise_api/rest/branches.rb b/lib/ruby_lokalise_api/rest/branches.rb index 223e570..d4aae79 100644 --- a/lib/ruby_lokalise_api/rest/branches.rb +++ b/lib/ruby_lokalise_api/rest/branches.rb @@ -3,66 +3,91 @@ module RubyLokaliseApi module Rest module Branches - # Returns all branches for the given project + # Returns project branches # # @see https://developers.lokalise.com/reference/list-all-branches - # @return [RubyLokaliseApi::Collection::Branch] + # @return [RubyLokaliseApi::Collections::Branches] # @param project_id [String] - # @param params [Hash] - def branches(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Branch, :all, project_id, params + # @param req_params [Hash] + def branches(project_id, req_params = {}) + name = 'Branches' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Creates a new branch inside the given project + # Returns a single branch # - # @see https://developers.lokalise.com/reference/create-a-branch + # @see https://developers.lokalise.com/reference/retrieve-a-branch # @return [RubyLokaliseApi::Resources::Branch] # @param project_id [String] - # @param params [Hash] - def create_branch(project_id, params) - c_r RubyLokaliseApi::Resources::Branch, :create, project_id, params + # @param branch_id [String, Integer] + def branch(project_id, branch_id) + params = { query: [project_id, branch_id] } + + data = endpoint(name: 'Branches', params: params).do_get + + resource 'Branch', data end - # Returns a single branch for the given project + # Creates a branch # - # @see https://developers.lokalise.com/reference/retrieve-a-branch + # @see https://developers.lokalise.com/reference/create-a-branch # @return [RubyLokaliseApi::Resources::Branch] # @param project_id [String] - # @param branch_id [String, Integer] - def branch(project_id, branch_id) - c_r RubyLokaliseApi::Resources::Branch, :find, [project_id, branch_id] + # @param req_params [Hash] + def create_branch(project_id, req_params) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'Branches', params: params).do_post + + resource 'Branch', data end - # Updates the given branch inside the given project + # Updates a branch # # @see https://developers.lokalise.com/reference/update-a-branch # @return [RubyLokaliseApi::Resources::Branch] # @param project_id [String] # @param branch_id [String, Integer] - # @param params [Hash] - def update_branch(project_id, branch_id, params) - c_r RubyLokaliseApi::Resources::Branch, :update, [project_id, branch_id], params + # @param req_params [Hash] + def update_branch(project_id, branch_id, req_params = {}) + params = { query: [project_id, branch_id], req: req_params } + + data = endpoint(name: 'Branches', params: params).do_put + + resource 'Branch', data end - # Deletes branch inside the given project + # Deletes a branch # # @see https://developers.lokalise.com/reference/delete-a-branch - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param branch_id [String, Integer] def destroy_branch(project_id, branch_id) - c_r RubyLokaliseApi::Resources::Branch, :destroy, [project_id, branch_id] + params = { query: [project_id, branch_id] } + + data = endpoint(name: 'Branches', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end - # Merges a branch in the project + # Merges two branches # # @see https://developers.lokalise.com/reference/merge-a-branch - # @return [Hash] + # @return [RubyLokaliseApi::Generics::MergedBranches] # @param project_id [String] # @param branch_id [String, Integer] - # @param params [Hash] - def merge_branch(project_id, branch_id, params = {}) - c_r RubyLokaliseApi::Resources::Branch, :merge, [project_id, branch_id, :merge], params + # @param req_params [Hash] + def merge_branch(project_id, branch_id, req_params) + params = { query: [project_id, branch_id, :merge], req: req_params } + + data = endpoint(name: 'Branches', params: params).do_post + + RubyLokaliseApi::Generics::MergedBranches.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/comments.rb b/lib/ruby_lokalise_api/rest/comments.rb index 0d5853a..2be44e1 100644 --- a/lib/ruby_lokalise_api/rest/comments.rb +++ b/lib/ruby_lokalise_api/rest/comments.rb @@ -3,7 +3,9 @@ module RubyLokaliseApi module Rest module Comments - # Returns a single comment for the given key + using RubyLokaliseApi::Utils::Classes + + # Returns a single key comment # # @see https://developers.lokalise.com/reference/retrieve-a-comment # @return [RubyLokaliseApi::Resources::Comment] @@ -11,50 +13,73 @@ module Comments # @param key_id [String, Integer] # @param comment_id [String, Integer] def comment(project_id, key_id, comment_id) - c_r RubyLokaliseApi::Resources::KeyComment, :find, [project_id, key_id, comment_id] + params = { query: [project_id, key_id, comment_id] } + + data = endpoint(name: 'KeyComments', params: params).do_get + + resource 'Comment', data end - # Returns all comments for all keys inside the given project + # Returns all comments for a key # - # @see https://developers.lokalise.com/reference/list-project-comments - # @return [RubyLokaliseApi::Collection::Comment] + # @see https://developers.lokalise.com/reference/list-key-comments + # @return [RubyLokaliseApi::Collections::KeyComments] # @param project_id [String] - # @param params [Hash] - def project_comments(project_id, params = {}) - c_r RubyLokaliseApi::Collections::ProjectComment, :all, project_id, params + # @param key_id [String, Integer] + # @param req_params [Hash] + def comments(project_id, key_id, req_params = {}) + name = 'KeyComments' + params = { query: [project_id, key_id], req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns all comments for the given key inside the given project + # Returns all comments for a project # - # @see https://developers.lokalise.com/reference/list-key-comments - # @return [RubyLokaliseApi::Collection::Comment] + # @see https://developers.lokalise.com/reference/list-project-comments + # @return [RubyLokaliseApi::Collections::ProjectComments] # @param project_id [String] - # @param key_id [String, Integer] - # @param params [Hash] - def comments(project_id, key_id, params = {}) - c_r RubyLokaliseApi::Collections::KeyComment, :all, [project_id, key_id], params + # @param req_params [Hash] + def project_comments(project_id, req_params = {}) + name = 'ProjectComments' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Creates one or more comments for the given key inside the given project + # Creates one or multiple comments for a key # # @see https://developers.lokalise.com/reference/create-comments - # @return [RubyLokaliseApi::Collection::Comment] + # @return [RubyLokaliseApi::Collections::KeyComments] # @param project_id [String] # @param key_id [String, Integer] - # @param params [Hash, Array] - def create_comments(project_id, key_id, params) - c_r RubyLokaliseApi::Resources::KeyComment, :create, [project_id, key_id], params, :comments + # @param req_params [Hash, Array] + def create_comments(project_id, key_id, req_params) + name = 'KeyComments' + params = { query: [project_id, key_id], req: req_params.to_array_obj(:comments) } + + data = endpoint(name: name, params: params).do_post + + collection name, data end - # Deletes comment for the given key inside the given project + # Deletes a single key comment # # @see https://developers.lokalise.com/reference/delete-a-comment - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param key_id [String, Integer] # @param comment_id [String, Integer] def destroy_comment(project_id, key_id, comment_id) - c_r RubyLokaliseApi::Resources::KeyComment, :destroy, [project_id, key_id, comment_id] + params = { query: [project_id, key_id, comment_id] } + + data = endpoint(name: 'KeyComments', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/contributors.rb b/lib/ruby_lokalise_api/rest/contributors.rb index 4c1be7c..cdb1a7e 100644 --- a/lib/ruby_lokalise_api/rest/contributors.rb +++ b/lib/ruby_lokalise_api/rest/contributors.rb @@ -3,55 +3,79 @@ module RubyLokaliseApi module Rest module Contributors - # Returns all contributors for the given project - # - # @see https://developers.lokalise.com/reference/list-all-contributors - # @return [RubyLokaliseApi::Collection::Contributor] - # @param project_id [String] - # @param params [Hash] - def contributors(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Contributor, :all, project_id, params - end + using RubyLokaliseApi::Utils::Classes - # Returns a single contributor for the given project + # Returns a single contributor # # @see https://developers.lokalise.com/reference/retrieve-a-contributor # @return [RubyLokaliseApi::Resources::Contributor] # @param project_id [String] # @param contributor_id [String, Integer] def contributor(project_id, contributor_id) - c_r RubyLokaliseApi::Resources::Contributor, :find, [project_id, contributor_id] + params = { query: [project_id, contributor_id] } + + data = endpoint(name: 'Contributors', params: params).do_get + + resource 'Contributor', data end - # Creates one or more contributors inside the given project + # Returns project contributors + # + # @see https://developers.lokalise.com/reference/list-all-contributors + # @return [RubyLokaliseApi::Collections::Contributors] + # @param project_id [String] + # @param req_params [Hash] + def contributors(project_id, req_params = {}) + name = 'Contributors' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data + end + + # Creates one or multiple contributors for a project # # @see https://developers.lokalise.com/reference/create-contributors - # @return [RubyLokaliseApi::Collection::Contributor] + # @return [RubyLokaliseApi::Collections::Contributors] # @param project_id [String] - # @param params [Hash, Array] - def create_contributors(project_id, params) - c_r RubyLokaliseApi::Resources::Contributor, :create, project_id, params, :contributors + # @param req_params [Hash, Array] + def create_contributors(project_id, req_params) + name = 'Contributors' + params = { query: project_id, req: req_params.to_array_obj(:contributors) } + + data = endpoint(name: name, params: params).do_post + + collection name, data end - # Updates the given contributor inside the given project + # Updates a contributor for a project # # @see https://developers.lokalise.com/reference/update-a-contributor # @return [RubyLokaliseApi::Resources::Contributor] # @param project_id [String] # @param contributor_id [String, Integer] - # @param params [Hash] - def update_contributor(project_id, contributor_id, params) - c_r RubyLokaliseApi::Resources::Contributor, :update, [project_id, contributor_id], params + # @param req_params [Hash] + def update_contributor(project_id, contributor_id, req_params) + params = { query: [project_id, contributor_id], req: req_params } + + data = endpoint(name: 'Contributors', params: params).do_put + + resource 'Contributor', data end - # Deletes contributor inside the given project + # Deletes a single contributor from the project # # @see https://developers.lokalise.com/reference/delete-a-contributor - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param contributor_id [String, Integer] def destroy_contributor(project_id, contributor_id) - c_r RubyLokaliseApi::Resources::Contributor, :destroy, [project_id, contributor_id] + params = { query: [project_id, contributor_id] } + + data = endpoint(name: 'Contributors', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb b/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb index caf064a..d42e6dc 100644 --- a/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb +++ b/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb @@ -3,65 +3,89 @@ module RubyLokaliseApi module Rest module CustomTranslationStatuses - # Returns all translation statuses for the given project + # Returns a custom translation status # - # @see https://developers.lokalise.com/reference/list-all-custom-translation-statuses - # @return [RubyLokaliseApi::Collection::CustomTranslationStatus - # ] + # @see https://developers.lokalise.com/reference/retrieve-a-status + # @return [RubyLokaliseApi::Resources::CustomTranslationStatus] # @param project_id [String] - # @param params [Hash] - def translation_statuses(project_id, params = {}) - c_r RubyLokaliseApi::Collections::CustomTranslationStatus, :all, project_id, params + # @param status_id [String, Integer] + def custom_translation_status(project_id, status_id) + params = { query: [project_id, status_id] } + + data = endpoint(name: 'CustomTranslationStatuses', params: params).do_get + + resource 'CustomTranslationStatus', data end - # Returns a single translation status for the given project + # Returns custom translation statuses for the project # - # @see https://developers.lokalise.com/reference/retrieve-a-custom-translation-status - # @return [RubyLokaliseApi::Resources::CustomTranslationStatus] + # @see https://developers.lokalise.com/reference/list-all-statuses + # @return [RubyLokaliseApi::Collections::CustomTranslationStatuses] # @param project_id [String] - # @param status_id [String, Integer] - def translation_status(project_id, status_id) - c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :find, [project_id, status_id] + # @param req_params [Hash] + def custom_translation_statuses(project_id, req_params = {}) + name = 'CustomTranslationStatuses' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Creates translation status inside the given project + # Creates a custom translation status # - # @see https://developers.lokalise.com/reference/create-a-custom-translation-status - # @return RubyLokaliseApi::Resources::CustomTranslationStatus + # @see https://developers.lokalise.com/reference/create-a-status + # @return [RubyLokaliseApi::Resources::CustomTranslationStatus] # @param project_id [String] - # @param params Hash - def create_translation_status(project_id, params) - c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :create, project_id, params + # @param req_params [Hash] + def create_custom_translation_status(project_id, req_params) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'CustomTranslationStatuses', params: params).do_post + + resource 'CustomTranslationStatus', data end - # Updates the given translation status inside the given project + # Updates a custom translation status # - # @see https://developers.lokalise.com/reference/update-a-custom-translation-status + # @see https://developers.lokalise.com/reference/update-a-status # @return [RubyLokaliseApi::Resources::CustomTranslationStatus] # @param project_id [String] - # @param status_id [String, Integer] - # @param params [Hash] - def update_translation_status(project_id, status_id, params) - c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :update, [project_id, status_id], params + # @param status_id [Integer, String] + # @param req_params [Hash] + def update_custom_translation_status(project_id, status_id, req_params = {}) + params = { query: [project_id, status_id], req: req_params } + + data = endpoint(name: 'CustomTranslationStatuses', params: params).do_put + + resource 'CustomTranslationStatus', data end - # Deletes translation status inside the given project + # Deletes a custom translation status # - # @see https://developers.lokalise.com/reference/delete-a-custom-translation-status - # @return [Hash] + # @see https://developers.lokalise.com/reference/delete-a-status + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] - # @param status_id [String, Integer] - def destroy_translation_status(project_id, status_id) - c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :destroy, [project_id, status_id] + # @param status_id [Integer, String] + def destroy_custom_translation_status(project_id, status_id) + params = { query: [project_id, status_id] } + + data = endpoint(name: 'CustomTranslationStatuses', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end - # Returns an array of available colors that can be assigned to custom translation statuses + # Retrieves an array of available colors that can be assigned to custom translation statuses # - # @see https://developers.lokalise.com/reference/retrieve-available-colors-for-custom-translation-statuses - # @return [Array] + # @see https://developers.lokalise.com/reference/retrieve-available-colors + # @return [RubyLokaliseApi::Generics::CustomStatusAvailableColors] # @param project_id [String] - def translation_status_colors(project_id) - c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :colors, [project_id, 'colors'] + def custom_translation_status_colors(project_id) + params = { query: [project_id, :colors] } + + data = endpoint(name: 'CustomTranslationStatuses', params: params).do_get + + RubyLokaliseApi::Generics::CustomStatusAvailableColors.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/files.rb b/lib/ruby_lokalise_api/rest/files.rb index b29f07a..3abacb9 100644 --- a/lib/ruby_lokalise_api/rest/files.rb +++ b/lib/ruby_lokalise_api/rest/files.rb @@ -3,47 +3,66 @@ module RubyLokaliseApi module Rest module Files - # Returns all translation files for the given project + # Returns project files # # @see https://developers.lokalise.com/reference/list-all-files - # @return [RubyLokaliseApi::Collection::File] + # @return [RubyLokaliseApi::Collections::Files] # @param project_id [String] - # @param params [Hash] - def files(project_id, params = {}) - c_r RubyLokaliseApi::Collections::File, :all, project_id, params + # @param req_params [Hash] + def files(project_id, req_params = {}) + name = 'Files' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Exports translation files as .zip bundle, uploads them to Amazon S3 and - # returns a URL to the generated bundle. The URL is valid for a year + # Uploads translation file to the project in the background # - # @see https://developers.lokalise.com/reference/download-files - # @return [Hash] + # @see https://developers.lokalise.com/reference/upload-a-file + # @return [RubyLokaliseApi::Resources::QueuedProcess] # @param project_id [String] - # @param params [Hash] - def download_files(project_id, params) - c_r RubyLokaliseApi::Resources::File, :download, [project_id, 'download'], params + # @param req_params [Hash] + def upload_file(project_id, req_params) + params = { query: [project_id, :upload], req: req_params } + + response = endpoint(name: 'Files', params: params).do_post + + process_id = response.content.dig('process', 'process_id') + + response.patch_endpoint_with endpoint(name: 'QueuedProcesses', params: { query: [project_id, process_id] }) + + resource 'QueuedProcess', response end - # Imports translation file to the given project. File data must base64-encoded. - # To encode your data in Base64, use `Base64.strict_encode64()` method. + # Downloads translation files from the project # - # @see https://developers.lokalise.com/reference/upload-a-file - # @return [Hash] + # @see https://developers.lokalise.com/reference/download-files + # @return [RubyLokaliseApi::Generics::DownloadBundle] # @param project_id [String] - # @param params [Hash] - def upload_file(project_id, params) - c_r RubyLokaliseApi::Resources::File, :upload, [project_id, 'upload'], params + # @param req_params [Hash] + def download_files(project_id, req_params) + params = { query: [project_id, :download], req: req_params } + + data = endpoint(name: 'Files', params: params).do_post + + RubyLokaliseApi::Generics::DownloadBundle.new data.content end - # Deletes a file and it's associated keys from the project. - # File __unassigned__ cannot be deleted. + # Deletes a single file from the project. + # Only the "Documents" projects are supported # # @see https://developers.lokalise.com/reference/delete-a-file - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] - # @param params [Hash] + # @param file_id [String, Integer] def destroy_file(project_id, file_id) - c_r RubyLokaliseApi::Resources::File, :destroy, [project_id, file_id] + params = { query: [project_id, file_id] } + + data = endpoint(name: 'Files', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/jwt.rb b/lib/ruby_lokalise_api/rest/jwt.rb deleted file mode 100644 index 524e5b1..0000000 --- a/lib/ruby_lokalise_api/rest/jwt.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Rest - module Jwt - # Returns a JWT that can be used to work with OTA - # - # @see https://developers.lokalise.com/reference/create-service-jwt - # @return [RubyLokaliseApi::Resources::Jwt] - def jwt(project_id, params = {service: :ota}) - c_r RubyLokaliseApi::Resources::Jwt, :create, project_id, params - end - end - end -end diff --git a/lib/ruby_lokalise_api/rest/jwts.rb b/lib/ruby_lokalise_api/rest/jwts.rb new file mode 100644 index 0000000..3275577 --- /dev/null +++ b/lib/ruby_lokalise_api/rest/jwts.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Rest + module Jwts + # Creates a service JWT + # + # @see https://developers.lokalise.com/reference/create-service-jwt + # @return [RubyLokaliseApi::Resources::Jwt] + # @param project_id [String] + # @param req_params [Hash] + def create_jwt(project_id, req_params) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'Jwts', params: params).do_post + + resource 'Jwt', data + end + end + end +end diff --git a/lib/ruby_lokalise_api/rest/keys.rb b/lib/ruby_lokalise_api/rest/keys.rb index b524746..ac30fd9 100644 --- a/lib/ruby_lokalise_api/rest/keys.rb +++ b/lib/ruby_lokalise_api/rest/keys.rb @@ -3,76 +3,109 @@ module RubyLokaliseApi module Rest module Keys - # Returns all translation keys for the given project - # - # @see https://developers.lokalise.com/reference/list-all-keys - # @return [RubyLokaliseApi::Collection::Key] - # @param project_id [String] - # @param params [Hash] - def keys(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Key, :all, project_id, params - end + using RubyLokaliseApi::Utils::Classes - # Returns a single translation key for the given project + # Returns a single translation key # # @see https://developers.lokalise.com/reference/retrieve-a-key # @return [RubyLokaliseApi::Resources::Key] # @param project_id [String] # @param key_id [String, Integer] - # @param params [Hash] - def key(project_id, key_id, params = {}) - c_r RubyLokaliseApi::Resources::Key, :find, [project_id, key_id], params + # @param req_params[Hash] + def key(project_id, key_id, req_params = {}) + params = { query: [project_id, key_id], req: req_params } + + data = endpoint(name: 'Keys', params: params).do_get + + resource 'Key', data end - # Creates one or more translation keys for the given project + # Returns project translation keys + # + # @see https://developers.lokalise.com/reference/list-all-keys + # @return [RubyLokaliseApi::Collections::Keys] + # @param project_id [String] + # @param req_params [Hash] + def keys(project_id, req_params = {}) + name = 'Keys' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data + end + + # Creates one or multiple keys in the project # # @see https://developers.lokalise.com/reference/create-keys - # @return [RubyLokaliseApi::Collection::Key] + # @return [RubyLokaliseApi::Collections::Keys] # @param project_id [String] - # @param params [Hash, Array] - def create_keys(project_id, params = {}) - c_r RubyLokaliseApi::Resources::Key, :create, project_id, params, :keys + # @param req_params [Hash, Array] + def create_keys(project_id, req_params) + name = 'Keys' + params = { query: project_id, req: req_params.to_array_obj(:keys) } + + data = endpoint(name: name, params: params).do_post + + collection name, data end - # Updates translation key for the given project + # Updates a single translation key # # @see https://developers.lokalise.com/reference/update-a-key # @return [RubyLokaliseApi::Resources::Key] # @param project_id [String] # @param key_id [String, Integer] - # @param params [Hash] - def update_key(project_id, key_id, params = {}) - c_r RubyLokaliseApi::Resources::Key, :update, [project_id, key_id], params + # @param req_params[Hash] + def update_key(project_id, key_id, req_params = {}) + params = { query: [project_id, key_id], req: req_params } + + data = endpoint(name: 'Keys', params: params).do_put + + resource 'Key', data end - # Updates one or multiple translation keys for the given project + # Updates multiple keys in the project # # @see https://developers.lokalise.com/reference/bulk-update - # @return [RubyLokaliseApi::Collection::Key] + # @return [RubyLokaliseApi::Collections::Keys] # @param project_id [String] - # @param params [Hash, Array] - def update_keys(project_id, params) - c_r RubyLokaliseApi::Resources::Key, :update, project_id, params, :keys + # @param req_params [Hash, Array] + def update_keys(project_id, req_params) + name = 'Keys' + params = { query: project_id, req: req_params.to_array_obj(:keys) } + + data = endpoint(name: name, params: params).do_put + + collection name, data end - # Deletes translation key for the given project + # Deletes a single key from the project # # @see https://developers.lokalise.com/reference/delete-a-key - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param key_id [String, Integer] def destroy_key(project_id, key_id) - c_r RubyLokaliseApi::Resources::Key, :destroy, [project_id, key_id] + params = { query: [project_id, key_id] } + + data = endpoint(name: 'Keys', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end - # Deletes one or multiple translation keys for the given project + # Deletes multiple keys from the project # # @see https://developers.lokalise.com/reference/delete-multiple-keys - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] - # @param key_ids [String, Integer, Array, Array] + # @param key_ids [Array, String] def destroy_keys(project_id, key_ids) - c_r RubyLokaliseApi::Resources::Key, :destroy, project_id, key_ids, :keys + params = { query: project_id, req: key_ids.to_array_obj(:keys) } + + data = endpoint(name: 'Keys', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/languages.rb b/lib/ruby_lokalise_api/rest/languages.rb index fb338aa..a2a857f 100644 --- a/lib/ruby_lokalise_api/rest/languages.rb +++ b/lib/ruby_lokalise_api/rest/languages.rb @@ -3,64 +3,93 @@ module RubyLokaliseApi module Rest module Languages - # Returns all languages supported by Lokalise + using RubyLokaliseApi::Utils::Classes + + # Returns Lokalise system languages # # @see https://developers.lokalise.com/reference/list-system-languages - # @return [RubyLokaliseApi::Collection::SystemLanguage] - # @param params [Hash] - def system_languages(params = {}) - c_r RubyLokaliseApi::Collections::SystemLanguage, :all, nil, params + # @return [RubyLokaliseApi::Collections::SystemLanguages] + # @param req_params [Hash] + def system_languages(req_params = {}) + name = 'SystemLanguages' + params = { req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns all languages for the given project + # Returns project languages # # @see https://developers.lokalise.com/reference/list-project-languages - # @return [RubyLokaliseApi::Collection::ProjectLanguage] - # @param project_id [String, Integer] - # @param params [Hash] - def project_languages(project_id, params = {}) - c_r RubyLokaliseApi::Collections::ProjectLanguage, :all, project_id, params + # @return [RubyLokaliseApi::Collections::ProjectLanguages] + # @param project_id [String] + # @param req_params [Hash] + def project_languages(project_id, req_params = {}) + name = 'ProjectLanguages' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns a single language for the given project + # Returns a single project language # # @see https://developers.lokalise.com/reference/retrieve-a-language # @return [RubyLokaliseApi::Resources::ProjectLanguage] # @param project_id [String] # @param language_id [String, Integer] - def language(project_id, language_id) - c_r RubyLokaliseApi::Resources::ProjectLanguage, :find, [project_id, language_id] + def project_language(project_id, language_id) + params = { query: [project_id, language_id] } + + data = endpoint(name: 'ProjectLanguages', params: params).do_get + + resource 'ProjectLanguage', data end - # Creates one or more language for the given project + # Creates one or multiple languages for a project # - # @see https://developers.lokalise.com/reference/retrieve-a-language - # @return [RubyLokaliseApi::Collection::ProjectLanguage] + # @see https://developers.lokalise.com/reference/create-languages + # @return [RubyLokaliseApi::Collections::ProjectLanguages] # @param project_id [String] - # @param params [Hash] - def create_languages(project_id, params) - c_r RubyLokaliseApi::Resources::ProjectLanguage, :create, project_id, params, :languages + # @param req_params [Hash, Array] + def create_project_languages(project_id, req_params) + name = 'ProjectLanguages' + params = { query: project_id, req: req_params.to_array_obj(:languages) } + + data = endpoint(name: name, params: params).do_post + + collection name, data end - # Updates language for the given project + # Updates a language for a project # # @see https://developers.lokalise.com/reference/update-a-language # @return [RubyLokaliseApi::Resources::ProjectLanguage] # @param project_id [String] # @param language_id [String, Integer] - # @param params [Hash] - def update_language(project_id, language_id, params) - c_r RubyLokaliseApi::Resources::ProjectLanguage, :update, [project_id, language_id], params + # @param req_params [Hash] + def update_project_language(project_id, language_id, req_params = {}) + params = { query: [project_id, language_id], req: req_params } + + data = endpoint(name: 'ProjectLanguages', params: params).do_put + + resource 'ProjectLanguage', data end - # Deletes language for the given project + # Deletes a single language from the project # # @see https://developers.lokalise.com/reference/delete-a-language - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param language_id [String, Integer] - def destroy_language(project_id, language_id) - c_r RubyLokaliseApi::Resources::ProjectLanguage, :destroy, [project_id, language_id] + def destroy_project_language(project_id, language_id) + params = { query: [project_id, language_id] } + + data = endpoint(name: 'ProjectLanguages', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/orders.rb b/lib/ruby_lokalise_api/rest/orders.rb index 0042358..110f276 100644 --- a/lib/ruby_lokalise_api/rest/orders.rb +++ b/lib/ruby_lokalise_api/rest/orders.rb @@ -3,34 +3,56 @@ module RubyLokaliseApi module Rest module Orders - # Returns all orders for the given team + # Returns orders for the given team # # @see https://developers.lokalise.com/reference/list-all-orders - # @return [RubyLokaliseApi::Collection::Order] - # @param team_id [String] - # @param params [Hash] - def orders(team_id, params = {}) - c_r RubyLokaliseApi::Collections::Order, :all, team_id, params + # @return [RubyLokaliseApi::Collections::Orders] + # @param team_id [String, Integer] + # @param req_params [Hash] + def orders(team_id, req_params = {}) + name = 'Orders' + params = { query: team_id, req: req_params } + + response = endpoint(name: name, params: params).do_get + + # We must patch content because the API does not return team_id and it's mandatory to build resource URLs + response.patch_content_with 'team_id', team_id + + collection name, response end - # Returns a single order for the given team + # Returns a single order # # @see https://developers.lokalise.com/reference/retrieve-an-order # @return [RubyLokaliseApi::Resources::Order] - # @param team_id [String] - # @param order_id [String, Integer] + # @param team_id [String, Integer] + # @param order_id [String] def order(team_id, order_id) - c_r RubyLokaliseApi::Resources::Order, :find, [team_id, order_id] + params = { query: [team_id, order_id] } + + response = endpoint(name: 'Orders', params: params).do_get + + # We must patch content because the API does not return team_id and it's mandatory to build resource URL + response.patch_content_with 'team_id', team_id + + resource 'Order', response end - # Creates an order for the given team + # Creates a new order # # @see https://developers.lokalise.com/reference/create-an-order # @return [RubyLokaliseApi::Resources::Order] # @param team_id [String] - # @param params [Hash] - def create_order(team_id, params) - c_r RubyLokaliseApi::Resources::Order, :create, team_id, params + # @param req_params [Hash] + def create_order(team_id, req_params) + params = { query: team_id, req: req_params } + + response = endpoint(name: 'Orders', params: params).do_post + + # We must patch content because the API does not return team_id and it's mandatory to build resource URL + response.patch_content_with 'team_id', team_id + + resource 'Order', response end end end diff --git a/lib/ruby_lokalise_api/rest/payment_cards.rb b/lib/ruby_lokalise_api/rest/payment_cards.rb index 00f9f05..e3950c8 100644 --- a/lib/ruby_lokalise_api/rest/payment_cards.rb +++ b/lib/ruby_lokalise_api/rest/payment_cards.rb @@ -3,13 +3,18 @@ module RubyLokaliseApi module Rest module PaymentCards - # Returns all payment cards available to the user authorized with the API token + # Returns payment cards # # @see https://developers.lokalise.com/reference/list-all-cards - # @return [RubyLokaliseApi::Collection::PaymentCard] - # @param params [Hash] - def payment_cards(params = {}) - c_r RubyLokaliseApi::Collections::PaymentCard, :all, nil, params + # @return [RubyLokaliseApi::Collections::PaymentCards] + # @param req_params [Hash] + def payment_cards(req_params = {}) + name = 'PaymentCards' + params = { req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end # Returns a single payment card @@ -18,25 +23,37 @@ def payment_cards(params = {}) # @return [RubyLokaliseApi::Resources::PaymentCard] # @param card_id [String, Integer] def payment_card(card_id) - c_r RubyLokaliseApi::Resources::PaymentCard, :find, card_id + params = { query: card_id } + + data = endpoint(name: 'PaymentCards', params: params).do_get + + resource 'PaymentCard', data end # Creates a payment card # # @see https://developers.lokalise.com/reference/create-a-card # @return [RubyLokaliseApi::Resources::PaymentCard] - # @param params [Hash] - def create_payment_card(params) - c_r RubyLokaliseApi::Resources::PaymentCard, :create, nil, params + # @param req_params [Hash] + def create_payment_card(req_params) + params = { req: req_params } + + data = endpoint(name: 'PaymentCards', params: params).do_post + + resource 'PaymentCard', data end - # Deletes the payment card + # Deletes a payment card # # @see https://developers.lokalise.com/reference/delete-a-card - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param card_id [String, Integer] def destroy_payment_card(card_id) - c_r RubyLokaliseApi::Resources::PaymentCard, :destroy, card_id + params = { query: card_id } + + data = endpoint(name: 'PaymentCards', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/projects.rb b/lib/ruby_lokalise_api/rest/projects.rb index 7096bdd..0c679b6 100644 --- a/lib/ruby_lokalise_api/rest/projects.rb +++ b/lib/ruby_lokalise_api/rest/projects.rb @@ -3,59 +3,82 @@ module RubyLokaliseApi module Rest module Projects - # Returns all projects available to the user authorized with the API token - # - # @see https://developers.lokalise.com/reference/list-all-projects - # @return [RubyLokaliseApi::Collection::Project] - # @param params [Hash] - def projects(params = {}) - c_r RubyLokaliseApi::Collections::Project, :all, nil, params - end - # Returns a single project # # @see https://developers.lokalise.com/reference/retrieve-a-project # @return [RubyLokaliseApi::Resources::Project] - # @param project_id [String, Integer] + # @param project_id [String] def project(project_id) - c_r RubyLokaliseApi::Resources::Project, :find, project_id + params = { query: project_id } + + data = endpoint(name: 'Projects', params: params).do_get + + resource 'Project', data + end + + # Returns a collection of projects + # + # @see https://developers.lokalise.com/reference/list-all-projects + # @return [RubyLokaliseApi::Collections::Projects] + # @param req_params [Hash] + def projects(req_params = {}) + name = 'Projects' + params = { req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Creates project + # Creates a project # # @see https://developers.lokalise.com/reference/create-a-project # @return [RubyLokaliseApi::Resources::Project] - # @param params [Hash] - def create_project(params) - c_r RubyLokaliseApi::Resources::Project, :create, nil, params + # @param req_params [Hash] + def create_project(req_params) + params = { req: req_params } + + data = endpoint(name: 'Projects', params: params).do_post + + resource 'Project', data end - # Updates project + # Updates a project # # @see https://developers.lokalise.com/reference/update-a-project # @return [RubyLokaliseApi::Resources::Project] - # @param project_id [String, Integer] - # @param params [Hash] - def update_project(project_id, params) - c_r RubyLokaliseApi::Resources::Project, :update, project_id, params - end + # @param project_id [String] + # @param req_params [Hash] + def update_project(project_id, req_params) + params = { query: project_id, req: req_params } - # Deletes all keys and translations from the project - # - # @see https://developers.lokalise.com/reference/empty-a-project - # @return [Hash] - # @param project_id [String, Integer] - def empty_project(project_id) - c_r RubyLokaliseApi::Resources::Project, :empty, [project_id, 'empty'] + data = endpoint(name: 'Projects', params: params).do_put + + resource 'Project', data end - # Deletes the project + # Deletes a project # # @see https://developers.lokalise.com/reference/delete-a-project - # @return [Hash] - # @param project_id [String, Integer] + # @return [RubyLokaliseApi::Generics::DeletedResource] + # @param project_id [String] def destroy_project(project_id) - c_r RubyLokaliseApi::Resources::Project, :destroy, project_id + params = { query: project_id } + + data = endpoint(name: 'Projects', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content + end + + # Empties a project by deleting all keys and translations + # + # @see https://developers.lokalise.com/reference/empty-a-project + # @return [RubyLokaliseApi::Generics::EmptiedResource] + # @param project_id [String] + def empty_project(project_id) + data = endpoint(name: 'Projects', params: { query: [project_id, :empty] }).do_put + + RubyLokaliseApi::Generics::EmptiedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/queued_processes.rb b/lib/ruby_lokalise_api/rest/queued_processes.rb index b94f90c..3178c11 100644 --- a/lib/ruby_lokalise_api/rest/queued_processes.rb +++ b/lib/ruby_lokalise_api/rest/queued_processes.rb @@ -3,25 +3,33 @@ module RubyLokaliseApi module Rest module QueuedProcesses - # Returns all queued processes for the given project + # Returns a single queued process # - # @see https://developers.lokalise.com/reference/list-all-processes - # @return [RubyLokaliseApi::Collection::QueuedProcess] + # @see https://developers.lokalise.com/reference/retrieve-a-process + # @return [RubyLokaliseApi::Resources::QueuedProcess] # @param project_id [String] - # @param params [Hash] - def queued_processes(project_id, params = {}) - c_r RubyLokaliseApi::Collections::QueuedProcess, :all, project_id, params + # @param process_id [String, Integer] + def queued_process(project_id, process_id) + params = { query: [project_id, process_id] } + + data = endpoint(name: 'QueuedProcesses', params: params).do_get + + resource 'QueuedProcess', data end - # Returns a queued process for the given project + # Returns queued processes # - # @see https://developers.lokalise.com/reference/retrieve-a-process - # @return [RubyLokaliseApi::Resources::QueuedProcess] + # @see https://developers.lokalise.com/reference/list-all-processes + # @return [RubyLokaliseApi::Collections::QueuedProcesses] # @param project_id [String] - # @param process_id [String] - def queued_process(project_id, process_id) - c_r RubyLokaliseApi::Resources::QueuedProcess, :find, - [project_id, process_id] + # @param req_params [Hash] + def queued_processes(project_id, req_params = {}) + name = 'QueuedProcesses' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end end end diff --git a/lib/ruby_lokalise_api/rest/screenshots.rb b/lib/ruby_lokalise_api/rest/screenshots.rb index 567c8df..1f0e00d 100644 --- a/lib/ruby_lokalise_api/rest/screenshots.rb +++ b/lib/ruby_lokalise_api/rest/screenshots.rb @@ -3,55 +3,80 @@ module RubyLokaliseApi module Rest module Screenshots - # Returns all screenshots for the given project + using RubyLokaliseApi::Utils::Classes + + # Returns project screenshots # # @see https://developers.lokalise.com/reference/list-all-screenshots - # @return [RubyLokaliseApi::Collection::Screenshot] + # @return [RubyLokaliseApi::Collections::Screenshots] # @param project_id [String] - # @param params [Hash] - def screenshots(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Screenshot, :all, project_id, params + # @param req_params [Hash] + def screenshots(project_id, req_params = {}) + name = 'Screenshots' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns a single screenshot for the given project + # Returns a single screenshot # # @see https://developers.lokalise.com/reference/retrieve-a-screenshot # @return [RubyLokaliseApi::Resources::Screenshot] # @param project_id [String] # @param screenshot_id [String, Integer] - def screenshot(project_id, screenshot_id) - c_r RubyLokaliseApi::Resources::Screenshot, :find, [project_id, screenshot_id] + # @param req_params[Hash] + def screenshot(project_id, screenshot_id, req_params = {}) + params = { query: [project_id, screenshot_id], req: req_params } + + data = endpoint(name: 'Screenshots', params: params).do_get + + resource 'Screenshot', data end - # Creates one or more screenshots for the given project + # Creates a new order # # @see https://developers.lokalise.com/reference/create-screenshots - # @return [RubyLokaliseApi::Collection::Screenshot] + # @return [RubyLokaliseApi::Collections::Screenshots] # @param project_id [String] - # @param params [Hash] - def create_screenshots(project_id, params = {}) - c_r RubyLokaliseApi::Resources::Screenshot, :create, project_id, params, :screenshots + # @param req_params [Hash, Array] + def create_screenshots(project_id, req_params) + name = 'Screenshots' + params = { query: project_id, req: req_params.to_array_obj(:screenshots) } + + data = endpoint(name: name, params: params).do_post + + collection name, data end - # Updates screenshot + # Updates a screenshot # # @see https://developers.lokalise.com/reference/update-a-screenshot # @return [RubyLokaliseApi::Resources::Screenshot] # @param project_id [String] # @param screenshot_id [String, Integer] - # @param params [Hash] - def update_screenshot(project_id, screenshot_id, params = {}) - c_r RubyLokaliseApi::Resources::Screenshot, :update, [project_id, screenshot_id], params + # @param req_params [Hash] + def update_screenshot(project_id, screenshot_id, req_params = {}) + params = { query: [project_id, screenshot_id], req: req_params } + + data = endpoint(name: 'Screenshots', params: params).do_put + + resource 'Screenshot', data end - # Deletes screenshot + # Deletes a screenshot # # @see https://developers.lokalise.com/reference/delete-a-screenshot - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param screenshot_id [String, Integer] def destroy_screenshot(project_id, screenshot_id) - c_r RubyLokaliseApi::Resources::Screenshot, :destroy, [project_id, screenshot_id] + params = { query: [project_id, screenshot_id] } + + data = endpoint(name: 'Screenshots', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/segments.rb b/lib/ruby_lokalise_api/rest/segments.rb index c1de710..b53e064 100644 --- a/lib/ruby_lokalise_api/rest/segments.rb +++ b/lib/ruby_lokalise_api/rest/segments.rb @@ -3,42 +3,55 @@ module RubyLokaliseApi module Rest module Segments - # Returns all segments for the given key and language ISO code + # Returns project segments # # @see https://developers.lokalise.com/reference/list-all-segments-for-key-language - # @return [RubyLokaliseApi::Collection::Segments] + # @return [RubyLokaliseApi::Collections::Segments] # @param project_id [String] # @param key_id [String, Integer] - # @param lang_iso [String] - # @param params [Hash] - def segments(project_id, key_id, lang_iso, params = {}) - c_r RubyLokaliseApi::Collections::Segment, :all, [project_id, key_id, lang_iso], params + # @param language_iso [String] + # @param req_params [Hash] + def segments(project_id, key_id, language_iso, req_params = {}) + name = 'Segments' + params = { query: [project_id, key_id, language_iso], req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns a segment under a given number for the given key and language ISO code + # Returns a single project segment # # @see https://developers.lokalise.com/reference/retrieve-a-segment-for-key-language # @return [RubyLokaliseApi::Resources::Segment] # @param project_id [String] # @param key_id [String, Integer] - # @param lang_iso [String] - # @params segment_number [Integer, String] - # @param params [Hash] - def segment(project_id, key_id, lang_iso, segment_number, params = {}) - c_r RubyLokaliseApi::Resources::Segment, :find, [project_id, key_id, lang_iso, segment_number], params + # @param language_iso [String] + # @param segment_number [String, Integer] + # @param req_params [Hash] + def segment(project_id, key_id, language_iso, segment_number, req_params = {}) + params = { query: [project_id, key_id, language_iso, segment_number], req: req_params } + + data = endpoint(name: 'Segments', params: params).do_get + + resource 'Segment', data end - # Updates a segment under a given number for the given key and language ISO code + # Updates a segment # # @see https://developers.lokalise.com/reference/update-a-segment # @return [RubyLokaliseApi::Resources::Segment] # @param project_id [String] # @param key_id [String, Integer] - # @param lang_iso [String] - # @params segment_number [Integer, String] - # @param params [Hash] - def update_segment(project_id, key_id, lang_iso, segment_number, params = {}) - c_r RubyLokaliseApi::Resources::Segment, :update, [project_id, key_id, lang_iso, segment_number], params + # @param language_iso [String] + # @param segment_number [String, Integer] + # @param req_params [Hash] + def update_segment(project_id, key_id, language_iso, segment_number, req_params = {}) + params = { query: [project_id, key_id, language_iso, segment_number], req: req_params } + + data = endpoint(name: 'Segments', params: params).do_put + + resource 'Segment', data end end end diff --git a/lib/ruby_lokalise_api/rest/snapshots.rb b/lib/ruby_lokalise_api/rest/snapshots.rb index e3e0fa9..3c6d674 100644 --- a/lib/ruby_lokalise_api/rest/snapshots.rb +++ b/lib/ruby_lokalise_api/rest/snapshots.rb @@ -3,44 +3,64 @@ module RubyLokaliseApi module Rest module Snapshots - # Returns all snapshots for the given project + # Returns project snapshots # # @see https://developers.lokalise.com/reference/list-all-snapshots - # @return [RubyLokaliseApi::Collection::Snapshot] + # @return [RubyLokaliseApi::Collections::Snapshots] # @param project_id [String] - # @param params [Hash] - def snapshots(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Snapshot, :all, project_id, params + # @param req_params [Hash] + def snapshots(project_id, req_params = {}) + name = 'Snapshots' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Creates snapshot for the given project + # Creates a snapshot # # @see https://developers.lokalise.com/reference/create-a-snapshot # @return [RubyLokaliseApi::Resources::Snapshot] # @param project_id [String] - # @param params [Hash] - def create_snapshot(project_id, params = {}) - c_r RubyLokaliseApi::Resources::Snapshot, :create, project_id, params + # @param req_params [Hash] + def create_snapshot(project_id, req_params = {}) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'Snapshots', params: params).do_post + + resource 'Snapshot', data end - # Restore project from the given snapshot by producing project's copy + # Restores a snapshot by creating a project copy # # @see https://developers.lokalise.com/reference/restore-a-snapshot # @return [RubyLokaliseApi::Resources::Project] # @param project_id [String] # @param snapshot_id [String, Integer] def restore_snapshot(project_id, snapshot_id) - c_r RubyLokaliseApi::Resources::Snapshot, :restore, [project_id, snapshot_id] + params = { query: [project_id, snapshot_id] } + + response = endpoint(name: 'Snapshots', params: params).do_post + + # We restore a project so its endpoint is different + response.patch_endpoint_with endpoint(name: 'Projects', params: { query: [project_id] }) + + resource 'Project', response end - # Deletes snapshot + # Deletes a snapshot # # @see https://developers.lokalise.com/reference/delete-a-snapshot - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param snapshot_id [String, Integer] def destroy_snapshot(project_id, snapshot_id) - c_r RubyLokaliseApi::Resources::Snapshot, :destroy, [project_id, snapshot_id] + params = { query: [project_id, snapshot_id] } + + data = endpoint(name: 'Snapshots', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/tasks.rb b/lib/ruby_lokalise_api/rest/tasks.rb index fb528e5..c839746 100644 --- a/lib/ruby_lokalise_api/rest/tasks.rb +++ b/lib/ruby_lokalise_api/rest/tasks.rb @@ -3,55 +3,77 @@ module RubyLokaliseApi module Rest module Tasks - # Returns all tasks for the given project + # Returns project tasks # # @see https://developers.lokalise.com/reference/list-all-tasks - # @return [RubyLokaliseApi::Collection::Task] + # @return [RubyLokaliseApi::Collections::Tasks] # @param project_id [String] - # @param params [Hash] - def tasks(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Task, :all, project_id, params + # @param req_params [Hash] + def tasks(project_id, req_params = {}) + name = 'Tasks' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns a single task for the given project + # Returns a single task # # @see https://developers.lokalise.com/reference/retrieve-a-task # @return [RubyLokaliseApi::Resources::Task] # @param project_id [String] # @param task_id [String, Integer] - def task(project_id, task_id) - c_r RubyLokaliseApi::Resources::Task, :find, [project_id, task_id] + # @param req_params[Hash] + def task(project_id, task_id, req_params = {}) + params = { query: [project_id, task_id], req: req_params } + + data = endpoint(name: 'Tasks', params: params).do_get + + resource 'Task', data end - # Creates task for the given project + # Creates a new task # # @see https://developers.lokalise.com/reference/create-a-task # @return [RubyLokaliseApi::Resources::Task] # @param project_id [String] - # @param params [Hash] - def create_task(project_id, params) - c_r RubyLokaliseApi::Resources::Task, :create, project_id, params + # @param req_params [Hash, Array] + def create_task(project_id, req_params) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'Tasks', params: params).do_post + + resource 'Task', data end - # Updates task for the given project + # Updates a task # # @see https://developers.lokalise.com/reference/update-a-task # @return [RubyLokaliseApi::Resources::Task] # @param project_id [String] # @param task_id [String, Integer] - # @param params [Hash] - def update_task(project_id, task_id, params = {}) - c_r RubyLokaliseApi::Resources::Task, :update, [project_id, task_id], params + # @param req_params [Hash] + def update_task(project_id, task_id, req_params = {}) + params = { query: [project_id, task_id], req: req_params } + + data = endpoint(name: 'Tasks', params: params).do_put + + resource 'Task', data end - # Deletes task for the given project + # Deletes a task # # @see https://developers.lokalise.com/reference/delete-a-task - # @return [Hash] + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] # @param task_id [String, Integer] def destroy_task(project_id, task_id) - c_r RubyLokaliseApi::Resources::Task, :destroy, [project_id, task_id] + params = { query: [project_id, task_id] } + + data = endpoint(name: 'Tasks', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/team_user_billing_details.rb b/lib/ruby_lokalise_api/rest/team_user_billing_details.rb index f306a71..0043fe1 100644 --- a/lib/ruby_lokalise_api/rest/team_user_billing_details.rb +++ b/lib/ruby_lokalise_api/rest/team_user_billing_details.rb @@ -3,33 +3,54 @@ module RubyLokaliseApi module Rest module TeamUserBillingDetails - # Returns team user billing details + # Returns billing details for a team user # # @see https://developers.lokalise.com/reference/retrieve-team-user-billing-details # @return [RubyLokaliseApi::Resources::TeamUserBillingDetails] - # @param team_id [String] + # @param team_id [String, Integer] def team_user_billing_details(team_id) - c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :find, team_id + params = { query: team_id } + + response = endpoint(name: 'TeamUserBillingDetails', params: params).do_get + + # We must patch content because the API does not return team_id and it's mandatory to build resource URLs + response.patch_content_with 'team_id', team_id + + resource 'TeamUserBillingDetails', response end # Creates team user billing details # # @see https://developers.lokalise.com/reference/create-team-user-billing-details # @return [RubyLokaliseApi::Resources::TeamUserBillingDetails] - # @param team_id [String] - # @param params [Hash] - def create_team_user_billing_details(team_id, params) - c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :create, team_id, params + # @param team_id [String, Integer] + # @param req_params [Hash, Array] + def create_team_user_billing_details(team_id, req_params) + params = { query: team_id, req: req_params } + + response = endpoint(name: 'TeamUserBillingDetails', params: params).do_post + + # We must patch content because the API does not return team_id and it's mandatory to build resource URL + response.patch_content_with 'team_id', team_id + + resource 'TeamUserBillingDetails', response end # Updates team user billing details # - # @see https://developers.lokalise.com/reference/create-team-user-billing-details + # @see https://developers.lokalise.com/reference/update-team-user-billing-details # @return [RubyLokaliseApi::Resources::TeamUserBillingDetails] - # @param team_id [String] - # @param params [Hash] - def update_team_user_billing_details(team_id, params) - c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :update, team_id, params + # @param team_id [String, Integer] + # @param req_params [Hash] + def update_team_user_billing_details(team_id, req_params = {}) + params = { query: team_id, req: req_params } + + data = endpoint(name: 'TeamUserBillingDetails', params: params).do_put + + # We must patch content because the API does not return team_id and it's mandatory to build resource URL + data.patch_content_with 'team_id', team_id + + resource 'TeamUserBillingDetails', data end end end diff --git a/lib/ruby_lokalise_api/rest/team_user_groups.rb b/lib/ruby_lokalise_api/rest/team_user_groups.rb index 5ab5059..b43622e 100644 --- a/lib/ruby_lokalise_api/rest/team_user_groups.rb +++ b/lib/ruby_lokalise_api/rest/team_user_groups.rb @@ -3,106 +3,138 @@ module RubyLokaliseApi module Rest module TeamUserGroups - # Returns all team user groups for the given team + using RubyLokaliseApi::Utils::Classes + + # Returns team user groups # - # @see https://developers.lokalise.com/reference/list-all-team-users - # @return [RubyLokaliseApi::Collection::TeamUserGroup] - # @param team_id [String] - # @param params [Hash] - def team_user_groups(team_id, params = {}) - c_r RubyLokaliseApi::Collections::TeamUserGroup, :all, team_id, params + # @see https://developers.lokalise.com/reference/list-all-groups + # @return [RubyLokaliseApi::Collections::TeamUserGroups] + # @param team_id [Integer, String] + # @param req_params [Hash] + def team_user_groups(team_id, req_params = {}) + name = 'TeamUserGroups' + params = { query: team_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns team user from the given team + # Returns a single team user group # - # @see https://developers.lokalise.com/reference/retrieve-a-team-user + # @see https://developers.lokalise.com/reference/retrieve-a-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] def team_user_group(team_id, group_id) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :find, [team_id, group_id] + params = { query: [team_id, group_id] } + + response = endpoint(name: 'TeamUserGroups', params: params).do_get + + resource 'TeamUserGroup', response end - # Creates team user group + # Creates a team user group # # @see https://developers.lokalise.com/reference/create-a-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param params [Hash] - def create_team_user_group(team_id, params) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :create, team_id, params + # @param team_id [String, Integer] + # @param req_params [Hash] + def create_team_user_group(team_id, req_params) + params = { query: team_id, req: req_params } + + response = endpoint(name: 'TeamUserGroups', params: params).do_post + + resource 'TeamUserGroup', response end - # Updates team user group for the given team + # Updates a team user group # # @see https://developers.lokalise.com/reference/update-a-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] - # @param params [Hash] - def update_team_user_group(team_id, group_id, params) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, [team_id, group_id], params + # @param req_params [Hash] + def update_team_user_group(team_id, group_id, req_params = {}) + params = { query: [team_id, group_id], req: req_params } + + data = endpoint(name: 'TeamUserGroups', params: params).do_put + + resource 'TeamUserGroup', data end - # Deletes team user group from the given team + # Deletes a team user group # # @see https://developers.lokalise.com/reference/delete-a-group - # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @return [RubyLokaliseApi::Generics::DeletedResource] + # @param team_id [String, Integer] # @param group_id [String, Integer] def destroy_team_user_group(team_id, group_id) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :destroy, [team_id, group_id] + params = { query: [team_id, group_id] } + + data = endpoint(name: 'TeamUserGroups', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end - # Adds projects to the given group + # Adds projects to the group # # @see https://developers.lokalise.com/reference/add-projects-to-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] - # @param project_ids [String, Integer, Array, Array] + # @param project_ids [Array, String] def add_projects_to_group(team_id, group_id, project_ids) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, - [team_id, group_id, 'projects', 'add'], - project_ids, :projects, [team_id, group_id] + params = { query: [team_id, group_id, :projects, :add], req: project_ids.to_array_obj(:projects) } + + data = endpoint(name: 'TeamUserGroups', params: params).do_put + + resource 'TeamUserGroup', data end - # Removes projects from the given group + # Removes projects from the group # # @see https://developers.lokalise.com/reference/remove-projects-from-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] - # @param project_ids [String, Integer, Array, Array] + # @param project_ids [Array, String] def remove_projects_from_group(team_id, group_id, project_ids) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, - [team_id, group_id, 'projects', 'remove'], - project_ids, :projects, [team_id, group_id] + params = { query: [team_id, group_id, :projects, :remove], req: project_ids.to_array_obj(:projects) } + + data = endpoint(name: 'TeamUserGroups', params: params).do_put + + resource 'TeamUserGroup', data end - # Adds users to the given group + # Adds members to the group # # @see https://developers.lokalise.com/reference/add-members-to-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] - # @param users_ids [String, Integer, Array, Array] - def add_users_to_group(team_id, group_id, users_ids) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, - [team_id, group_id, 'members', 'add'], - users_ids, :users, [team_id, group_id] + # @param user_ids [Array, String] + def add_members_to_group(team_id, group_id, user_ids) + params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) } + + data = endpoint(name: 'TeamUserGroups', params: params).do_put + + resource 'TeamUserGroup', data end - # Removes users from the given group + # Removes members from the group # # @see https://developers.lokalise.com/reference/remove-members-from-group # @return [RubyLokaliseApi::Resources::TeamUserGroup] - # @param team_id [String] + # @param team_id [String, Integer] # @param group_id [String, Integer] - # @param users_ids [String, Integer, Array, Array] - def remove_users_from_group(team_id, group_id, users_ids) - c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, - [team_id, group_id, 'members', 'remove'], - users_ids, :users, [team_id, group_id] + # @param user_ids [Array, String] + def remove_members_from_group(team_id, group_id, user_ids) + params = { query: [team_id, group_id, :members, :remove], req: user_ids.to_array_obj(:users) } + + data = endpoint(name: 'TeamUserGroups', params: params).do_put + + resource 'TeamUserGroup', data end end end diff --git a/lib/ruby_lokalise_api/rest/team_users.rb b/lib/ruby_lokalise_api/rest/team_users.rb index 73ed722..8c64bba 100644 --- a/lib/ruby_lokalise_api/rest/team_users.rb +++ b/lib/ruby_lokalise_api/rest/team_users.rb @@ -3,45 +3,62 @@ module RubyLokaliseApi module Rest module TeamUsers - # Returns all team users for the given team + # Returns team users # # @see https://developers.lokalise.com/reference/list-all-team-users - # @return [RubyLokaliseApi::Collection::TeamUser] - # @param team_id [String] - # @param params [Hash] - def team_users(team_id, params = {}) - c_r RubyLokaliseApi::Collections::TeamUser, :all, team_id, params + # @return [RubyLokaliseApi::Collections::TeamUsers] + # @param team_id [Integer, String] + # @param req_params [Hash] + def team_users(team_id, req_params = {}) + name = 'TeamUsers' + params = { query: team_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns team user from the given team + # Returns a single team user # # @see https://developers.lokalise.com/reference/retrieve-a-team-user # @return [RubyLokaliseApi::Resources::TeamUser] - # @param team_id [String] + # @param team_id [String, Integer] # @param user_id [String, Integer] def team_user(team_id, user_id) - c_r RubyLokaliseApi::Resources::TeamUser, :find, [team_id, user_id] + params = { query: [team_id, user_id] } + + response = endpoint(name: 'TeamUsers', params: params).do_get + + resource 'TeamUser', response end - # Updates team user for the given team + # Updates a team user # # @see https://developers.lokalise.com/reference/update-a-team-user # @return [RubyLokaliseApi::Resources::TeamUser] - # @param team_id [String] + # @param team_id [String, Integer] # @param user_id [String, Integer] - # @param params [Hash] - def update_team_user(team_id, user_id, params) - c_r RubyLokaliseApi::Resources::TeamUser, :update, [team_id, user_id], params + # @param req_params [Hash] + def update_team_user(team_id, user_id, req_params = {}) + params = { query: [team_id, user_id], req: req_params } + + data = endpoint(name: 'TeamUsers', params: params).do_put + + resource 'TeamUser', data end - # Deletes team user from the given team + # Deletes a team user # # @see https://developers.lokalise.com/reference/delete-a-team-user - # @return [RubyLokaliseApi::Resources::TeamUser] - # @param team_id [String] + # @return [RubyLokaliseApi::Generics::DeletedResource] + # @param team_id [String, Integer] # @param user_id [String, Integer] def destroy_team_user(team_id, user_id) - c_r RubyLokaliseApi::Resources::TeamUser, :destroy, [team_id, user_id] + params = { query: [team_id, user_id] } + + data = endpoint(name: 'TeamUsers', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/rest/teams.rb b/lib/ruby_lokalise_api/rest/teams.rb index b5694c3..5e0334b 100644 --- a/lib/ruby_lokalise_api/rest/teams.rb +++ b/lib/ruby_lokalise_api/rest/teams.rb @@ -3,13 +3,18 @@ module RubyLokaliseApi module Rest module Teams - # Returns all teams available to the user + # Returns teams # # @see https://developers.lokalise.com/reference/list-all-teams - # @return [RubyLokaliseApi::Collection::Team] - # @param params [Hash] - def teams(params = {}) - c_r RubyLokaliseApi::Collections::Team, :all, nil, params + # @return [RubyLokaliseApi::Collections::Teams] + # @param req_params [Hash] + def teams(req_params = {}) + name = 'Teams' + params = { req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end end end diff --git a/lib/ruby_lokalise_api/rest/translation_providers.rb b/lib/ruby_lokalise_api/rest/translation_providers.rb index 734bc08..1d5cbec 100644 --- a/lib/ruby_lokalise_api/rest/translation_providers.rb +++ b/lib/ruby_lokalise_api/rest/translation_providers.rb @@ -3,24 +3,39 @@ module RubyLokaliseApi module Rest module TranslationProviders - # Returns all translation providers for the given team + # Returns translation providers # # @see https://developers.lokalise.com/reference/list-all-providers - # @return [RubyLokaliseApi::Collection::TranslationProvider] - # @param team_id [String] - # @param params [Hash] - def translation_providers(team_id, params = {}) - c_r RubyLokaliseApi::Collections::TranslationProvider, :all, team_id, params + # @return [RubyLokaliseApi::Collections::TranslationProviders] + # @param team_id [String, Integer] + # @param req_params [Hash] + def translation_providers(team_id, req_params = {}) + name = 'TranslationProviders' + params = { query: team_id, req: req_params } + + response = endpoint(name: name, params: params).do_get + + # We must patch content because the API does not return team_id and it's mandatory to build resource URLs + response.patch_content_with 'team_id', team_id + + collection name, response end - # Returns a single translation provider for the given team + # Returns a single translation provider # # @see https://developers.lokalise.com/reference/retrieve-a-provider # @return [RubyLokaliseApi::Resources::TranslationProvider] - # @param team_id [String] + # @param team_id [String, Integer] # @param provider_id [String, Integer] def translation_provider(team_id, provider_id) - c_r RubyLokaliseApi::Resources::TranslationProvider, :find, [team_id, provider_id] + params = { query: [team_id, provider_id] } + + response = endpoint(name: 'TranslationProviders', params: params).do_get + + # We must patch content because the API does not return team_id and it's mandatory to build resource URLs + response.patch_content_with 'team_id', team_id + + resource 'TranslationProvider', response end end end diff --git a/lib/ruby_lokalise_api/rest/translations.rb b/lib/ruby_lokalise_api/rest/translations.rb index 84c24bf..bea69e1 100644 --- a/lib/ruby_lokalise_api/rest/translations.rb +++ b/lib/ruby_lokalise_api/rest/translations.rb @@ -3,36 +3,49 @@ module RubyLokaliseApi module Rest module Translations - # Returns all translations for the given project (ungrouped) + # Returns translations # # @see https://developers.lokalise.com/reference/list-all-translations - # @return [RubyLokaliseApi::Collection::Translation] + # @return [RubyLokaliseApi::Collections::Translations] # @param project_id [String] - # @param params [Hash] - def translations(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Translation, :all, project_id, params + # @param req_params [Hash] + def translations(project_id, req_params = {}) + name = 'Translations' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns translation of the given project + # Returns a single translation # # @see https://developers.lokalise.com/reference/retrieve-a-translation # @return [RubyLokaliseApi::Resources::Translation] # @param project_id [String] - # @param translation_id [String, Integer] - # @param params [Hash] - def translation(project_id, translation_id, params = {}) - c_r RubyLokaliseApi::Resources::Translation, :find, [project_id, translation_id], params + # @param translation_id [String] + # @param req_params[Hash] + def translation(project_id, translation_id, req_params = {}) + params = { query: [project_id, translation_id], req: req_params } + + data = endpoint(name: 'Translations', params: params).do_get + + resource 'Translation', data end - # Updates translation of the given project + # Updates a translation # # @see https://developers.lokalise.com/reference/update-a-translation # @return [RubyLokaliseApi::Resources::Translation] # @param project_id [String] - # @param translation_id [String, Integer] - # @param params [Hash] - def update_translation(project_id, translation_id, params) - c_r RubyLokaliseApi::Resources::Translation, :update, [project_id, translation_id], params + # @param translation_id [String] + # @param req_params [Hash] + def update_translation(project_id, translation_id, req_params) + params = { query: [project_id, translation_id], req: req_params } + + data = endpoint(name: 'Translations', params: params).do_put + + resource 'Translation', data end end end diff --git a/lib/ruby_lokalise_api/rest/webhooks.rb b/lib/ruby_lokalise_api/rest/webhooks.rb index ce7773d..27a58dd 100644 --- a/lib/ruby_lokalise_api/rest/webhooks.rb +++ b/lib/ruby_lokalise_api/rest/webhooks.rb @@ -3,66 +3,90 @@ module RubyLokaliseApi module Rest module Webhooks - # Returns all webhooks for the given project + # Returns project webhooks # # @see https://developers.lokalise.com/reference/list-all-webhooks - # @return [RubyLokaliseApi::Collection::Webhook] + # @return [RubyLokaliseApi::Collections::Webhooks] # @param project_id [String] - # @param params [Hash] - def webhooks(project_id, params = {}) - c_r RubyLokaliseApi::Collections::Webhook, :all, project_id, params + # @param req_params [Hash] + def webhooks(project_id, req_params = {}) + name = 'Webhooks' + params = { query: project_id, req: req_params } + + data = endpoint(name: name, params: params).do_get + + collection name, data end - # Returns a single webhook for the given project + # Returns a single webhook # # @see https://developers.lokalise.com/reference/retrieve-a-webhook # @return [RubyLokaliseApi::Resources::Webhook] # @param project_id [String] - # @param webhook_id [String, Integer] + # @param webhook_id [String] def webhook(project_id, webhook_id) - c_r RubyLokaliseApi::Resources::Webhook, :find, [project_id, webhook_id] + params = { query: [project_id, webhook_id] } + + data = endpoint(name: 'Webhooks', params: params).do_get + + resource 'Webhook', data end - # Creates webhook for the given project + # Creates a webhook # # @see https://developers.lokalise.com/reference/create-a-webhook # @return [RubyLokaliseApi::Resources::Webhook] # @param project_id [String] - # @param params [Hash] - def create_webhook(project_id, params) - c_r RubyLokaliseApi::Resources::Webhook, :create, project_id, params + # @param req_params [Hash] + def create_webhook(project_id, req_params) + params = { query: project_id, req: req_params } + + data = endpoint(name: 'Webhooks', params: params).do_post + + resource 'Webhook', data end - # Updates webhook for the given project + # Updates a webhook # # @see https://developers.lokalise.com/reference/update-a-webhook # @return [RubyLokaliseApi::Resources::Webhook] # @param project_id [String] - # @param webhook_id [String, Integer] - # @param params [Hash] - def update_webhook(project_id, webhook_id, params = {}) - c_r RubyLokaliseApi::Resources::Webhook, :update, [project_id, webhook_id], params + # @param webhook_id [String] + # @param req_params [Hash] + def update_webhook(project_id, webhook_id, req_params) + params = { query: [project_id, webhook_id], req: req_params } + + data = endpoint(name: 'Webhooks', params: params).do_put + + resource 'Webhook', data end - # Deletes webhook for the given project + # Regenerates webhook secret # - # @see https://developers.lokalise.com/reference/delete-a-webhook - # @return [Hash] + # @see https://developers.lokalise.com/reference/regenerate-a-webhook-secret + # @return [RubyLokaliseApi::Generics::RegeneratedWebhookSecret] # @param project_id [String] - # @param webhook_id [String, Integer] - def destroy_webhook(project_id, webhook_id) - c_r RubyLokaliseApi::Resources::Webhook, :destroy, [project_id, webhook_id] + # @param webhook_id [String] + def regenerate_webhook_secret(project_id, webhook_id) + params = { query: [project_id, webhook_id, :secret, :regenerate] } + + data = endpoint(name: 'Webhooks', params: params).do_patch + + RubyLokaliseApi::Generics::RegeneratedWebhookSecret.new data.content end - # Regenerates secret for the given webhook + # Deletes a webhook # - # @see https://developers.lokalise.com/reference/regenerate-a-webhook-secret - # @return [Hash] + # @see https://developers.lokalise.com/reference/delete-a-webhook + # @return [RubyLokaliseApi::Generics::DeletedResource] # @param project_id [String] - # @param webhook_id [String, Integer] - def regenerate_webhook_secret(project_id, webhook_id) - c_r RubyLokaliseApi::Resources::Webhook, :regenerate_secret, - [project_id, webhook_id, 'secret', 'regenerate'] + # @param webhook_id [String] + def destroy_webhook(project_id, webhook_id) + params = { query: [project_id, webhook_id] } + + data = endpoint(name: 'Webhooks', params: params).do_delete + + RubyLokaliseApi::Generics::DeletedResource.new data.content end end end diff --git a/lib/ruby_lokalise_api/utils/attribute_helpers.rb b/lib/ruby_lokalise_api/utils/attribute_helpers.rb deleted file mode 100644 index 0bbd57a..0000000 --- a/lib/ruby_lokalise_api/utils/attribute_helpers.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Utils - module AttributeHelpers - using RubyLokaliseApi::Utils::StringUtils - - UNIFIED_RESOURCES = %w[comment language].freeze - - # Returns the name of the API resource for the given class. - # Most class names correspond to resource names (eg, `Project`, `Team`) - # but some may differ (`ProjectComment` corresponds to `Comment` resource). - # The resource name is in lowercase, with underscores as separators. - # Some resources also have different pluralization rules. For example, - # "CustomTranslationStatus" is "CustomTranslationStatuses" (-es postfix). - # To address that, we try to fetch `DATA_KEY_PLURAL` set for the individual class. - # - # @return [String] - # @param model_class [String] - # @param plural [Boolean] Should the returned value be pluralized? - def data_key_for(model_class:, plural: false, collection: false) - data_key_plural = get_key( - name: 'DATA_KEY_PLURAL', - model_class: model_class, - collection: true, - strict: true - ) - - return data_key_plural if collection && data_key_plural - - data_key = get_key name: 'DATA_KEY', model_class: model_class, collection: collection - - return data_key unless plural - - "#{data_key}s" - end - - # Returns key used to determine resource id (for example `user_id` or `project_id`). - # Most ids corresponds to resources' class names, but some may differ (for instance, - # `Contributor` has `user_id` attribute). - # - # @return [String] - # @param model_class [String] - def id_key_for(model_class) - get_key name: 'ID_KEY', model_class: model_class - end - - # Loads attributes for the given resource based on its name - # - # @return [Array] - def attributes_for(klass) - @attributes ||= YAML.load_file(File.expand_path('../data/attributes.yml', __dir__)).freeze - - name = unify klass.name.snakecase - @attributes[name] - end - - private - - def get_key(name:, model_class:, collection: false, strict: false) - key = if collection && Module.const_defined?("RubyLokaliseApi::Collections::#{model_class}::#{name}") - Module.const_get "RubyLokaliseApi::Collections::#{model_class}::#{name}" - elsif Module.const_defined? "RubyLokaliseApi::Resources::#{model_class}::#{name}" - Module.const_get "RubyLokaliseApi::Resources::#{model_class}::#{name}" - else - strict ? nil : model_class - end - - # Sometimes key is nil - key ? key.snakecase : key - end - - # Unify some resources' names (eg, `ProjectComment` and `KeyComment` have the same - # attributes which are stored under `comment`) - # - # @return [String] - def unify(name) - UNIFIED_RESOURCES.each do |u_a| - return u_a if name.match?(/#{u_a}/) - end - - name - end - end - end -end diff --git a/lib/ruby_lokalise_api/utils/attributes.rb b/lib/ruby_lokalise_api/utils/attributes.rb new file mode 100644 index 0000000..83ecd20 --- /dev/null +++ b/lib/ruby_lokalise_api/utils/attributes.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Utils + module Attributes + using RubyLokaliseApi::Utils::Strings + using RubyLokaliseApi::Utils::Classes + + private + + UNIFIED_RESOURCES = %w[comment].freeze + + # Loads attributes for the given resource based on its name + # + # @return [Array] + def attributes_for(klass, filename) + @attributes ||= YAML.load_file(File.expand_path("../data/#{filename}", __dir__)).freeze + + name = unify klass.base_name.snakecase + + @attributes.key?(name) ? @attributes[name] : @attributes["#{name}s"] + end + + # Unify some resources' names (eg, `ProjectComment` and `KeyComment` have the same + # attributes which are stored under `comment`) + # + # @return [String] + def unify(name) + UNIFIED_RESOURCES.each do |u_a| + return u_a if name.match?(/#{u_a}/) + end + + name + end + end + end +end diff --git a/lib/ruby_lokalise_api/utils/classes.rb b/lib/ruby_lokalise_api/utils/classes.rb new file mode 100644 index 0000000..f02cd33 --- /dev/null +++ b/lib/ruby_lokalise_api/utils/classes.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Utils + module Classes + refine Object do + # Turn `Module::Nested::ClassName` to just `ClassName` + def base_name + name.split('::').last + end + + def to_array + is_a?(Array) ? self : [self] + end + + def to_array_obj(key) + return self if is_a?(Hash) && (key?(key) || key?(key.to_s)) + + { key => to_array } + end + end + end + end +end diff --git a/lib/ruby_lokalise_api/utils/endpoint_helpers.rb b/lib/ruby_lokalise_api/utils/endpoint_helpers.rb deleted file mode 100644 index 6d2c88d..0000000 --- a/lib/ruby_lokalise_api/utils/endpoint_helpers.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module RubyLokaliseApi - module Utils - module EndpointHelpers - def path_from(raw_mapping) - template = Addressable::Template.new '{/segments*}' - template.expand( - segments: raw_mapping.to_a.flatten - ).to_s - end - end - end -end diff --git a/lib/ruby_lokalise_api/utils/keys.rb b/lib/ruby_lokalise_api/utils/keys.rb new file mode 100644 index 0000000..d5ea41c --- /dev/null +++ b/lib/ruby_lokalise_api/utils/keys.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Utils + module Keys + using RubyLokaliseApi::Utils::Strings + + def data_key_for(klass:) + key = if Module.const_defined? "RubyLokaliseApi::Resources::#{klass}::DATA_KEY" + Module.const_get "RubyLokaliseApi::Resources::#{klass}::DATA_KEY" + else + klass + end + + key.snakecase + end + + def collection_key_for(klass:) + key = if Module.const_defined?("RubyLokaliseApi::Collections::#{klass}::DATA_KEY") + Module.const_get("RubyLokaliseApi::Collections::#{klass}::DATA_KEY") + else + klass + end + + key.snakecase + end + end + end +end diff --git a/lib/ruby_lokalise_api/utils/loaders.rb b/lib/ruby_lokalise_api/utils/loaders.rb new file mode 100644 index 0000000..3f5833f --- /dev/null +++ b/lib/ruby_lokalise_api/utils/loaders.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Utils + module Loaders + private + + def endpoint(name:, client: self, params: {}) + klass = RubyLokaliseApi.const_get "Endpoints::#{name}Endpoint" + klass.new client, params + end + + def resource(name, data) + klass = RubyLokaliseApi.const_get "Resources::#{name}" + klass.new data + end + + def collection(name, data) + klass = RubyLokaliseApi.const_get "Collections::#{name}" + klass.new data + end + end + end +end diff --git a/lib/ruby_lokalise_api/utils/string_utils.rb b/lib/ruby_lokalise_api/utils/string_utils.rb deleted file mode 100644 index 77e2e5c..0000000 --- a/lib/ruby_lokalise_api/utils/string_utils.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -# Initial code taken from Facets gem by Rubyworks -# https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/snakecase.rb - -module RubyLokaliseApi - module Utils - module StringUtils - refine String do - # Underscore a string such that camelcase, dashes and spaces are - # replaced by underscores. - def snakecase - base_class_name. - gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). - gsub(/([a-z\d])([A-Z])/, '\1_\2'). - tr('-', '_'). - gsub(/\s/, '_'). - gsub(/__+/, '_'). - downcase - end - - # Turn `Module::Nested::ClassName` to just `ClassName` - def base_class_name - split('::').last - end - - def remove_trailing_slash - delete_suffix '/' - end - end - end - end -end diff --git a/lib/ruby_lokalise_api/utils/strings.rb b/lib/ruby_lokalise_api/utils/strings.rb new file mode 100644 index 0000000..e59b463 --- /dev/null +++ b/lib/ruby_lokalise_api/utils/strings.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module RubyLokaliseApi + module Utils + module Strings + refine String do + # Initial code taken from Facets gem by Rubyworks + # https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/snakecase.rb + def snakecase + gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). + gsub(/([a-z\d])([A-Z])/, '\1_\2'). + tr('-', '_'). + gsub(/\s/, '_'). + gsub(/__+/, '_'). + downcase + end + end + end + end +end diff --git a/lib/ruby_lokalise_api/version.rb b/lib/ruby_lokalise_api/version.rb index 1ebc5a0..48056b5 100644 --- a/lib/ruby_lokalise_api/version.rb +++ b/lib/ruby_lokalise_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RubyLokaliseApi - VERSION = '7.2.0' + VERSION = '8.0.0.rc1' end diff --git a/ruby-lokalise-api.gemspec b/ruby-lokalise-api.gemspec index e35d969..f8cabf9 100644 --- a/ruby-lokalise-api.gemspec +++ b/ruby-lokalise-api.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.7' spec.files = Dir['README.md', 'LICENSE', - 'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/attributes.yml', + 'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/*.yml', 'ruby-lokalise-api.gemspec', '.github/*.md', 'Gemfile', 'Rakefile'] spec.extra_rdoc_files = ['README.md'] @@ -36,7 +36,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rubocop-rake', '~> 0.6' spec.add_development_dependency 'rubocop-rspec', '~> 2.0' spec.add_development_dependency 'simplecov', '~> 0.21' - spec.add_development_dependency 'vcr', '~> 6.0' + spec.add_development_dependency 'simplecov-lcov', '~> 0.8' spec.add_development_dependency 'webmock', '~> 3.14' spec.metadata = { 'rubygems_mfa_required' => 'true' diff --git a/spec/fixtures/branches/branch.json b/spec/fixtures/branches/branch.json new file mode 100644 index 0000000..be6c485 --- /dev/null +++ b/spec/fixtures/branches/branch.json @@ -0,0 +1,11 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": { + "branch_id": 324739, + "name": "demo", + "created_at": "2023-07-11 16:48:04 (Etc/UTC)", + "created_at_timestamp": 1689094084, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } +} \ No newline at end of file diff --git a/spec/fixtures/branches/branch2.json b/spec/fixtures/branches/branch2.json new file mode 100644 index 0000000..5b2bcd7 --- /dev/null +++ b/spec/fixtures/branches/branch2.json @@ -0,0 +1,11 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": { + "branch_id": 324747, + "name": "Ruby_SDK", + "created_at": "2023-07-11 17:13:38 (Etc/UTC)", + "created_at_timestamp": 1689095618, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } +} \ No newline at end of file diff --git a/spec/fixtures/branches/branches.json b/spec/fixtures/branches/branches.json new file mode 100644 index 0000000..9981321 --- /dev/null +++ b/spec/fixtures/branches/branches.json @@ -0,0 +1,30 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "branches": [ + { + "branch_id": 324739, + "name": "demo", + "created_at": "2023-07-11 16:48:04 (Etc/UTC)", + "created_at_timestamp": 1689094084, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + }, + { + "branch_id": 324738, + "name": "develop", + "created_at": "2023-07-11 16:47:57 (Etc/UTC)", + "created_at_timestamp": 1689094077, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + }, + { + "branch_id": 309348, + "name": "master", + "created_at": "2023-05-10 12:55:50 (Etc/UTC)", + "created_at_timestamp": 1683723350, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/branches/branches_next_page.json b/spec/fixtures/branches/branches_next_page.json new file mode 100644 index 0000000..e8cb412 --- /dev/null +++ b/spec/fixtures/branches/branches_next_page.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "branches": [ + { + "branch_id": 309348, + "name": "master", + "created_at": "2023-05-10 12:55:50 (Etc/UTC)", + "created_at_timestamp": 1683723350, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/branches/branches_paginated.json b/spec/fixtures/branches/branches_paginated.json new file mode 100644 index 0000000..13ef84d --- /dev/null +++ b/spec/fixtures/branches/branches_paginated.json @@ -0,0 +1,22 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "branches": [ + { + "branch_id": 324739, + "name": "demo", + "created_at": "2023-07-11 16:48:04 (Etc/UTC)", + "created_at_timestamp": 1689094084, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + }, + { + "branch_id": 324738, + "name": "develop", + "created_at": "2023-07-11 16:47:57 (Etc/UTC)", + "created_at_timestamp": 1689094077, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/branches/create_branch.json b/spec/fixtures/branches/create_branch.json new file mode 100644 index 0000000..5b2bcd7 --- /dev/null +++ b/spec/fixtures/branches/create_branch.json @@ -0,0 +1,11 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": { + "branch_id": 324747, + "name": "Ruby_SDK", + "created_at": "2023-07-11 17:13:38 (Etc/UTC)", + "created_at_timestamp": 1689095618, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } +} \ No newline at end of file diff --git a/spec/fixtures/branches/destroy_branch.json b/spec/fixtures/branches/destroy_branch.json new file mode 100644 index 0000000..ffae042 --- /dev/null +++ b/spec/fixtures/branches/destroy_branch.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "branch_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/branches/merge_branch.json b/spec/fixtures/branches/merge_branch.json new file mode 100644 index 0000000..22298af --- /dev/null +++ b/spec/fixtures/branches/merge_branch.json @@ -0,0 +1,20 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch_merged": true, + "branch": { + "branch_id": 324747, + "name": "Ruby_SDK", + "created_at": "2023-07-11 17:13:38 (Etc/UTC)", + "created_at_timestamp": 1689095618, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + }, + "target_branch": { + "branch_id": 324738, + "name": "develop", + "created_at": "2023-07-11 16:47:57 (Etc/UTC)", + "created_at_timestamp": 1689094077, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } +} \ No newline at end of file diff --git a/spec/fixtures/branches/update_branch.json b/spec/fixtures/branches/update_branch.json new file mode 100644 index 0000000..06de2e1 --- /dev/null +++ b/spec/fixtures/branches/update_branch.json @@ -0,0 +1,11 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": { + "branch_id": 324739, + "name": "Ruby_updated", + "created_at": "2023-07-11 16:48:04 (Etc/UTC)", + "created_at_timestamp": 1689094084, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com" + } +} \ No newline at end of file diff --git a/spec/fixtures/comments/comment.json b/spec/fixtures/comments/comment.json new file mode 100644 index 0000000..c3b9b7b --- /dev/null +++ b/spec/fixtures/comments/comment.json @@ -0,0 +1,12 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comment": { + "comment_id": 16588650, + "key_id": 301832195, + "comment": "

Hi!

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-21 14:11:11 (Etc/UTC)", + "added_at_timestamp": 1682086271 + } +} \ No newline at end of file diff --git a/spec/fixtures/comments/comment2.json b/spec/fixtures/comments/comment2.json new file mode 100644 index 0000000..fbb4dea --- /dev/null +++ b/spec/fixtures/comments/comment2.json @@ -0,0 +1,12 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comment": { + "comment_id": 16784634, + "key_id": 301832195, + "comment": "

Comment1

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-05-09 11:46:13 (Etc/UTC)", + "added_at_timestamp": 1683632773 + } +} \ No newline at end of file diff --git a/spec/fixtures/comments/comments.json b/spec/fixtures/comments/comments.json new file mode 100644 index 0000000..383a5b1 --- /dev/null +++ b/spec/fixtures/comments/comments.json @@ -0,0 +1,32 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16588650, + "key_id": 301832195, + "comment": "

Hi!

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-25 13:38:51 (Etc/UTC)", + "added_at_timestamp": 1682429931 + }, + { + "comment_id": 16617652, + "key_id": 301832195, + "comment": "

Hi to you too

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:20 (Etc/UTC)", + "added_at_timestamp": 1682601380 + }, + { + "comment_id": 16617653, + "key_id": 301832195, + "comment": "

How are things?

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:28 (Etc/UTC)", + "added_at_timestamp": 1682601388 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/comments_next_page.json b/spec/fixtures/comments/comments_next_page.json new file mode 100644 index 0000000..1aa8d69 --- /dev/null +++ b/spec/fixtures/comments/comments_next_page.json @@ -0,0 +1,14 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16617653, + "key_id": 301832195, + "comment": "

How are things?

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:28 (Etc/UTC)", + "added_at_timestamp": 1682601388 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/comments_paginated.json b/spec/fixtures/comments/comments_paginated.json new file mode 100644 index 0000000..2224507 --- /dev/null +++ b/spec/fixtures/comments/comments_paginated.json @@ -0,0 +1,23 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16588650, + "key_id": 301832195, + "comment": "

Hi!

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-25 13:38:51 (Etc/UTC)", + "added_at_timestamp": 1682429931 + }, + { + "comment_id": 16617652, + "key_id": 301832195, + "comment": "

Hi to you too

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:20 (Etc/UTC)", + "added_at_timestamp": 1682601380 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/destroy_comment.json b/spec/fixtures/comments/destroy_comment.json new file mode 100644 index 0000000..9da9130 --- /dev/null +++ b/spec/fixtures/comments/destroy_comment.json @@ -0,0 +1,4 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comment_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/comments/multiple_created_comments.json b/spec/fixtures/comments/multiple_created_comments.json new file mode 100644 index 0000000..174bfeb --- /dev/null +++ b/spec/fixtures/comments/multiple_created_comments.json @@ -0,0 +1,23 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16784634, + "key_id": 301832195, + "comment": "Comment1", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-05-09 11:46:13 (Etc/UTC)", + "added_at_timestamp": 1683632773 + }, + { + "comment_id": 16784635, + "key_id": 301832195, + "comment": "Comment2", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-05-09 11:46:13 (Etc/UTC)", + "added_at_timestamp": 1683632773 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/project_comments.json b/spec/fixtures/comments/project_comments.json new file mode 100644 index 0000000..383a5b1 --- /dev/null +++ b/spec/fixtures/comments/project_comments.json @@ -0,0 +1,32 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16588650, + "key_id": 301832195, + "comment": "

Hi!

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-25 13:38:51 (Etc/UTC)", + "added_at_timestamp": 1682429931 + }, + { + "comment_id": 16617652, + "key_id": 301832195, + "comment": "

Hi to you too

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:20 (Etc/UTC)", + "added_at_timestamp": 1682601380 + }, + { + "comment_id": 16617653, + "key_id": 301832195, + "comment": "

How are things?

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:28 (Etc/UTC)", + "added_at_timestamp": 1682601388 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/project_comments_next_page.json b/spec/fixtures/comments/project_comments_next_page.json new file mode 100644 index 0000000..1aa8d69 --- /dev/null +++ b/spec/fixtures/comments/project_comments_next_page.json @@ -0,0 +1,14 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16617653, + "key_id": 301832195, + "comment": "

How are things?

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:28 (Etc/UTC)", + "added_at_timestamp": 1682601388 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/project_comments_paginated.json b/spec/fixtures/comments/project_comments_paginated.json new file mode 100644 index 0000000..2224507 --- /dev/null +++ b/spec/fixtures/comments/project_comments_paginated.json @@ -0,0 +1,23 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16588650, + "key_id": 301832195, + "comment": "

Hi!

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-25 13:38:51 (Etc/UTC)", + "added_at_timestamp": 1682429931 + }, + { + "comment_id": 16617652, + "key_id": 301832195, + "comment": "

Hi to you too

", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-04-27 13:16:20 (Etc/UTC)", + "added_at_timestamp": 1682601380 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/comments/single_created_comment.json b/spec/fixtures/comments/single_created_comment.json new file mode 100644 index 0000000..8857e25 --- /dev/null +++ b/spec/fixtures/comments/single_created_comment.json @@ -0,0 +1,14 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "comments": [ + { + "comment_id": 16784628, + "key_id": 301832195, + "comment": "A single Ruby comment", + "added_by": 20181, + "added_by_email": "bodrovis@protonmail.com", + "added_at": "2023-05-09 11:40:17 (Etc/UTC)", + "added_at_timestamp": 1683632417 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/contributors/contributor.json b/spec/fixtures/contributors/contributor.json new file mode 100644 index 0000000..3056b2c --- /dev/null +++ b/spec/fixtures/contributors/contributor.json @@ -0,0 +1,52 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributor": { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B", + "created_at": "2018-08-21 15:35:25 (Etc/UTC)", + "created_at_timestamp": 1534865725, + "is_admin": true, + "is_reviewer": true, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/contributors/contributor2.json b/spec/fixtures/contributors/contributor2.json new file mode 100644 index 0000000..7e2747c --- /dev/null +++ b/spec/fixtures/contributors/contributor2.json @@ -0,0 +1,52 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributor": { + "user_id": 269338, + "email": "ruby@contributor.sample", + "fullname": "Ruby Contributor", + "created_at": "2023-05-09 12:10:18 (Etc/UTC)", + "created_at_timestamp": 1683634218, + "is_admin": true, + "is_reviewer": false, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/contributors/contributors.json b/spec/fixtures/contributors/contributors.json new file mode 100644 index 0000000..ca4a38a --- /dev/null +++ b/spec/fixtures/contributors/contributors.json @@ -0,0 +1,125 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "branch": "master", + "contributors": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B", + "created_at": "2018-08-21 15:35:25 (Etc/UTC)", + "created_at_timestamp": 1534865725, + "is_admin": true, + "is_reviewer": true, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + }, + { + "user_id": 49436, + "email": "ilya@lokalise.com", + "fullname": "Ilya", + "created_at": "2019-11-06 12:57:29 (Etc/UTC)", + "created_at_timestamp": 1573045049, + "is_admin": false, + "is_reviewer": true, + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": false + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + } + ], + "admin_rights": [] + }, + { + "user_id": 71999, + "email": "ann@example.com", + "fullname": "Ann", + "created_at": "2020-07-27 13:26:19 (Etc/UTC)", + "created_at_timestamp": 1595856379, + "is_admin": true, + "is_reviewer": false, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "contributors", + "glossary", + "keys", + "settings", + "create_branches", + "activity", + "statistics" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/contributors/contributors_next_page.json b/spec/fixtures/contributors/contributors_next_page.json new file mode 100644 index 0000000..6a3615d --- /dev/null +++ b/spec/fixtures/contributors/contributors_next_page.json @@ -0,0 +1,51 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributors": [ + { + "user_id": 71999, + "email": "ann@example.com", + "fullname": "Ann", + "created_at": "2020-07-27 13:26:19 (Etc/UTC)", + "created_at_timestamp": 1595856379, + "is_admin": true, + "is_reviewer": false, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "contributors", + "glossary", + "keys", + "settings", + "create_branches", + "activity", + "statistics" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/contributors/contributors_paginated.json b/spec/fixtures/contributors/contributors_paginated.json new file mode 100644 index 0000000..a7c928d --- /dev/null +++ b/spec/fixtures/contributors/contributors_paginated.json @@ -0,0 +1,78 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributors": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B", + "created_at": "2018-08-21 15:35:25 (Etc/UTC)", + "created_at_timestamp": 1534865725, + "is_admin": true, + "is_reviewer": true, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + }, + { + "user_id": 49436, + "email": "ilya@lokalise.com", + "fullname": "Ilya", + "created_at": "2019-11-06 12:57:29 (Etc/UTC)", + "created_at_timestamp": 1573045049, + "is_admin": false, + "is_reviewer": true, + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": false + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + } + ], + "admin_rights": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/contributors/create_contributor.json b/spec/fixtures/contributors/create_contributor.json new file mode 100644 index 0000000..f3105f1 --- /dev/null +++ b/spec/fixtures/contributors/create_contributor.json @@ -0,0 +1,54 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributors": [ + { + "user_id": 269338, + "email": "ruby@contributor.sample", + "fullname": "Ruby Contributor", + "created_at": "2023-05-09 12:10:18 (Etc/UTC)", + "created_at_timestamp": 1683634218, + "is_admin": true, + "is_reviewer": false, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/contributors/destroy_contributor.json b/spec/fixtures/contributors/destroy_contributor.json new file mode 100644 index 0000000..824ef9f --- /dev/null +++ b/spec/fixtures/contributors/destroy_contributor.json @@ -0,0 +1,4 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributor_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/contributors/update_contributor.json b/spec/fixtures/contributors/update_contributor.json new file mode 100644 index 0000000..809046b --- /dev/null +++ b/spec/fixtures/contributors/update_contributor.json @@ -0,0 +1,52 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "contributor": { + "user_id": 269338, + "email": "ruby@contributor.sample", + "fullname": "Ruby Contributor", + "created_at": "2023-05-09 12:10:18 (Etc/UTC)", + "created_at_timestamp": 1683634218, + "is_admin": true, + "is_reviewer": true, + "languages": [ + { + "lang_id": 10001, + "lang_iso": "custom_1", + "lang_name": "Quenya", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_writable": true + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_writable": true + } + ], + "admin_rights": [ + "upload", + "download", + "tasks", + "contributors", + "screenshots", + "glossary", + "keys", + "languages", + "settings", + "create_branches", + "activity", + "statistics" + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/cts/colors.json b/spec/fixtures/cts/colors.json new file mode 100644 index 0000000..24f507d --- /dev/null +++ b/spec/fixtures/cts/colors.json @@ -0,0 +1,13 @@ +{ + "colors": [ + "#61bd4f", + "#f2d600", + "#ff9f1a", + "#eb5a46", + "#c377e0", + "#0079bf", + "#00c2e0", + "#344563", + "#ff78cb" + ] +} \ No newline at end of file diff --git a/spec/fixtures/cts/create_status.json b/spec/fixtures/cts/create_status.json new file mode 100644 index 0000000..fd465bd --- /dev/null +++ b/spec/fixtures/cts/create_status.json @@ -0,0 +1,9 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status": { + "status_id": 14465, + "title": "ruby", + "color": "#ff9f1a" + } +} \ No newline at end of file diff --git a/spec/fixtures/cts/destroy_status.json b/spec/fixtures/cts/destroy_status.json new file mode 100644 index 0000000..9e3bd19 --- /dev/null +++ b/spec/fixtures/cts/destroy_status.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/cts/destroy_status2.json b/spec/fixtures/cts/destroy_status2.json new file mode 100644 index 0000000..9e3bd19 --- /dev/null +++ b/spec/fixtures/cts/destroy_status2.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/cts/status.json b/spec/fixtures/cts/status.json new file mode 100644 index 0000000..2103976 --- /dev/null +++ b/spec/fixtures/cts/status.json @@ -0,0 +1,9 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status": { + "status_id": 14462, + "title": "approved", + "color": "#0079bf" + } +} \ No newline at end of file diff --git a/spec/fixtures/cts/statuses.json b/spec/fixtures/cts/statuses.json new file mode 100644 index 0000000..e46ae4e --- /dev/null +++ b/spec/fixtures/cts/statuses.json @@ -0,0 +1,21 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_statuses": [ + { + "status_id": 14462, + "title": "approved", + "color": "#0079bf" + }, + { + "status_id": 14460, + "title": "context", + "color": "#61bd4f" + }, + { + "status_id": 14461, + "title": "wip", + "color": "#f2d600" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/cts/update_status.json b/spec/fixtures/cts/update_status.json new file mode 100644 index 0000000..e3fec7f --- /dev/null +++ b/spec/fixtures/cts/update_status.json @@ -0,0 +1,9 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status": { + "status_id": 14465, + "title": "ruby2", + "color": "#ff9f1a" + } +} \ No newline at end of file diff --git a/spec/fixtures/cts/update_status2.json b/spec/fixtures/cts/update_status2.json new file mode 100644 index 0000000..907c1c0 --- /dev/null +++ b/spec/fixtures/cts/update_status2.json @@ -0,0 +1,9 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "custom_translation_status": { + "status_id": 14462, + "title": "ruby3", + "color": "#0079bf" + } +} \ No newline at end of file diff --git a/spec/fixtures/errors/invalid_token.json b/spec/fixtures/errors/invalid_token.json new file mode 100644 index 0000000..06ed7b3 --- /dev/null +++ b/spec/fixtures/errors/invalid_token.json @@ -0,0 +1,6 @@ +{ + "error": { + "message": "Invalid `X-Api-Token` header", + "code": 400 + } +} \ No newline at end of file diff --git a/spec/fixtures/errors/not_found.json b/spec/fixtures/errors/not_found.json new file mode 100644 index 0000000..428b81b --- /dev/null +++ b/spec/fixtures/errors/not_found.json @@ -0,0 +1,6 @@ +{ + "error": { + "message": "Not Found", + "code": 404 + } +} \ No newline at end of file diff --git a/spec/fixtures/files/destroy_file.json b/spec/fixtures/files/destroy_file.json new file mode 100644 index 0000000..bca04d6 --- /dev/null +++ b/spec/fixtures/files/destroy_file.json @@ -0,0 +1,4 @@ +{ + "project_id": "92226400645e7e02104994.93406932", + "file_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/files/doc_files.json b/spec/fixtures/files/doc_files.json new file mode 100644 index 0000000..204099f --- /dev/null +++ b/spec/fixtures/files/doc_files.json @@ -0,0 +1,20 @@ +{ + "project_id": "92226400645e7e02104994.93406932", + "files": [ + { + "file_id": 1652770, + "filename": "pres_1.pptx", + "key_count": 28 + }, + { + "file_id": 1652771, + "filename": "pres_2.pptx", + "key_count": 2 + }, + { + "file_id": -1, + "filename": "__unassigned__", + "key_count": 0 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/files/download_files.json b/spec/fixtures/files/download_files.json new file mode 100644 index 0000000..931d4d6 --- /dev/null +++ b/spec/fixtures/files/download_files.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "bundle_url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/export/88628569645b945648b474.25982965/102fcf3dee20bc551d16939b939a069e/OnBoarding-2023-locale.zip" +} \ No newline at end of file diff --git a/spec/fixtures/files/files.json b/spec/fixtures/files/files.json new file mode 100644 index 0000000..8b3e5de --- /dev/null +++ b/spec/fixtures/files/files.json @@ -0,0 +1,26 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "files": [ + { + "file_id": 1642774, + "filename": "main-%LANG_ISO%.json", + "key_count": 2 + }, + { + "file_id": 1651841, + "filename": "pasted.json", + "key_count": 2 + }, + { + "file_id": 1642773, + "filename": "secondary-%LANG_ISO%.json", + "key_count": 1 + }, + { + "file_id": -1, + "filename": "__unassigned__", + "key_count": 5 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/files/files_page1.json b/spec/fixtures/files/files_page1.json new file mode 100644 index 0000000..79f50c2 --- /dev/null +++ b/spec/fixtures/files/files_page1.json @@ -0,0 +1,16 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "files": [ + { + "file_id": 1642774, + "filename": "main-%LANG_ISO%.json", + "key_count": 2 + }, + { + "file_id": 1651841, + "filename": "pasted.json", + "key_count": 2 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/files/files_page2.json b/spec/fixtures/files/files_page2.json new file mode 100644 index 0000000..cb89fa4 --- /dev/null +++ b/spec/fixtures/files/files_page2.json @@ -0,0 +1,16 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "files": [ + { + "file_id": 1642773, + "filename": "secondary-%LANG_ISO%.json", + "key_count": 1 + }, + { + "file_id": -1, + "filename": "__unassigned__", + "key_count": 5 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/files/upload_file.json b/spec/fixtures/files/upload_file.json new file mode 100644 index 0000000..698e990 --- /dev/null +++ b/spec/fixtures/files/upload_file.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "process": { + "process_id": "434a71d70c2d0d89d5c410066f101dda6e1117ca", + "type": "file-import", + "status": "queued", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-16 12:00:49 (Etc/UTC)", + "created_at_timestamp": 1684238449 + } +} \ No newline at end of file diff --git a/spec/fixtures/files/upload_file_reloaded.json b/spec/fixtures/files/upload_file_reloaded.json new file mode 100644 index 0000000..84bea44 --- /dev/null +++ b/spec/fixtures/files/upload_file_reloaded.json @@ -0,0 +1,29 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "process": { + "process_id": "434a71d70c2d0d89d5c410066f101dda6e1117ca", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-16 12:00:49 (Etc/UTC)", + "created_at_timestamp": 1684238449, + "details": { + "files": [ + { + "status": "finished", + "message": "", + "name_original": "rspec.json", + "name_custom": null, + "word_count_total": 2, + "key_count_total": 2, + "key_count_inserted": 2, + "key_count_updated": 0, + "key_count_skipped": 0 + } + ] + } + } +} \ No newline at end of file diff --git a/spec/fixtures/jwts/create_jwt.json b/spec/fixtures/jwts/create_jwt.json new file mode 100644 index 0000000..9a09cc5 --- /dev/null +++ b/spec/fixtures/jwts/create_jwt.json @@ -0,0 +1,3 @@ +{ + "jwt": "123abc" +} \ No newline at end of file diff --git a/spec/fixtures/keys/create_keys.json b/spec/fixtures/keys/create_keys.json new file mode 100644 index 0000000..c6e3448 --- /dev/null +++ b/spec/fixtures/keys/create_keys.json @@ -0,0 +1,129 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys": [ + { + "key_id": 331018374, + "created_at": "2023-05-31 11:06:04 (Etc/UTC)", + "created_at_timestamp": 1685531164, + "key_name": { + "ios": "ruby_k", + "android": "ruby_k", + "web": "ruby_k", + "other": "ruby_k" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2656087591, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "en", + "translation": "Ruby key", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087590, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "fr", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087588, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087589, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "lv", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "translations_modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "translations_modified_at_timestamp": 1685531164 + } + ], + "errors": [ + { + "message": "This key name is already taken", + "code": 400, + "key_name": { + "ios": "welcome", + "android": "welcome", + "web": "welcome", + "other": "welcome" + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/keys/destroy_key.json b/spec/fixtures/keys/destroy_key.json new file mode 100644 index 0000000..87d183a --- /dev/null +++ b/spec/fixtures/keys/destroy_key.json @@ -0,0 +1,6 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "key_removed": true, + "keys_locked": 0 +} \ No newline at end of file diff --git a/spec/fixtures/keys/destroy_keys.json b/spec/fixtures/keys/destroy_keys.json new file mode 100644 index 0000000..fd8d35d --- /dev/null +++ b/spec/fixtures/keys/destroy_keys.json @@ -0,0 +1,6 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys_removed": true, + "keys_locked": 0 +} \ No newline at end of file diff --git a/spec/fixtures/keys/key.json b/spec/fixtures/keys/key.json new file mode 100644 index 0000000..a5f5d43 --- /dev/null +++ b/spec/fixtures/keys/key.json @@ -0,0 +1,115 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "key": { + "key_id": 319782376, + "created_at": "2023-04-24 11:24:38 (Etc/UTC)", + "created_at_timestamp": 1682335478, + "key_name": { + "ios": "login", + "android": "login", + "web": "login", + "other": "login" + }, + "filenames": { + "ios": "", + "android": "", + "web": "main-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2574122413, + "segment_number": 1, + "key_id": 319782376, + "language_iso": "en", + "translation": "Sign in", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-10 13:35:02 (Etc/UTC)", + "modified_at_timestamp": 1683725702, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2574122414, + "segment_number": 1, + "key_id": 319782376, + "language_iso": "fr", + "translation": "S'identifier", + "modified_by": 49436, + "modified_by_email": "ilya@lokalise.com", + "modified_at": "2023-05-18 12:42:20 (Etc/UTC)", + "modified_at_timestamp": 1684413740, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2574122415, + "segment_number": 1, + "key_id": 319782376, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-10 13:35:02 (Etc/UTC)", + "modified_at_timestamp": 1683725702, + "is_reviewed": true, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2574122416, + "segment_number": 1, + "key_id": 319782376, + "language_iso": "lv", + "translation": "Izlogoties", + "modified_by": 49436, + "modified_by_email": "ilya@lokalise.com", + "modified_at": "2023-05-18 12:55:16 (Etc/UTC)", + "modified_at_timestamp": 1684414516, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 1, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-10 13:10:57 (Etc/UTC)", + "modified_at_timestamp": 1683724257, + "translations_modified_at": "2023-05-18 12:55:16 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414516 + } +} \ No newline at end of file diff --git a/spec/fixtures/keys/key2.json b/spec/fixtures/keys/key2.json new file mode 100644 index 0000000..5fb5a05 --- /dev/null +++ b/spec/fixtures/keys/key2.json @@ -0,0 +1,114 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "key": { + "key_id": 331082176, + "created_at": "2023-05-31 11:27:53 (Etc/UTC)", + "created_at_timestamp": 1685532473, + "key_name": { + "ios": "delete_me", + "android": "delete_me", + "web": "delete_me", + "other": "delete_me" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "", + "platforms": [ + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2656495766, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "en", + "translation": "Delete me!", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495765, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "fr", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495763, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495764, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "lv", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "translations_modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "translations_modified_at_timestamp": 1685532473 + } +} \ No newline at end of file diff --git a/spec/fixtures/keys/keys.json b/spec/fixtures/keys/keys.json new file mode 100644 index 0000000..9277991 --- /dev/null +++ b/spec/fixtures/keys/keys.json @@ -0,0 +1,178 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys": [ + { + "key_id": 319782369, + "created_at": "2023-04-06 17:49:36 (Etc/UTC)", + "created_at_timestamp": 1680803376, + "key_name": { + "ios": "hi", + "android": "hi", + "web": "hi", + "other": "hi" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "Welcoming message", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 3, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-09 11:59:42 (Etc/UTC)", + "modified_at_timestamp": 1683633582, + "translations_modified_at": "2023-05-18 12:55:25 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414525 + }, + { + "key_id": 319782372, + "created_at": "2023-04-18 16:40:16 (Etc/UTC)", + "created_at_timestamp": 1681836016, + "key_name": { + "ios": "editor", + "android": "editor", + "web": "editor", + "other": "editor" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "", + "platforms": [ + "android" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 1, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:28:17 (Etc/UTC)", + "modified_at_timestamp": 1682335697, + "translations_modified_at": "2023-05-18 12:55:19 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414519 + }, + { + "key_id": 319782374, + "created_at": "2023-04-24 11:18:41 (Etc/UTC)", + "created_at_timestamp": 1682335121, + "key_name": { + "ios": "welcome", + "android": "welcome", + "web": "welcome", + "other": "welcome" + }, + "filenames": { + "ios": "", + "android": "", + "web": "secondary-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 5, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:20:11 (Etc/UTC)", + "modified_at_timestamp": 1682335211, + "translations_modified_at": "2023-05-18 12:55:17 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414517 + }, + { + "key_id": 319782375, + "created_at": "2023-04-24 11:24:38 (Etc/UTC)", + "created_at_timestamp": 1682335478, + "key_name": { + "ios": "how_are_you", + "android": "how_are_you", + "web": "how_are_you", + "other": "how_are_you" + }, + "filenames": { + "ios": "", + "android": "", + "web": "main-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 4, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:24:38 (Etc/UTC)", + "modified_at_timestamp": 1682335478, + "translations_modified_at": "2023-05-18 12:55:17 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414517 + }, + { + "key_id": 319782376, + "created_at": "2023-04-24 11:24:38 (Etc/UTC)", + "created_at_timestamp": 1682335478, + "key_name": { + "ios": "login", + "android": "login", + "web": "login", + "other": "login" + }, + "filenames": { + "ios": "", + "android": "", + "web": "main-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-10 13:10:57 (Etc/UTC)", + "modified_at_timestamp": 1683724257, + "translations_modified_at": "2023-05-18 12:55:16 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414516 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/keys/keys_page1.json b/spec/fixtures/keys/keys_page1.json new file mode 100644 index 0000000..f04c255 --- /dev/null +++ b/spec/fixtures/keys/keys_page1.json @@ -0,0 +1,109 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys": [ + { + "key_id": 319782369, + "created_at": "2023-04-06 17:49:36 (Etc/UTC)", + "created_at_timestamp": 1680803376, + "key_name": { + "ios": "hi", + "android": "hi", + "web": "hi", + "other": "hi" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "Welcoming message", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 3, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-09 11:59:42 (Etc/UTC)", + "modified_at_timestamp": 1683633582, + "translations_modified_at": "2023-05-18 12:55:25 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414525 + }, + { + "key_id": 319782372, + "created_at": "2023-04-18 16:40:16 (Etc/UTC)", + "created_at_timestamp": 1681836016, + "key_name": { + "ios": "editor", + "android": "editor", + "web": "editor", + "other": "editor" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "", + "platforms": [ + "android" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 1, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:28:17 (Etc/UTC)", + "modified_at_timestamp": 1682335697, + "translations_modified_at": "2023-05-18 12:55:19 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414519 + }, + { + "key_id": 319782374, + "created_at": "2023-04-24 11:18:41 (Etc/UTC)", + "created_at_timestamp": 1682335121, + "key_name": { + "ios": "welcome", + "android": "welcome", + "web": "welcome", + "other": "welcome" + }, + "filenames": { + "ios": "", + "android": "", + "web": "secondary-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 5, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:20:11 (Etc/UTC)", + "modified_at_timestamp": 1682335211, + "translations_modified_at": "2023-05-18 12:55:17 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414517 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/keys/keys_page2.json b/spec/fixtures/keys/keys_page2.json new file mode 100644 index 0000000..734ff40 --- /dev/null +++ b/spec/fixtures/keys/keys_page2.json @@ -0,0 +1,75 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys": [ + { + "key_id": 319782375, + "created_at": "2023-04-24 11:24:38 (Etc/UTC)", + "created_at_timestamp": 1682335478, + "key_name": { + "ios": "how_are_you", + "android": "how_are_you", + "web": "how_are_you", + "other": "how_are_you" + }, + "filenames": { + "ios": "", + "android": "", + "web": "main-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 4, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-04-24 11:24:38 (Etc/UTC)", + "modified_at_timestamp": 1682335478, + "translations_modified_at": "2023-05-18 12:55:17 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414517 + }, + { + "key_id": 319782376, + "created_at": "2023-04-24 11:24:38 (Etc/UTC)", + "created_at_timestamp": 1682335478, + "key_name": { + "ios": "login", + "android": "login", + "web": "login", + "other": "login" + }, + "filenames": { + "ios": "", + "android": "", + "web": "main-%LANG_ISO%.json", + "other": "" + }, + "description": "", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-10 13:10:57 (Etc/UTC)", + "modified_at_timestamp": 1683724257, + "translations_modified_at": "2023-05-18 12:55:16 (Etc/UTC)", + "translations_modified_at_timestamp": 1684414516 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/keys/update_key.json b/spec/fixtures/keys/update_key.json new file mode 100644 index 0000000..7d5eada --- /dev/null +++ b/spec/fixtures/keys/update_key.json @@ -0,0 +1,115 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "key": { + "key_id": 331018374, + "created_at": "2023-05-31 11:06:04 (Etc/UTC)", + "created_at_timestamp": 1685531164, + "key_name": { + "ios": "ruby_k", + "android": "ruby_k", + "web": "ruby_k", + "other": "ruby_k" + }, + "filenames": { + "ios": "", + "android": "", + "web": "%LANG_ISO%.yml", + "other": "" + }, + "description": "Ruby updated", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2656087591, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "en", + "translation": "Ruby key", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087590, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "fr", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087588, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087589, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "lv", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-31 11:24:12 (Etc/UTC)", + "modified_at_timestamp": 1685532252, + "translations_modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "translations_modified_at_timestamp": 1685531164 + } +} \ No newline at end of file diff --git a/spec/fixtures/keys/update_key2.json b/spec/fixtures/keys/update_key2.json new file mode 100644 index 0000000..17c5f8a --- /dev/null +++ b/spec/fixtures/keys/update_key2.json @@ -0,0 +1,114 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "key": { + "key_id": 331082176, + "created_at": "2023-05-31 11:27:53 (Etc/UTC)", + "created_at_timestamp": 1685532473, + "key_name": { + "ios": "delete_me", + "android": "delete_me", + "web": "delete_me", + "other": "delete_me" + }, + "filenames": { + "ios": "", + "android": "", + "web": "", + "other": "" + }, + "description": "to delete", + "platforms": [ + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2656495766, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "en", + "translation": "Delete me!", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495765, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "fr", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495763, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656495764, + "segment_number": 1, + "key_id": 331082176, + "language_iso": "lv", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "modified_at_timestamp": 1685532473, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-31 11:35:05 (Etc/UTC)", + "modified_at_timestamp": 1685532905, + "translations_modified_at": "2023-05-31 11:27:53 (Etc/UTC)", + "translations_modified_at_timestamp": 1685532473 + } +} \ No newline at end of file diff --git a/spec/fixtures/keys/update_keys.json b/spec/fixtures/keys/update_keys.json new file mode 100644 index 0000000..bda9ef7 --- /dev/null +++ b/spec/fixtures/keys/update_keys.json @@ -0,0 +1,124 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "keys": [ + { + "key_id": 331018374, + "created_at": "2023-05-31 11:06:04 (Etc/UTC)", + "created_at_timestamp": 1685531164, + "key_name": { + "ios": "ruby_k", + "android": "ruby_k", + "web": "ruby_k", + "other": "ruby_k" + }, + "filenames": { + "ios": "", + "android": "", + "web": "%LANG_ISO%.yml", + "other": "" + }, + "description": "", + "platforms": [ + "ios", + "web" + ], + "tags": [], + "comments": [], + "screenshots": [], + "translations": [ + { + "translation_id": 2656087591, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "en", + "translation": "Ruby key", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 2, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087590, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "fr", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087588, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "sind", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2656087589, + "segment_number": 1, + "key_id": 331018374, + "language_iso": "lv", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + } + ], + "is_plural": false, + "plural_name": "", + "is_hidden": false, + "is_archived": false, + "context": "", + "base_words": 2, + "char_limit": 0, + "custom_attributes": "", + "modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "modified_at_timestamp": 1685531164, + "translations_modified_at": "2023-05-31 11:06:04 (Etc/UTC)", + "translations_modified_at_timestamp": 1685531164 + } + ], + "errors": [ + { + "message": "Key not found in the project", + "code": 404, + "key_id": 1 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/create_project_languages.json b/spec/fixtures/languages/create_project_languages.json new file mode 100644 index 0000000..2f3b92f --- /dev/null +++ b/spec/fixtures/languages/create_project_languages.json @@ -0,0 +1,27 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "languages": [ + { + "lang_id": 666, + "lang_iso": "de", + "lang_name": "German", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 737, + "lang_iso": "nl", + "lang_name": "Dutch", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + } + ], + "errors": [] +} \ No newline at end of file diff --git a/spec/fixtures/languages/destroy_language.json b/spec/fixtures/languages/destroy_language.json new file mode 100644 index 0000000..3f77ead --- /dev/null +++ b/spec/fixtures/languages/destroy_language.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "language_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/languages/project_language.json b/spec/fixtures/languages/project_language.json new file mode 100644 index 0000000..1d2b0b7 --- /dev/null +++ b/spec/fixtures/languages/project_language.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "language": { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/languages/project_languages.json b/spec/fixtures/languages/project_languages.json new file mode 100644 index 0000000..5adb146 --- /dev/null +++ b/spec/fixtures/languages/project_languages.json @@ -0,0 +1,52 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "languages": [ + { + "lang_id": 10001, + "lang_iso": "sind", + "lang_name": "Sindarin", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "few", + "many", + "other" + ] + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "other" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/project_languages_page1.json b/spec/fixtures/languages/project_languages_page1.json new file mode 100644 index 0000000..d5a8363 --- /dev/null +++ b/spec/fixtures/languages/project_languages_page1.json @@ -0,0 +1,30 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "languages": [ + { + "lang_id": 10001, + "lang_iso": "sind", + "lang_name": "Sindarin", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "few", + "many", + "other" + ] + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/project_languages_page2.json b/spec/fixtures/languages/project_languages_page2.json new file mode 100644 index 0000000..19b713f --- /dev/null +++ b/spec/fixtures/languages/project_languages_page2.json @@ -0,0 +1,28 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "languages": [ + { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 10153, + "lang_iso": "lv", + "lang_name": "Latvian", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "other" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/system_languages_page1.json b/spec/fixtures/languages/system_languages_page1.json new file mode 100644 index 0000000..188a283 --- /dev/null +++ b/spec/fixtures/languages/system_languages_page1.json @@ -0,0 +1,42 @@ +{ + "languages": [ + { + "lang_id": 894, + "lang_iso": "ab", + "lang_name": "Abkhaz", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "few", + "many", + "other" + ] + }, + { + "lang_id": 891, + "lang_iso": "aa", + "lang_name": "Afar", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "few", + "many", + "other" + ] + }, + { + "lang_id": 790, + "lang_iso": "af", + "lang_name": "Afrikaans", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/system_languages_page2.json b/spec/fixtures/languages/system_languages_page2.json new file mode 100644 index 0000000..141b671 --- /dev/null +++ b/spec/fixtures/languages/system_languages_page2.json @@ -0,0 +1,38 @@ +{ + "languages": [ + { + "lang_id": 791, + "lang_iso": "af_NA", + "lang_name": "Afrikaans (Namibia)", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 792, + "lang_iso": "af_ZA", + "lang_name": "Afrikaans (South Africa)", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + }, + { + "lang_id": 977, + "lang_iso": "agq", + "lang_name": "Aghem", + "is_rtl": false, + "plural_forms": [ + "zero", + "one", + "two", + "few", + "many", + "other" + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/languages/update_project_language.json b/spec/fixtures/languages/update_project_language.json new file mode 100644 index 0000000..f942759 --- /dev/null +++ b/spec/fixtures/languages/update_project_language.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "language": { + "lang_id": 673, + "lang_iso": "fr", + "lang_name": "French (updated)", + "is_rtl": false, + "plural_forms": [ + "one", + "other" + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/orders/create_order.json b/spec/fixtures/orders/create_order.json new file mode 100644 index 0000000..8bc25e8 --- /dev/null +++ b/spec/fixtures/orders/create_order.json @@ -0,0 +1,29 @@ +{ + "order_id": null, + "project_id": "963054665b7c313dd9b323.35886655", + "branch": "master", + "card_id": 1774, + "payment_method": "credit_card", + "status": "draft", + "created_at": "2023-07-06 15:17:19 (Etc/UTC)", + "created_at_timestamp": 1688656639, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru" + ], + "keys": [ + 62341144, + 332517634 + ], + "source_words": { + "ru": 7 + }, + "provider_slug": "gengo", + "translation_tier": 1, + "translation_tier_name": "Native speaker", + "briefing": "demo", + "total": 0.48, + "dry_run": true +} \ No newline at end of file diff --git a/spec/fixtures/orders/order.json b/spec/fixtures/orders/order.json new file mode 100644 index 0000000..e9898d6 --- /dev/null +++ b/spec/fixtures/orders/order.json @@ -0,0 +1,29 @@ +{ + "order_id": "201903198B2", + "project_id": "803826145ba90b42d5d860.46800099", + "branch": null, + "payment_method": null, + "card_id": 1774, + "status": "completed", + "created_at": "2019-03-19 18:18:21 (Etc/UTC)", + "created_at_timestamp": 1553019501, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru" + ], + "keys": [ + 15519786 + ], + "source_words": { + "ru": 1 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "Some briefing", + "is_saved_to_translation_memory": true, + "total": 0.07 +} \ No newline at end of file diff --git a/spec/fixtures/orders/orders.json b/spec/fixtures/orders/orders.json new file mode 100644 index 0000000..2f1bcb2 --- /dev/null +++ b/spec/fixtures/orders/orders.json @@ -0,0 +1,156 @@ +{ + "orders": [ + { + "order_id": "201903198B2", + "project_id": "803826145ba90b42d5d860.46800099", + "branch": null, + "payment_method": null, + "card_id": 1774, + "status": "completed", + "created_at": "2019-03-19 18:18:21 (Etc/UTC)", + "created_at_timestamp": 1553019501, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru" + ], + "keys": [ + 15519786 + ], + "source_words": { + "ru": 1 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "Some briefing", + "is_saved_to_translation_memory": true, + "total": 0.07 + }, + { + "order_id": "20190619AHL", + "project_id": "803826145ba90b42d5d860.46800099", + "branch": null, + "payment_method": null, + "card_id": 1774, + "status": "completed", + "created_at": "2019-06-19 16:43:33 (Etc/UTC)", + "created_at_timestamp": 1560962613, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "nl" + ], + "keys": [ + 15519786 + ], + "source_words": { + "nl": 3 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "Nothing specific", + "is_saved_to_translation_memory": true, + "total": 0.29 + }, + { + "order_id": "20200116FM1", + "project_id": "576418155e1db80a3136c5.33298570", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-16 14:20:56 (Etc/UTC)", + "created_at_timestamp": 1579184456, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "lv_LV" + ], + "keys": [ + 35076371, + 35083374, + 35087356, + 35087357, + 35091519 + ], + "source_words": { + "lv_LV": 22 + }, + "provider_slug": "google", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": null, + "briefing": null, + "is_saved_to_translation_memory": true, + "total": 0.02 + }, + { + "order_id": "20200122FTR", + "project_id": "124505395e2074d880f724.35422706", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-22 12:04:15 (Etc/UTC)", + "created_at_timestamp": 1579694655, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru_RU" + ], + "keys": [ + 35400063, + 35400274, + 35434575 + ], + "source_words": { + "ru_RU": 3 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "test", + "is_saved_to_translation_memory": true, + "total": 0.21 + }, + { + "order_id": "20200127G0B", + "project_id": "124505395e2074d880f724.35422706", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-27 14:29:25 (Etc/UTC)", + "created_at_timestamp": 1580135365, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru_RU" + ], + "keys": [ + 35398054, + 35446861 + ], + "source_words": { + "ru_RU": 6 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "Nothing specific.", + "is_saved_to_translation_memory": true, + "total": 0.41 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/orders/orders_page2.json b/spec/fixtures/orders/orders_page2.json new file mode 100644 index 0000000..4f1b6de --- /dev/null +++ b/spec/fixtures/orders/orders_page2.json @@ -0,0 +1,68 @@ +{ + "orders": [ + { + "order_id": "20200116FM1", + "project_id": "576418155e1db80a3136c5.33298570", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-16 14:20:56 (Etc/UTC)", + "created_at_timestamp": 1579184456, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "lv_LV" + ], + "keys": [ + 35076371, + 35083374, + 35087356, + 35087357, + 35091519 + ], + "source_words": { + "lv_LV": 22 + }, + "provider_slug": "google", + "translation_style": null, + "translation_tier": 1, + "translation_tier_name": null, + "briefing": null, + "is_saved_to_translation_memory": true, + "total": 0.02 + }, + { + "order_id": "20200122FTR", + "project_id": "124505395e2074d880f724.35422706", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-22 12:04:15 (Etc/UTC)", + "created_at_timestamp": 1579694655, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru_RU" + ], + "keys": [ + 35400063, + 35400274, + 35434575 + ], + "source_words": { + "ru_RU": 3 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "test", + "is_saved_to_translation_memory": true, + "total": 0.21 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/orders/orders_page3.json b/spec/fixtures/orders/orders_page3.json new file mode 100644 index 0000000..20cf36e --- /dev/null +++ b/spec/fixtures/orders/orders_page3.json @@ -0,0 +1,64 @@ +{ + "orders": [ + { + "order_id": "20200127G0B", + "project_id": "124505395e2074d880f724.35422706", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-01-27 14:29:25 (Etc/UTC)", + "created_at_timestamp": 1580135365, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru_RU" + ], + "keys": [ + 35398054, + 35446861 + ], + "source_words": { + "ru_RU": 6 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "Nothing specific.", + "is_saved_to_translation_memory": true, + "total": 0.41 + }, + { + "order_id": "20200620NFL", + "project_id": "454087345e09f3e7e7eae3.57891254", + "branch": null, + "payment_method": null, + "card_id": 2185, + "status": "completed", + "created_at": "2020-06-20 15:57:59 (Etc/UTC)", + "created_at_timestamp": 1592668679, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "target_language_isos": [ + "ru_RU" + ], + "keys": [ + 34089721 + ], + "source_words": { + "ru_RU": 2 + }, + "provider_slug": "gengo", + "translation_style": "friendly", + "translation_tier": 1, + "translation_tier_name": "Professional translator", + "briefing": "nothing special", + "is_saved_to_translation_memory": true, + "total": 0.14 + } + ], + "team_id": 176692 +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/create_payment_card.json b/spec/fixtures/payment_cards/create_payment_card.json new file mode 100644 index 0000000..c20d2bd --- /dev/null +++ b/spec/fixtures/payment_cards/create_payment_card.json @@ -0,0 +1,7 @@ +{ + "card_id": 1234, + "last4": "4242", + "brand": "Visa", + "created_at": "2018-12-31 12:00:00 (Etc/UTC)", + "created_at_timestamp": 1546257600 +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/destroy_payment_card.json b/spec/fixtures/payment_cards/destroy_payment_card.json new file mode 100644 index 0000000..3d636f3 --- /dev/null +++ b/spec/fixtures/payment_cards/destroy_payment_card.json @@ -0,0 +1,4 @@ +{ + "card_id": 1774, + "card_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/payment_card.json b/spec/fixtures/payment_cards/payment_card.json new file mode 100644 index 0000000..6939942 --- /dev/null +++ b/spec/fixtures/payment_cards/payment_card.json @@ -0,0 +1,10 @@ +{ + "user_id": 20181, + "payment_card": { + "card_id": 1774, + "last4": "0358", + "brand": "Visa", + "created_at": "2019-03-19 17:49:07 (Etc/UTC)", + "created_at_timestamp": 1553017747 + } +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/payment_cards.json b/spec/fixtures/payment_cards/payment_cards.json new file mode 100644 index 0000000..e42aeda --- /dev/null +++ b/spec/fixtures/payment_cards/payment_cards.json @@ -0,0 +1,33 @@ +{ + "user_id": 20181, + "payment_cards": [ + { + "card_id": 1774, + "last4": "0358", + "brand": "Visa", + "created_at": "2019-03-19 17:49:07 (Etc/UTC)", + "created_at_timestamp": 1553017747 + }, + { + "card_id": 2185, + "last4": "8148", + "brand": "MasterCard", + "created_at": "2019-06-19 15:51:54 (Etc/UTC)", + "created_at_timestamp": 1560959514 + }, + { + "card_id": 3574, + "last4": "0868", + "brand": "visa", + "created_at": "2020-07-21 14:02:11 (Etc/UTC)", + "created_at_timestamp": 1595340131 + }, + { + "card_id": 3579, + "last4": "5471", + "brand": "Visa", + "created_at": "2020-07-23 11:31:16 (Etc/UTC)", + "created_at_timestamp": 1595503876 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/payment_cards_page2.json b/spec/fixtures/payment_cards/payment_cards_page2.json new file mode 100644 index 0000000..191f434 --- /dev/null +++ b/spec/fixtures/payment_cards/payment_cards_page2.json @@ -0,0 +1,12 @@ +{ + "user_id": 20181, + "payment_cards": [ + { + "card_id": 2185, + "last4": "8148", + "brand": "MasterCard", + "created_at": "2019-06-19 15:51:54 (Etc/UTC)", + "created_at_timestamp": 1560959514 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/payment_cards/payment_cards_page3.json b/spec/fixtures/payment_cards/payment_cards_page3.json new file mode 100644 index 0000000..7924433 --- /dev/null +++ b/spec/fixtures/payment_cards/payment_cards_page3.json @@ -0,0 +1,12 @@ +{ + "user_id": 20181, + "payment_cards": [ + { + "card_id": 3574, + "last4": "0868", + "brand": "visa", + "created_at": "2020-07-21 14:02:11 (Etc/UTC)", + "created_at_timestamp": 1595340131 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/processes/process.json b/spec/fixtures/processes/process.json new file mode 100644 index 0000000..b66eac3 --- /dev/null +++ b/spec/fixtures/processes/process.json @@ -0,0 +1,29 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "process": { + "process_id": "73ad976cedf00cd8a1b1b978ae3ffaade1323505", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-12 10:59:43 (Etc/UTC)", + "created_at_timestamp": 1683889183, + "details": { + "files": [ + { + "status": "finished", + "message": "", + "name_original": "pasted.json", + "name_custom": null, + "word_count_total": 2, + "key_count_total": 1, + "key_count_inserted": 1, + "key_count_updated": 0, + "key_count_skipped": 0 + } + ] + } + } +} \ No newline at end of file diff --git a/spec/fixtures/processes/processes.json b/spec/fixtures/processes/processes.json new file mode 100644 index 0000000..fff3174 --- /dev/null +++ b/spec/fixtures/processes/processes.json @@ -0,0 +1,26 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "processes": [ + { + "process_id": "73ad976cedf00cd8a1b1b978ae3ffaade1323505", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-12 10:59:43 (Etc/UTC)", + "created_at_timestamp": 1683889183 + }, + { + "process_id": "f19017b95489e39026efeca40894c29da9684128", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-12 10:59:58 (Etc/UTC)", + "created_at_timestamp": 1683889198 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/processes/processes_page1.json b/spec/fixtures/processes/processes_page1.json new file mode 100644 index 0000000..d213e54 --- /dev/null +++ b/spec/fixtures/processes/processes_page1.json @@ -0,0 +1,16 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "processes": [ + { + "process_id": "73ad976cedf00cd8a1b1b978ae3ffaade1323505", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-12 10:59:43 (Etc/UTC)", + "created_at_timestamp": 1683889183 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/processes/processes_page2.json b/spec/fixtures/processes/processes_page2.json new file mode 100644 index 0000000..99ce705 --- /dev/null +++ b/spec/fixtures/processes/processes_page2.json @@ -0,0 +1,16 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "processes": [ + { + "process_id": "f19017b95489e39026efeca40894c29da9684128", + "type": "file-import", + "status": "finished", + "message": "", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-12 10:59:58 (Etc/UTC)", + "created_at_timestamp": 1683889198 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/projects/create_project.json b/spec/fixtures/projects/create_project.json new file mode 100644 index 0000000..9c15fef --- /dev/null +++ b/spec/fixtures/projects/create_project.json @@ -0,0 +1,58 @@ +{ + "project_id": "526928826442cf2f60f643.34369791", + "project_type": "localization_files", + "name": "RubyNew", + "description": "", + "created_at": "2023-04-21 18:00:15 (Etc/UTC)", + "created_at_timestamp": 1682100015, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 0, + "keys_total": 0, + "team": 2, + "base_words": 0, + "qa_issues_total": 0, + "qa_issues": { + "not_reviewed": 0, + "unverified": 0, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 0, + "words_to_do": 0 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/projects/destroy_project.json b/spec/fixtures/projects/destroy_project.json new file mode 100644 index 0000000..4189b40 --- /dev/null +++ b/spec/fixtures/projects/destroy_project.json @@ -0,0 +1,4 @@ +{ + "project_id": "526928826442cf2f60f643.34369791", + "project_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/projects/empty_project.json b/spec/fixtures/projects/empty_project.json new file mode 100644 index 0000000..fe2a5e7 --- /dev/null +++ b/spec/fixtures/projects/empty_project.json @@ -0,0 +1,4 @@ +{ + "project_id": "7078965360db431d026791.96621226", + "keys_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/projects/empty_project2.json b/spec/fixtures/projects/empty_project2.json new file mode 100644 index 0000000..dc542a4 --- /dev/null +++ b/spec/fixtures/projects/empty_project2.json @@ -0,0 +1,4 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "keys_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/projects/project.json b/spec/fixtures/projects/project.json new file mode 100644 index 0000000..9a2602d --- /dev/null +++ b/spec/fixtures/projects/project.json @@ -0,0 +1,76 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "project_type": "localization_files", + "name": "OnBoarding-2023", + "description": "", + "created_at": "2023-03-26 16:34:06 (Etc/UTC)", + "created_at_timestamp": 1679848446, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 50, + "keys_total": 2, + "team": 2, + "base_words": 6, + "qa_issues_total": 14, + "qa_issues": { + "not_reviewed": 8, + "unverified": 4, + "spelling_grammar": 2, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 10001, + "language_iso": "custom_1", + "progress": 0, + "words_to_do": 6 + }, + { + "language_id": 640, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 0, + "words_to_do": 6 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/projects/projects.json b/spec/fixtures/projects/projects.json new file mode 100644 index 0000000..d4ba8e4 --- /dev/null +++ b/spec/fixtures/projects/projects.json @@ -0,0 +1,162 @@ +{ + "projects": [ + { + "project_id": "44749534644685cf3410d0.03071739", + "project_type": "localization_files", + "name": "Android i18n", + "description": "", + "created_at": "2023-04-24 13:36:15 (Etc/UTC)", + "created_at_timestamp": 1682343375, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 100, + "keys_total": 3, + "team": 2, + "base_words": 9, + "qa_issues_total": 7, + "qa_issues": { + "not_reviewed": 6, + "unverified": 1, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 100, + "words_to_do": 0 + } + ] + } + }, + { + "project_id": "2273827860c1e2473eb195.11207948", + "project_type": "localization_files", + "name": "Angular", + "description": "", + "created_at": "2021-06-10 09:58:31 (Etc/UTC)", + "created_at_timestamp": 1623319111, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 1055, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": true, + "key_editing": true, + "inline_machine_translations": true, + "branching": true, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 20, + "keys_total": 18, + "team": 8, + "base_words": 45, + "qa_issues_total": 201, + "qa_issues": { + "not_reviewed": 101, + "unverified": 97, + "spelling_grammar": 3, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 894, + "language_iso": "ab", + "progress": 4, + "words_to_do": 43 + }, + { + "language_id": 1055, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 11, + "words_to_do": 40 + }, + { + "language_id": 734, + "language_iso": "it", + "progress": 8, + "words_to_do": 41 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 11, + "words_to_do": 40 + }, + { + "language_id": 748, + "language_iso": "pl", + "progress": 4, + "words_to_do": 43 + }, + { + "language_id": 597, + "language_iso": "ru", + "progress": 4, + "words_to_do": 43 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/projects/projects_next_page.json b/spec/fixtures/projects/projects_next_page.json new file mode 100644 index 0000000..f6b99a2 --- /dev/null +++ b/spec/fixtures/projects/projects_next_page.json @@ -0,0 +1,138 @@ +{ + "projects": [ + { + "project_id": "9726626863a09a96c057e6.98983279", + "project_type": "localization_files", + "name": "API", + "description": "", + "created_at": "2022-12-19 17:08:38 (Etc/UTC)", + "created_at_timestamp": 1671469718, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 16, + "keys_total": 3, + "team": 2, + "base_words": 1, + "qa_issues_total": 4, + "qa_issues": { + "not_reviewed": 3, + "unverified": 1, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 33, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 0, + "words_to_do": 1 + } + ] + } + }, + { + "project_id": "1948732260e2ed89f095e1.10167001", + "project_type": "localization_files", + "name": "App development", + "description": "", + "created_at": "2021-07-05 11:31:22 (Etc/UTC)", + "created_at_timestamp": 1625484682, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": true, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 66, + "keys_total": 6, + "team": 5, + "base_words": 19, + "qa_issues_total": 24, + "qa_issues": { + "not_reviewed": 18, + "unverified": 6, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 1056, + "language_iso": "es", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 0, + "words_to_do": 19 + } + ] + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/projects/update_project.json b/spec/fixtures/projects/update_project.json new file mode 100644 index 0000000..b41f65c --- /dev/null +++ b/spec/fixtures/projects/update_project.json @@ -0,0 +1,76 @@ +{ + "project_id": "20603843642073fe124fb8.14291681", + "project_type": "localization_files", + "name": "OnBoarding-2023", + "description": "Updated description", + "created_at": "2023-03-26 16:34:06 (Etc/UTC)", + "created_at_timestamp": 1679848446, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 50, + "keys_total": 2, + "team": 2, + "base_words": 6, + "qa_issues_total": 14, + "qa_issues": { + "not_reviewed": 8, + "unverified": 4, + "spelling_grammar": 2, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 10001, + "language_iso": "custom_1", + "progress": 0, + "words_to_do": 6 + }, + { + "language_id": 640, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 0, + "words_to_do": 6 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/projects/update_project2.json b/spec/fixtures/projects/update_project2.json new file mode 100644 index 0000000..d891b42 --- /dev/null +++ b/spec/fixtures/projects/update_project2.json @@ -0,0 +1,64 @@ +{ + "project_id": "44749534644685cf3410d0.03071739", + "project_type": "localization_files", + "name": "Android i18n", + "description": "chain updated", + "created_at": "2023-04-24 13:36:15 (Etc/UTC)", + "created_at_timestamp": 1682343375, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": false, + "segmentation": false, + "custom_translation_statuses": false, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 100, + "keys_total": 3, + "team": 2, + "base_words": 9, + "qa_issues_total": 7, + "qa_issues": { + "not_reviewed": 6, + "unverified": 1, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 100, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 100, + "words_to_do": 0 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/create_screenshots.json b/spec/fixtures/screenshots/create_screenshots.json new file mode 100644 index 0000000..917689e --- /dev/null +++ b/spec/fixtures/screenshots/create_screenshots.json @@ -0,0 +1,20 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshots": [ + { + "screenshot_id": 3195031, + "title": "Ruby", + "description": "SDK", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/d754896f27d9253f4c243d3084071b3d5a2dd77d.jpg", + "key_ids": [], + "keys": [], + "width": 125, + "height": 32, + "created_at": "2023-07-11 12:08:35 (Etc/UTC)", + "created_at_timestamp": 1689077315 + } + ], + "errors": [] +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/destroy_screenshot.json b/spec/fixtures/screenshots/destroy_screenshot.json new file mode 100644 index 0000000..1dd3110 --- /dev/null +++ b/spec/fixtures/screenshots/destroy_screenshot.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshot_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/screenshot.json b/spec/fixtures/screenshots/screenshot.json new file mode 100644 index 0000000..2371824 --- /dev/null +++ b/spec/fixtures/screenshots/screenshot.json @@ -0,0 +1,59 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshot": { + "screenshot_id": 2858588, + "title": "Registration", + "description": "", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/b4c04943f7f02a72e791cebdaa85428a71f5408c.jpg", + "key_ids": [ + 319782369, + 319840770, + 319840773, + 319840775 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840770, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840773, + "coordinates": { + "left": 57, + "top": 203, + "width": 126, + "height": 19 + } + }, + { + "key_id": 319840775, + "coordinates": { + "left": 179, + "top": 321, + "width": 180, + "height": 15 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-04-18 16:52:10 (Etc/UTC)", + "created_at_timestamp": 1681836730 + } +} \ No newline at end of file diff --git a/spec/fixtures/screenshot_base64.txt b/spec/fixtures/screenshots/screenshot_base64.txt similarity index 100% rename from spec/fixtures/screenshot_base64.txt rename to spec/fixtures/screenshots/screenshot_base64.txt diff --git a/spec/fixtures/screenshots/screenshots.json b/spec/fixtures/screenshots/screenshots.json new file mode 100644 index 0000000..bcbbd14 --- /dev/null +++ b/spec/fixtures/screenshots/screenshots.json @@ -0,0 +1,141 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshots": [ + { + "screenshot_id": 2858588, + "title": "Registration", + "description": "", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/b4c04943f7f02a72e791cebdaa85428a71f5408c.jpg", + "key_ids": [ + 319782369, + 319840770, + 319840773, + 319840775 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840770, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840773, + "coordinates": { + "left": 57, + "top": 203, + "width": 126, + "height": 19 + } + }, + { + "key_id": 319840775, + "coordinates": { + "left": 179, + "top": 321, + "width": 180, + "height": 15 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-04-18 16:52:10 (Etc/UTC)", + "created_at_timestamp": 1681836730 + }, + { + "screenshot_id": 2858589, + "title": "2023-04-18 19_50_26-RecordingRegionIndicator", + "description": "", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/a4d4447f797ce2878d442c6232b81839afd3e805.jpg", + "key_ids": [ + 319782372, + 319840776, + 319840778 + ], + "keys": [ + { + "key_id": 319782372, + "coordinates": { + "left": 14, + "top": 120, + "width": 145, + "height": 78 + } + }, + { + "key_id": 319840776, + "coordinates": { + "left": 14, + "top": 120, + "width": 145, + "height": 78 + } + }, + { + "key_id": 319840778, + "coordinates": { + "left": 193, + "top": 112, + "width": 168, + "height": 86 + } + } + ], + "width": 628, + "height": 212, + "created_at": "2023-04-18 16:53:48 (Etc/UTC)", + "created_at_timestamp": 1681836828 + }, + { + "screenshot_id": 2896573, + "title": "Registration", + "description": "2:19", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/5db3d0b5cbaf8d7de752fe1af872eaf3162c2ce2.jpg", + "key_ids": [ + 319782369, + 324729217 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 31, + "top": 21, + "width": 510, + "height": 55 + } + }, + { + "key_id": 324729217, + "coordinates": { + "left": 56, + "top": 201, + "width": 129, + "height": 26 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-05-19 15:51:24 (Etc/UTC)", + "created_at_timestamp": 1684511484 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/screenshots_page1.json b/spec/fixtures/screenshots/screenshots_page1.json new file mode 100644 index 0000000..23c7635 --- /dev/null +++ b/spec/fixtures/screenshots/screenshots_page1.json @@ -0,0 +1,106 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshots": [ + { + "screenshot_id": 2858588, + "title": "Registration", + "description": "", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/b4c04943f7f02a72e791cebdaa85428a71f5408c.jpg", + "key_ids": [ + 319782369, + 319840770, + 319840773, + 319840775 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840770, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840773, + "coordinates": { + "left": 57, + "top": 203, + "width": 126, + "height": 19 + } + }, + { + "key_id": 319840775, + "coordinates": { + "left": 179, + "top": 321, + "width": 180, + "height": 15 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-04-18 16:52:10 (Etc/UTC)", + "created_at_timestamp": 1681836730 + }, + { + "screenshot_id": 2858589, + "title": "2023-04-18 19_50_26-RecordingRegionIndicator", + "description": "", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/a4d4447f797ce2878d442c6232b81839afd3e805.jpg", + "key_ids": [ + 319782372, + 319840776, + 319840778 + ], + "keys": [ + { + "key_id": 319782372, + "coordinates": { + "left": 14, + "top": 120, + "width": 145, + "height": 78 + } + }, + { + "key_id": 319840776, + "coordinates": { + "left": 14, + "top": 120, + "width": 145, + "height": 78 + } + }, + { + "key_id": 319840778, + "coordinates": { + "left": 193, + "top": 112, + "width": 168, + "height": 86 + } + } + ], + "width": 628, + "height": 212, + "created_at": "2023-04-18 16:53:48 (Etc/UTC)", + "created_at_timestamp": 1681836828 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/screenshots_page2.json b/spec/fixtures/screenshots/screenshots_page2.json new file mode 100644 index 0000000..68aeed4 --- /dev/null +++ b/spec/fixtures/screenshots/screenshots_page2.json @@ -0,0 +1,41 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshots": [ + { + "screenshot_id": 2896573, + "title": "Registration", + "description": "2:19", + "screenshot_tags": [], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/5db3d0b5cbaf8d7de752fe1af872eaf3162c2ce2.jpg", + "key_ids": [ + 319782369, + 324729217 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 31, + "top": 21, + "width": 510, + "height": 55 + } + }, + { + "key_id": 324729217, + "coordinates": { + "left": 56, + "top": 201, + "width": 129, + "height": 26 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-05-19 15:51:24 (Etc/UTC)", + "created_at_timestamp": 1684511484 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/screenshots/update_screenshot.json b/spec/fixtures/screenshots/update_screenshot.json new file mode 100644 index 0000000..d809719 --- /dev/null +++ b/spec/fixtures/screenshots/update_screenshot.json @@ -0,0 +1,62 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "screenshot": { + "screenshot_id": 2858588, + "title": "Ruby updated", + "description": "", + "screenshot_tags": [ + "one", + "two" + ], + "url": "https://s3.eu-central-1.amazonaws.com/lokalise-live-lok-app-main-assets/files/screenshots/88628569645b945648b474.25982965/b4c04943f7f02a72e791cebdaa85428a71f5408c.jpg", + "key_ids": [ + 319782369, + 319840770, + 319840773, + 319840775 + ], + "keys": [ + { + "key_id": 319782369, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840770, + "coordinates": { + "left": 34, + "top": 13, + "width": 502, + "height": 75 + } + }, + { + "key_id": 319840773, + "coordinates": { + "left": 57, + "top": 203, + "width": 126, + "height": 19 + } + }, + { + "key_id": 319840775, + "coordinates": { + "left": 179, + "top": 321, + "width": 180, + "height": 15 + } + } + ], + "width": 572, + "height": 438, + "created_at": "2023-04-18 16:52:10 (Etc/UTC)", + "created_at_timestamp": 1681836730 + } +} \ No newline at end of file diff --git a/spec/fixtures/segments/segment.json b/spec/fixtures/segments/segment.json new file mode 100644 index 0000000..65ce5cb --- /dev/null +++ b/spec/fixtures/segments/segment.json @@ -0,0 +1,19 @@ +{ + "project_id": "7451498664b95d6111c812.34468173", + "key_id": 353507573, + "language_iso": "en", + "segment": { + "segment_number": 1, + "language_iso": "en", + "value": "This is a text.", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 4, + "custom_translation_statuses": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/segments/segments.json b/spec/fixtures/segments/segments.json new file mode 100644 index 0000000..374e0e9 --- /dev/null +++ b/spec/fixtures/segments/segments.json @@ -0,0 +1,77 @@ +{ + "project_id": "7451498664b95d6111c812.34468173", + "key_id": 353507573, + "language_iso": "en", + "segments": [ + { + "segment_number": 1, + "language_iso": "en", + "value": "This is a text.", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 4, + "custom_translation_statuses": [] + }, + { + "segment_number": 2, + "language_iso": "en", + "value": "It goes on here.", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 4, + "custom_translation_statuses": [] + }, + { + "segment_number": 3, + "language_iso": "en", + "value": "And even more text here.", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 5, + "custom_translation_statuses": [] + }, + { + "segment_number": 4, + "language_iso": "en", + "value": "Great!", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [] + }, + { + "segment_number": 5, + "language_iso": "en", + "value": "Yeah?", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:14:48 (Etc/UTC)", + "modified_at_timestamp": 1689869688, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/segments/update_segment.json b/spec/fixtures/segments/update_segment.json new file mode 100644 index 0000000..fdf5f71 --- /dev/null +++ b/spec/fixtures/segments/update_segment.json @@ -0,0 +1,19 @@ +{ + "project_id": "7451498664b95d6111c812.34468173", + "key_id": 353507573, + "language_iso": "en", + "segment": { + "segment_number": 1, + "language_iso": "en", + "value": "Updated.", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-20 16:34:44 (Etc/UTC)", + "modified_at_timestamp": 1689870884, + "is_reviewed": false, + "reviewed_by": 0, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/create_snapshot.json b/spec/fixtures/snapshots/create_snapshot.json new file mode 100644 index 0000000..7b28a6b --- /dev/null +++ b/spec/fixtures/snapshots/create_snapshot.json @@ -0,0 +1,12 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "snapshot": { + "snapshot_id": 2296294, + "title": "Ruby SDK", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-07-11 15:59:06 (Etc/UTC)", + "created_at_timestamp": 1689091146 + } +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/destroy_snapshot.json b/spec/fixtures/snapshots/destroy_snapshot.json new file mode 100644 index 0000000..a7ad226 --- /dev/null +++ b/spec/fixtures/snapshots/destroy_snapshot.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "snapshot_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/restore_snapshot.json b/spec/fixtures/snapshots/restore_snapshot.json new file mode 100644 index 0000000..6735b82 --- /dev/null +++ b/spec/fixtures/snapshots/restore_snapshot.json @@ -0,0 +1,83 @@ +{ + "project_id": "9676705264ad7d51c79ca5.99757524", + "project_type": "localization_files", + "name": "OnBoarding-2023 copy", + "description": "Updated description", + "created_at": "2023-07-11 16:03:29 (Etc/UTC)", + "created_at_timestamp": 1689091409, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": true, + "segmentation": false, + "contributor_preview_download_enabled": false, + "custom_translation_statuses": true, + "custom_translation_statuses_allow_multiple": true + }, + "statistics": { + "progress_total": 0, + "keys_total": 0, + "team": 6, + "base_words": 0, + "qa_issues_total": 0, + "qa_issues": { + "not_reviewed": 0, + "unverified": 0, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 666, + "language_iso": "de", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 640, + "language_iso": "en", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 737, + "language_iso": "nl", + "progress": 0, + "words_to_do": 0 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/restore_snapshot2.json b/spec/fixtures/snapshots/restore_snapshot2.json new file mode 100644 index 0000000..5ee88e8 --- /dev/null +++ b/spec/fixtures/snapshots/restore_snapshot2.json @@ -0,0 +1,77 @@ +{ + "project_id": "7039859664ad7f75b62243.69305993", + "project_type": "localization_files", + "name": "OnBoarding-2023 copy", + "description": "Updated description", + "created_at": "2023-07-11 16:12:37 (Etc/UTC)", + "created_at_timestamp": 1689091957, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "team_id": 176692, + "base_language_id": 640, + "base_language_iso": "en", + "settings": { + "per_platform_key_names": false, + "reviewing": true, + "auto_toggle_unverified": true, + "offline_translation": false, + "key_editing": true, + "inline_machine_translations": true, + "branching": true, + "segmentation": false, + "contributor_preview_download_enabled": false, + "custom_translation_statuses": true, + "custom_translation_statuses_allow_multiple": false + }, + "statistics": { + "progress_total": 0, + "keys_total": 0, + "team": 7, + "base_words": 0, + "qa_issues_total": 0, + "qa_issues": { + "not_reviewed": 0, + "unverified": 0, + "spelling_grammar": 0, + "inconsistent_placeholders": 0, + "inconsistent_html": 0, + "different_number_of_urls": 0, + "different_urls": 0, + "leading_whitespace": 0, + "trailing_whitespace": 0, + "different_number_of_email_address": 0, + "different_email_address": 0, + "different_brackets": 0, + "different_numbers": 0, + "double_space": 0, + "special_placeholder": 0, + "unbalanced_brackets": 0 + }, + "languages": [ + { + "language_id": 640, + "language_iso": "en", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 673, + "language_iso": "fr", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 10153, + "language_iso": "lv", + "progress": 0, + "words_to_do": 0 + }, + { + "language_id": 10001, + "language_iso": "sind", + "progress": 0, + "words_to_do": 0 + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/snapshots.json b/spec/fixtures/snapshots/snapshots.json new file mode 100644 index 0000000..98fb5f4 --- /dev/null +++ b/spec/fixtures/snapshots/snapshots.json @@ -0,0 +1,30 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "snapshots": [ + { + "snapshot_id": 2130183, + "title": "Pseudolocalization snapshot", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-18 11:27:28 (Etc/UTC)", + "created_at_timestamp": 1684409248 + }, + { + "snapshot_id": 2296220, + "title": "Manual snapshot", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-07-11 12:35:43 (Etc/UTC)", + "created_at_timestamp": 1689078943 + }, + { + "snapshot_id": 2296221, + "title": "Manual snapshot 2", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-07-11 12:35:46 (Etc/UTC)", + "created_at_timestamp": 1689078946 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/snapshots_page1.json b/spec/fixtures/snapshots/snapshots_page1.json new file mode 100644 index 0000000..d3670ef --- /dev/null +++ b/spec/fixtures/snapshots/snapshots_page1.json @@ -0,0 +1,22 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "snapshots": [ + { + "snapshot_id": 2130183, + "title": "Pseudolocalization snapshot", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-05-18 11:27:28 (Etc/UTC)", + "created_at_timestamp": 1684409248 + }, + { + "snapshot_id": 2296220, + "title": "Manual snapshot", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-07-11 12:35:43 (Etc/UTC)", + "created_at_timestamp": 1689078943 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/snapshots/snapshots_page2.json b/spec/fixtures/snapshots/snapshots_page2.json new file mode 100644 index 0000000..c650c83 --- /dev/null +++ b/spec/fixtures/snapshots/snapshots_page2.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "snapshots": [ + { + "snapshot_id": 2296221, + "title": "Manual snapshot 2", + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "created_at": "2023-07-11 12:35:46 (Etc/UTC)", + "created_at_timestamp": 1689078946 + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/tasks/create_task.json b/spec/fixtures/tasks/create_task.json new file mode 100644 index 0000000..f5f4a31 --- /dev/null +++ b/spec/fixtures/tasks/create_task.json @@ -0,0 +1,65 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "task": { + "task_id": 1721633, + "title": "Ruby SDK", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 2, + "words_count": 4, + "created_at": "2023-07-14 12:22:18 (Etc/UTC)", + "created_at_timestamp": 1689337338, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 0, + "60%+": 0, + "75%+": 0, + "95%+": 0, + "100%": 0 + }, + "keys_count": 2, + "words_count": 4, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": false, + "custom_translation_status_ids": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/tasks/destroy_task.json b/spec/fixtures/tasks/destroy_task.json new file mode 100644 index 0000000..9860e96 --- /dev/null +++ b/spec/fixtures/tasks/destroy_task.json @@ -0,0 +1,5 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "task_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/tasks/task.json b/spec/fixtures/tasks/task.json new file mode 100644 index 0000000..ea2be9c --- /dev/null +++ b/spec/fixtures/tasks/task.json @@ -0,0 +1,70 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "task": { + "task_id": 1721560, + "title": "Demo2", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:59:04 (Etc/UTC)", + "created_at_timestamp": 1689335944, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, + 319782372, + 319782374, + 319782375, + 319782376, + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 14, + "60%+": 2, + "75%+": 0, + "95%+": 3, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/tasks/tasks.json b/spec/fixtures/tasks/tasks.json new file mode 100644 index 0000000..2422f86 --- /dev/null +++ b/spec/fixtures/tasks/tasks.json @@ -0,0 +1,186 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "tasks": [ + { + "task_id": 1721560, + "title": "Demo2", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:59:04 (Etc/UTC)", + "created_at_timestamp": 1689335944, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, 319782372, 319782374, 319782375, 319782376, 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 14, + "60%+": 2, + "75%+": 0, + "95%+": 3, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + }, + { + "task_id": 1721559, + "title": "Demo1", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:58:49 (Etc/UTC)", + "created_at_timestamp": 1689335929, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "en", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, 319782372, 319782374, 319782375, 319782376, 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 19, + "60%+": 0, + "75%+": 0, + "95%+": 0, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + }, + { + "task_id": 1493597, + "title": "Translate Latvian", + "can_be_parent": false, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "completed", + "progress": 100, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 10, + "words_count": 27, + "created_at": "2023-05-18 12:54:35 (Etc/UTC)", + "created_at_timestamp": 1684414475, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "lv", + "users": [ + { + "user_id": 49436, + "email": "ilya@lokalise.com", + "fullname": "Ilya" + } + ], + "groups": [], + "keys": [319782369, 319782372, 319782374, 319782375, 319782376], + "status": "completed", + "progress": 100, + "initial_tm_leverage": { + "0%+": 2, + "60%+": 0, + "75%+": 0, + "95%+": 3, + "100%": 10 + }, + "keys_count": 10, + "words_count": 27, + "completed_at": "2023-05-18 12:55:25 (Etc/UTC)", + "completed_at_timestamp": 1684414525, + "completed_by": 1, + "completed_by_email": "support@lokalise.co" + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": "2023-05-18 12:55:26 (Etc/UTC)", + "completed_at_timestamp": 1684414526, + "completed_by": 1, + "completed_by_email": "support@lokalise.co", + "do_lock_translations": true, + "custom_translation_status_ids": [] + } + ] +} diff --git a/spec/fixtures/tasks/tasks_page1.json b/spec/fixtures/tasks/tasks_page1.json new file mode 100644 index 0000000..92bf7d7 --- /dev/null +++ b/spec/fixtures/tasks/tasks_page1.json @@ -0,0 +1,138 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "tasks": [ + { + "task_id": 1721560, + "title": "Demo2", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:59:04 (Etc/UTC)", + "created_at_timestamp": 1689335944, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, + 319782372, + 319782374, + 319782375, + 319782376, + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 14, + "60%+": 2, + "75%+": 0, + "95%+": 3, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + }, + { + "task_id": 1721559, + "title": "Demo1", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:58:49 (Etc/UTC)", + "created_at_timestamp": 1689335929, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "en", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, + 319782372, + 319782374, + 319782375, + 319782376, + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 19, + "60%+": 0, + "75%+": 0, + "95%+": 0, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/tasks/tasks_page2.json b/spec/fixtures/tasks/tasks_page2.json new file mode 100644 index 0000000..d588774 --- /dev/null +++ b/spec/fixtures/tasks/tasks_page2.json @@ -0,0 +1,70 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "tasks": [ + { + "task_id": 1493597, + "title": "Translate Latvian", + "can_be_parent": false, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "", + "status": "completed", + "progress": 100, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 10, + "words_count": 27, + "created_at": "2023-05-18 12:54:35 (Etc/UTC)", + "created_at_timestamp": 1684414475, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "lv", + "users": [ + { + "user_id": 49436, + "email": "ilya@lokalise.com", + "fullname": "Ilya" + } + ], + "groups": [], + "keys": [ + 319782369, + 319782372, + 319782374, + 319782375, + 319782376 + ], + "status": "completed", + "progress": 100, + "initial_tm_leverage": { + "0%+": 2, + "60%+": 0, + "75%+": 0, + "95%+": 3, + "100%": 10 + }, + "keys_count": 10, + "words_count": 27, + "completed_at": "2023-05-18 12:55:25 (Etc/UTC)", + "completed_at_timestamp": 1684414525, + "completed_by": 1, + "completed_by_email": "support@lokalise.co" + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": "2023-05-18 12:55:26 (Etc/UTC)", + "completed_at_timestamp": 1684414526, + "completed_by": 1, + "completed_by_email": "support@lokalise.co", + "do_lock_translations": true, + "custom_translation_status_ids": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/tasks/update_task.json b/spec/fixtures/tasks/update_task.json new file mode 100644 index 0000000..4f97191 --- /dev/null +++ b/spec/fixtures/tasks/update_task.json @@ -0,0 +1,65 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "task": { + "task_id": 1721633, + "title": "Ruby updated", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "updated via sdk", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 2, + "words_count": 4, + "created_at": "2023-07-14 12:22:18 (Etc/UTC)", + "created_at_timestamp": 1689337338, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 4, + "60%+": 0, + "75%+": 0, + "95%+": 0, + "100%": 0 + }, + "keys_count": 2, + "words_count": 4, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": false, + "custom_translation_status_ids": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/tasks/update_task2.json b/spec/fixtures/tasks/update_task2.json new file mode 100644 index 0000000..72d86fe --- /dev/null +++ b/spec/fixtures/tasks/update_task2.json @@ -0,0 +1,70 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "task": { + "task_id": 1721560, + "title": "Ruby updated", + "can_be_parent": true, + "task_type": "translation", + "parent_task_id": null, + "closing_tags": [], + "description": "updated via sdk", + "status": "created", + "progress": 0, + "due_date": null, + "due_date_timestamp": null, + "keys_count": 7, + "words_count": 19, + "created_at": "2023-07-14 11:59:04 (Etc/UTC)", + "created_at_timestamp": 1689335944, + "created_by": 20181, + "created_by_email": "bodrovis@protonmail.com", + "source_language_iso": "en", + "languages": [ + { + "language_iso": "de", + "users": [ + { + "user_id": 20181, + "email": "bodrovis@protonmail.com", + "fullname": "Ilya B" + } + ], + "groups": [], + "keys": [ + 319782369, + 319782372, + 319782374, + 319782375, + 319782376, + 324729217, + 331018374 + ], + "status": "created", + "progress": 0, + "initial_tm_leverage": { + "0%+": 14, + "60%+": 2, + "75%+": 0, + "95%+": 3, + "100%": 0 + }, + "keys_count": 7, + "words_count": 19, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null + } + ], + "auto_close_items": true, + "auto_close_languages": true, + "auto_close_task": true, + "completed_at": null, + "completed_at_timestamp": null, + "completed_by": null, + "completed_by_email": null, + "do_lock_translations": true, + "custom_translation_status_ids": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_billing_details/create_billing_details.json b/spec/fixtures/team_user_billing_details/create_billing_details.json new file mode 100644 index 0000000..c36d487 --- /dev/null +++ b/spec/fixtures/team_user_billing_details/create_billing_details.json @@ -0,0 +1,13 @@ +{ + "company": "", + "address1": "", + "address2": "", + "city": "", + "zip": "LV-1234", + "phone": "", + "vatnumber": null, + "country_code": "LV", + "billing_email": "hello@lokalise.com", + "state_code": "", + "team_id": 387836 +} \ No newline at end of file diff --git a/spec/fixtures/team_user_billing_details/team_user_billing_details.json b/spec/fixtures/team_user_billing_details/team_user_billing_details.json new file mode 100644 index 0000000..125e3c6 --- /dev/null +++ b/spec/fixtures/team_user_billing_details/team_user_billing_details.json @@ -0,0 +1,12 @@ +{ + "company": "", + "address1": "Sample line 1", + "address2": "", + "city": "Riga", + "zip": "LV-6543", + "phone": "+371123456", + "vatnumber": "", + "country_code": "LV", + "billing_email": "hello@example.com", + "state_code": "" +} \ No newline at end of file diff --git a/spec/fixtures/team_user_billing_details/update_billing_details.json b/spec/fixtures/team_user_billing_details/update_billing_details.json new file mode 100644 index 0000000..37ccef4 --- /dev/null +++ b/spec/fixtures/team_user_billing_details/update_billing_details.json @@ -0,0 +1,12 @@ +{ + "company": "", + "address1": "", + "address2": "", + "city": "", + "zip": "LV-1234", + "phone": "", + "vatnumber": null, + "country_code": "LV", + "billing_email": "hi2@lokalise.com", + "state_code": "" +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/add_members_to_group.json b/spec/fixtures/team_user_groups/add_members_to_group.json new file mode 100644 index 0000000..ec8fe10 --- /dev/null +++ b/spec/fixtures/team_user_groups/add_members_to_group.json @@ -0,0 +1,32 @@ +{ + "team_id": 176692, + "group": { + "group_id": 2639, + "name": "Updated SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [ + "2273827860c1e2473eb195.11207948" + ], + "members": [ + 49436, + 72007, + 132650, + 140889 + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/add_projects_to_group.json b/spec/fixtures/team_user_groups/add_projects_to_group.json new file mode 100644 index 0000000..93f9254 --- /dev/null +++ b/spec/fixtures/team_user_groups/add_projects_to_group.json @@ -0,0 +1,31 @@ +{ + "team_id": 176692, + "group": { + "group_id": 2639, + "name": "Updated SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [ + "2273827860c1e2473eb195.11207948", + "963054665b7c313dd9b323.35886655" + ], + "members": [ + 49436, + 72007 + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/create_team_user_group.json b/spec/fixtures/team_user_groups/create_team_user_group.json new file mode 100644 index 0000000..97a90fa --- /dev/null +++ b/spec/fixtures/team_user_groups/create_team_user_group.json @@ -0,0 +1,25 @@ +{ + "team_id": 176692, + "group": { + "group_id": 9769, + "name": "SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2023-07-18 17:35:55 (Etc/UTC)", + "created_at_timestamp": 1689701755, + "team_id": 176692, + "projects": [], + "members": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/destroy_team_user_group.json b/spec/fixtures/team_user_groups/destroy_team_user_group.json new file mode 100644 index 0000000..5d86a18 --- /dev/null +++ b/spec/fixtures/team_user_groups/destroy_team_user_group.json @@ -0,0 +1,4 @@ +{ + "team_id": 176692, + "group_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/remove_members_from_group.json b/spec/fixtures/team_user_groups/remove_members_from_group.json new file mode 100644 index 0000000..91a8977 --- /dev/null +++ b/spec/fixtures/team_user_groups/remove_members_from_group.json @@ -0,0 +1,31 @@ +{ + "team_id": 176692, + "group": { + "group_id": 2639, + "name": "Updated SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [ + "2273827860c1e2473eb195.11207948" + ], + "members": [ + 49436, + 72007, + 132650 + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/remove_projects_from_group.json b/spec/fixtures/team_user_groups/remove_projects_from_group.json new file mode 100644 index 0000000..03c90ee --- /dev/null +++ b/spec/fixtures/team_user_groups/remove_projects_from_group.json @@ -0,0 +1,30 @@ +{ + "team_id": 176692, + "group": { + "group_id": 2639, + "name": "Updated SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [ + "2273827860c1e2473eb195.11207948" + ], + "members": [ + 49436, + 72007 + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/team_user_group.json b/spec/fixtures/team_user_groups/team_user_group.json new file mode 100644 index 0000000..c0ee3f0 --- /dev/null +++ b/spec/fixtures/team_user_groups/team_user_group.json @@ -0,0 +1,43 @@ +{ + "group_id": 2639, + "name": "Demo", + "permissions": { + "is_admin": false, + "is_reviewer": false, + "admin_rights": [], + "languages": [ + { + "lang_id": 602, + "lang_iso": "zh_CN", + "lang_name": "Chinese Simplified", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": false + }, + { + "lang_id": 748, + "lang_iso": "pl", + "lang_name": "Polish", + "is_writable": true + }, + { + "lang_id": 1055, + "lang_iso": "en_US", + "lang_name": "English (United States)", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [], + "members": [ + 49436, + 72007 + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/team_user_groups.json b/spec/fixtures/team_user_groups/team_user_groups.json new file mode 100644 index 0000000..b22562d --- /dev/null +++ b/spec/fixtures/team_user_groups/team_user_groups.json @@ -0,0 +1,125 @@ +{ + "team_id": 176692, + "user_groups": [ + { + "group_id": 2639, + "name": "Demo", + "permissions": { + "is_admin": false, + "is_reviewer": false, + "admin_rights": [], + "languages": [ + { + "lang_id": 602, + "lang_iso": "zh_CN", + "lang_name": "Chinese Simplified", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": false + }, + { + "lang_id": 748, + "lang_iso": "pl", + "lang_name": "Polish", + "is_writable": true + }, + { + "lang_id": 1055, + "lang_iso": "en_US", + "lang_name": "English (United States)", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [], + "members": [ + 49436, + 72007 + ] + }, + { + "group_id": 7561, + "name": "Restricted", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 891, + "lang_iso": "aa", + "lang_name": "Afar", + "is_writable": true + }, + { + "lang_id": 910, + "lang_iso": "ak", + "lang_name": "Akan", + "is_writable": true + } + ] + }, + "created_at": "2022-08-01 14:16:44 (Etc/UTC)", + "created_at_timestamp": 1659363404, + "team_id": 176692, + "projects": [], + "members": [ + 34051, + 71999 + ] + }, + { + "group_id": 2500, + "name": "RSpec group", + "permissions": { + "is_admin": false, + "is_reviewer": false, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-06-26 13:08:21 (Etc/UTC)", + "created_at_timestamp": 1593176901, + "team_id": 176692, + "projects": [], + "members": [] + }, + { + "group_id": 515, + "name": "Updated Python group", + "permissions": { + "is_admin": true, + "is_reviewer": false, + "admin_rights": [ + "upload", + "glossary", + "create_branches" + ], + "languages": [] + }, + "created_at": "2019-03-19 19:53:04 (Etc/UTC)", + "created_at_timestamp": 1553025184, + "team_id": 176692, + "projects": [ + "803826145ba90b42d5d860.46800099" + ], + "members": [ + 20181, + 25753 + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/team_user_groups_page1.json b/spec/fixtures/team_user_groups/team_user_groups_page1.json new file mode 100644 index 0000000..8054c68 --- /dev/null +++ b/spec/fixtures/team_user_groups/team_user_groups_page1.json @@ -0,0 +1,79 @@ +{ + "team_id": 176692, + "user_groups": [ + { + "group_id": 2639, + "name": "Demo", + "permissions": { + "is_admin": false, + "is_reviewer": false, + "admin_rights": [], + "languages": [ + { + "lang_id": 602, + "lang_iso": "zh_CN", + "lang_name": "Chinese Simplified", + "is_writable": true + }, + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": false + }, + { + "lang_id": 748, + "lang_iso": "pl", + "lang_name": "Polish", + "is_writable": true + }, + { + "lang_id": 1055, + "lang_iso": "en_US", + "lang_name": "English (United States)", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [], + "members": [ + 49436, + 72007 + ] + }, + { + "group_id": 7561, + "name": "Restricted", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 891, + "lang_iso": "aa", + "lang_name": "Afar", + "is_writable": true + }, + { + "lang_id": 910, + "lang_iso": "ak", + "lang_name": "Akan", + "is_writable": true + } + ] + }, + "created_at": "2022-08-01 14:16:44 (Etc/UTC)", + "created_at_timestamp": 1659363404, + "team_id": 176692, + "projects": [], + "members": [ + 34051, + 71999 + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/team_user_groups_page2.json b/spec/fixtures/team_user_groups/team_user_groups_page2.json new file mode 100644 index 0000000..f472ead --- /dev/null +++ b/spec/fixtures/team_user_groups/team_user_groups_page2.json @@ -0,0 +1,51 @@ +{ + "team_id": 176692, + "user_groups": [ + { + "group_id": 2500, + "name": "RSpec group", + "permissions": { + "is_admin": false, + "is_reviewer": false, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-06-26 13:08:21 (Etc/UTC)", + "created_at_timestamp": 1593176901, + "team_id": 176692, + "projects": [], + "members": [] + }, + { + "group_id": 515, + "name": "Updated Python group", + "permissions": { + "is_admin": true, + "is_reviewer": false, + "admin_rights": [ + "upload", + "glossary", + "create_branches" + ], + "languages": [] + }, + "created_at": "2019-03-19 19:53:04 (Etc/UTC)", + "created_at_timestamp": 1553025184, + "team_id": 176692, + "projects": [ + "803826145ba90b42d5d860.46800099" + ], + "members": [ + 20181, + 25753 + ] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_user_groups/update_team_user_group.json b/spec/fixtures/team_user_groups/update_team_user_group.json new file mode 100644 index 0000000..cbe863b --- /dev/null +++ b/spec/fixtures/team_user_groups/update_team_user_group.json @@ -0,0 +1,28 @@ +{ + "team_id": 176692, + "group": { + "group_id": 2639, + "name": "Updated SDK", + "permissions": { + "is_admin": false, + "is_reviewer": true, + "admin_rights": [], + "languages": [ + { + "lang_id": 640, + "lang_iso": "en", + "lang_name": "English", + "is_writable": true + } + ] + }, + "created_at": "2020-07-23 11:21:04 (Etc/UTC)", + "created_at_timestamp": 1595503264, + "team_id": 176692, + "projects": [], + "members": [ + 49436, + 72007 + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/team_users/destroy_team_user.json b/spec/fixtures/team_users/destroy_team_user.json new file mode 100644 index 0000000..aea2181 --- /dev/null +++ b/spec/fixtures/team_users/destroy_team_user.json @@ -0,0 +1,4 @@ +{ + "team_id": 176692, + "team_user_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/team_users/team_user.json b/spec/fixtures/team_users/team_user.json new file mode 100644 index 0000000..b065b78 --- /dev/null +++ b/spec/fixtures/team_users/team_user.json @@ -0,0 +1,11 @@ +{ + "team_id": 176692, + "team_user": { + "user_id": 147798, + "email": "ilya+demo2@lokalise.com", + "fullname": "Ilya Demo", + "created_at": "2022-01-19 16:16:03 (Etc/UTC)", + "created_at_timestamp": 1642608963, + "role": "member" + } +} \ No newline at end of file diff --git a/spec/fixtures/team_users/team_users.json b/spec/fixtures/team_users/team_users.json new file mode 100644 index 0000000..f633592 --- /dev/null +++ b/spec/fixtures/team_users/team_users.json @@ -0,0 +1,61 @@ +{ + "team_id": 176692, + "team_users": [ + { + "user_id": 147798, + "email": "ilya+demo2@lokalise.com", + "fullname": "Ilya Demo", + "created_at": "2022-01-19 16:16:03 (Etc/UTC)", + "created_at_timestamp": 1642608963, + "role": "member" + }, + { + "user_id": 141203, + "email": "ilya+demo@lokalise.com", + "fullname": "Ilya", + "created_at": "2021-12-10 18:32:12 (Etc/UTC)", + "created_at_timestamp": 1639161132, + "role": "member" + }, + { + "user_id": 140889, + "email": "jane@example.com", + "fullname": "Jane", + "created_at": "2021-12-09 17:51:15 (Etc/UTC)", + "created_at_timestamp": 1639072275, + "role": "member" + }, + { + "user_id": 132650, + "email": "sample_ms_translator@example.com", + "fullname": "Ms. Translator", + "created_at": "2021-10-26 13:23:46 (Etc/UTC)", + "created_at_timestamp": 1635254626, + "role": "member" + }, + { + "user_id": 100945, + "email": "ns@alms.app", + "fullname": "Nick Shchetko", + "created_at": "2021-04-02 08:40:00 (Etc/UTC)", + "created_at_timestamp": 1617352800, + "role": "member" + }, + { + "user_id": 97280, + "email": "elixir_test@example.com", + "fullname": "Elixir Rocks", + "created_at": "2021-03-08 18:06:59 (Etc/UTC)", + "created_at_timestamp": 1615226819, + "role": "member" + }, + { + "user_id": 97278, + "email": "elixir@example.com", + "fullname": "Unnamed", + "created_at": "2021-03-08 18:04:15 (Etc/UTC)", + "created_at_timestamp": 1615226655, + "role": "member" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_users/team_users_page1.json b/spec/fixtures/team_users/team_users_page1.json new file mode 100644 index 0000000..9c4e9a0 --- /dev/null +++ b/spec/fixtures/team_users/team_users_page1.json @@ -0,0 +1,29 @@ +{ + "team_id": 176692, + "team_users": [ + { + "user_id": 147798, + "email": "ilya+demo2@lokalise.com", + "fullname": "Ilya Demo", + "created_at": "2022-01-19 16:16:03 (Etc/UTC)", + "created_at_timestamp": 1642608963, + "role": "member" + }, + { + "user_id": 141203, + "email": "ilya+demo@lokalise.com", + "fullname": "Ilya", + "created_at": "2021-12-10 18:32:12 (Etc/UTC)", + "created_at_timestamp": 1639161132, + "role": "member" + }, + { + "user_id": 140889, + "email": "jane@example.com", + "fullname": "Jane", + "created_at": "2021-12-09 17:51:15 (Etc/UTC)", + "created_at_timestamp": 1639072275, + "role": "member" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_users/team_users_page2.json b/spec/fixtures/team_users/team_users_page2.json new file mode 100644 index 0000000..b8b9dea --- /dev/null +++ b/spec/fixtures/team_users/team_users_page2.json @@ -0,0 +1,29 @@ +{ + "team_id": 176692, + "team_users": [ + { + "user_id": 132650, + "email": "sample_ms_translator@example.com", + "fullname": "Ms. Translator", + "created_at": "2021-10-26 13:23:46 (Etc/UTC)", + "created_at_timestamp": 1635254626, + "role": "member" + }, + { + "user_id": 100945, + "email": "ns@alms.app", + "fullname": "Nick Shchetko", + "created_at": "2021-04-02 08:40:00 (Etc/UTC)", + "created_at_timestamp": 1617352800, + "role": "member" + }, + { + "user_id": 97280, + "email": "elixir_test@example.com", + "fullname": "Elixir Rocks", + "created_at": "2021-03-08 18:06:59 (Etc/UTC)", + "created_at_timestamp": 1615226819, + "role": "member" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/team_users/update_team_user.json b/spec/fixtures/team_users/update_team_user.json new file mode 100644 index 0000000..b3aef90 --- /dev/null +++ b/spec/fixtures/team_users/update_team_user.json @@ -0,0 +1,11 @@ +{ + "team_id": 176692, + "team_user": { + "user_id": 147798, + "email": "ilya+demo2@lokalise.com", + "fullname": "Ilya Demo", + "created_at": "2022-01-19 16:16:03 (Etc/UTC)", + "created_at_timestamp": 1642608963, + "role": "admin" + } +} \ No newline at end of file diff --git a/spec/fixtures/teams/teams.json b/spec/fixtures/teams/teams.json new file mode 100644 index 0000000..01b77e3 --- /dev/null +++ b/spec/fixtures/teams/teams.json @@ -0,0 +1,118 @@ +{ + "teams": [ + { + "team_id": 273879, + "name": "Ruby Team", + "plan": "Trial", + "created_at": "2021-12-15 17:37:23 (Etc/UTC)", + "created_at_timestamp": 1639589843, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 269556, + "name": "Fake team", + "plan": "Trial", + "created_at": "2021-11-23 17:02:19 (Etc/UTC)", + "created_at_timestamp": 1637686939, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 199048, + "name": "Sample", + "plan": "Trial", + "created_at": "2019-12-25 13:50:00 (Etc/UTC)", + "created_at_timestamp": 1577281800, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 186612, + "name": "NikaNika", + "plan": "Trial", + "created_at": "2019-04-11 11:12:49 (Etc/UTC)", + "created_at_timestamp": 1554981169, + "quota_usage": { + "users": 2, + "keys": 715, + "projects": 4, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 176692, + "name": "Ilya's Team", + "plan": "Trial", + "created_at": "2018-08-21 15:35:25 (Etc/UTC)", + "created_at_timestamp": 1534865725, + "quota_usage": { + "users": 24, + "keys": 184, + "projects": 12, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 170312, + "name": "Lokalise", + "plan": "Trial", + "created_at": "2017-10-17 09:10:00 (Etc/UTC)", + "created_at_timestamp": 1508231400, + "quota_usage": { + "users": 94, + "keys": 9136, + "projects": 33, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/teams/teams_page1.json b/spec/fixtures/teams/teams_page1.json new file mode 100644 index 0000000..1104dda --- /dev/null +++ b/spec/fixtures/teams/teams_page1.json @@ -0,0 +1,61 @@ +{ + "teams": [ + { + "team_id": 273879, + "name": "Ruby Team", + "plan": "Trial", + "created_at": "2021-12-15 17:37:23 (Etc/UTC)", + "created_at_timestamp": 1639589843, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 269556, + "name": "Fake team", + "plan": "Trial", + "created_at": "2021-11-23 17:02:19 (Etc/UTC)", + "created_at_timestamp": 1637686939, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 199048, + "name": "Sample", + "plan": "Trial", + "created_at": "2019-12-25 13:50:00 (Etc/UTC)", + "created_at_timestamp": 1577281800, + "quota_usage": { + "users": 1, + "keys": 0, + "projects": 0, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/teams/teams_page2.json b/spec/fixtures/teams/teams_page2.json new file mode 100644 index 0000000..70da627 --- /dev/null +++ b/spec/fixtures/teams/teams_page2.json @@ -0,0 +1,61 @@ +{ + "teams": [ + { + "team_id": 186612, + "name": "NikaNika", + "plan": "Trial", + "created_at": "2019-04-11 11:12:49 (Etc/UTC)", + "created_at_timestamp": 1554981169, + "quota_usage": { + "users": 2, + "keys": 715, + "projects": 4, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 176692, + "name": "Ilya's Team", + "plan": "Trial", + "created_at": "2018-08-21 15:35:25 (Etc/UTC)", + "created_at_timestamp": 1534865725, + "quota_usage": { + "users": 24, + "keys": 184, + "projects": 12, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + }, + { + "team_id": 170312, + "name": "Lokalise", + "plan": "Trial", + "created_at": "2017-10-17 09:10:00 (Etc/UTC)", + "created_at_timestamp": 1508231400, + "quota_usage": { + "users": 94, + "keys": 9136, + "projects": 33, + "mau": 0 + }, + "quota_allowed": { + "users": 999999999, + "keys": 999999999, + "projects": 999999999, + "mau": 0 + } + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translation_providers/translation_provider.json b/spec/fixtures/translation_providers/translation_provider.json new file mode 100644 index 0000000..80058fb --- /dev/null +++ b/spec/fixtures/translation_providers/translation_provider.json @@ -0,0 +1,36 @@ +{ + "provider_id": 1, + "name": "Gengo", + "slug": "gengo", + "price_pair_min": "0.00", + "website_url": "https://gengo.com", + "description": "At Gengo, our mission is to provide language services to everyone and connect a global community. Our network of over 18,000 translators are tested and qualified to meet stringent project standards. Translators are based around the world and in every timezone, which enables us to support over 35 languages and work towards the Gengo mission.", + "tiers": [ + { + "tier_id": 1, + "title": "Native speaker" + }, + { + "tier_id": 2, + "title": "Professional translator" + } + ], + "pairs": [ + { + "tier_id": 1, + "price_per_word": 0.069, + "from_lang_iso": "ru", + "from_lang_name": "Russian", + "to_lang_iso": "en", + "to_lang_name": "English" + }, + { + "tier_id": 1, + "price_per_word": 0.069, + "from_lang_iso": "ru", + "from_lang_name": "Russian", + "to_lang_iso": "en_US", + "to_lang_name": "English (United States)" + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translation_providers/translation_providers.json b/spec/fixtures/translation_providers/translation_providers.json new file mode 100644 index 0000000..4767cc7 --- /dev/null +++ b/spec/fixtures/translation_providers/translation_providers.json @@ -0,0 +1,36 @@ +{ + "translation_providers": [ + { + "provider_id": 1, + "name": "Gengo", + "slug": "gengo", + "price_pair_min": "0.00", + "website_url": "https://gengo.com", + "description": "At Gengo, our mission is to provide language services to everyone and connect a global community. Our network of over 18,000 translators are tested and qualified to meet stringent project standards. Translators are based around the world and in every timezone, which enables us to support over 35 languages and work towards the Gengo mission." + }, + { + "provider_id": 3, + "name": "Google", + "slug": "google", + "price_pair_min": "0.00", + "website_url": "https://translate.google.com", + "description": "Google Translate with neural machine translation support. NMT is not available for all language pairs yet." + }, + { + "provider_id": 4, + "name": "Lokalise", + "slug": "lokalise", + "price_pair_min": "10.00", + "website_url": "https://lokalise.com", + "description": "Our native professional translators are experts in mobile app, software, e-learning, website, multimedia and game localization. Translations in over 90 languages are available.

Reach out for our translation managers in our in-web support chat. They will guide you through.

Lifetime quality guarantee applies.

Lokalise will not translate unlawful, abusive, pornographic, discriminatory or gambling-related content.
As soon as such content is found in the order for translation placed with Lokalise, the order is stopped, and the untranslated part is refunded. Please see more details in Section 7 \"Prohibited Content\" of Lokalise Terms." + }, + { + "provider_id": 5, + "name": "DeepL", + "slug": "deepl", + "price_pair_min": "0.00", + "website_url": "https://deepl.com", + "description": "DeepL Pro neural machine translation." + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translation_providers/translation_providers_page1.json b/spec/fixtures/translation_providers/translation_providers_page1.json new file mode 100644 index 0000000..1b0f0c2 --- /dev/null +++ b/spec/fixtures/translation_providers/translation_providers_page1.json @@ -0,0 +1,20 @@ +{ + "translation_providers": [ + { + "provider_id": 1, + "name": "Gengo", + "slug": "gengo", + "price_pair_min": "0.00", + "website_url": "https://gengo.com", + "description": "At Gengo, our mission is to provide language services to everyone and connect a global community. Our network of over 18,000 translators are tested and qualified to meet stringent project standards. Translators are based around the world and in every timezone, which enables us to support over 35 languages and work towards the Gengo mission." + }, + { + "provider_id": 3, + "name": "Google", + "slug": "google", + "price_pair_min": "0.00", + "website_url": "https://translate.google.com", + "description": "Google Translate with neural machine translation support. NMT is not available for all language pairs yet." + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translation_providers/translation_providers_page2.json b/spec/fixtures/translation_providers/translation_providers_page2.json new file mode 100644 index 0000000..4c09a82 --- /dev/null +++ b/spec/fixtures/translation_providers/translation_providers_page2.json @@ -0,0 +1,20 @@ +{ + "translation_providers": [ + { + "provider_id": 4, + "name": "Lokalise", + "slug": "lokalise", + "price_pair_min": "10.00", + "website_url": "https://lokalise.com", + "description": "Our native professional translators are experts in mobile app, software, e-learning, website, multimedia and game localization. Translations in over 90 languages are available.

Reach out for our translation managers in our in-web support chat. They will guide you through.

Lifetime quality guarantee applies.

Lokalise will not translate unlawful, abusive, pornographic, discriminatory or gambling-related content.
As soon as such content is found in the order for translation placed with Lokalise, the order is stopped, and the untranslated part is refunded. Please see more details in Section 7 \"Prohibited Content\" of Lokalise Terms." + }, + { + "provider_id": 5, + "name": "DeepL", + "slug": "deepl", + "price_pair_min": "0.00", + "website_url": "https://deepl.com", + "description": "DeepL Pro neural machine translation." + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translations/translation.json b/spec/fixtures/translations/translation.json new file mode 100644 index 0000000..545861c --- /dev/null +++ b/spec/fixtures/translations/translation.json @@ -0,0 +1,22 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "translation": { + "translation_id": 2574122388, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "en", + "translation": "Welcome to Lokalise!", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-19 15:52:12 (Etc/UTC)", + "modified_at_timestamp": 1684511532, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 3, + "custom_translation_statuses": [], + "task_id": null + } +} \ No newline at end of file diff --git a/spec/fixtures/translations/translations.json b/spec/fixtures/translations/translations.json new file mode 100644 index 0000000..9b86961 --- /dev/null +++ b/spec/fixtures/translations/translations.json @@ -0,0 +1,60 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "translations": [ + { + "translation_id": 2574122388, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "en", + "translation": "Welcome to Lokalise!", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-19 15:52:12 (Etc/UTC)", + "modified_at_timestamp": 1684511532, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 3, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2658834452, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "de", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 13:50:28 (Etc/UTC)", + "modified_at_timestamp": 1685541028, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2574122387, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "fr", + "translation": "Bienvenue chez Lokalise %{username}", + "modified_by": 49436, + "modified_by_email": "ilya@lokalise.com", + "modified_at": "2023-05-19 15:51:23 (Etc/UTC)", + "modified_at_timestamp": 1684511483, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 3, + "custom_translation_statuses": [], + "task_id": null + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translations/translations_page3.json b/spec/fixtures/translations/translations_page3.json new file mode 100644 index 0000000..1d7b8f5 --- /dev/null +++ b/spec/fixtures/translations/translations_page3.json @@ -0,0 +1,48 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "translations": [ + { + "translation_id": 2574122386, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "lv", + "translation": "Laipni lūgti Lokalise!", + "modified_by": 49436, + "modified_by_email": "ilya@lokalise.com", + "modified_at": "2023-05-19 15:51:23 (Etc/UTC)", + "modified_at_timestamp": 1684511483, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 3, + "custom_translation_statuses": [ + { + "status_id": 14461, + "title": "wip", + "color": "#f2d600" + } + ], + "task_id": null + }, + { + "translation_id": 2574122400, + "segment_number": 1, + "key_id": 319782372, + "language_iso": "en", + "translation": "Editor", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-04-18 16:40:16 (Etc/UTC)", + "modified_at_timestamp": 1681836016, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [], + "task_id": null + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translations/translations_page4.json b/spec/fixtures/translations/translations_page4.json new file mode 100644 index 0000000..7112563 --- /dev/null +++ b/spec/fixtures/translations/translations_page4.json @@ -0,0 +1,42 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "translations": [ + { + "translation_id": 2658834453, + "segment_number": 1, + "key_id": 319782372, + "language_iso": "de", + "translation": "", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-05-31 13:50:28 (Etc/UTC)", + "modified_at_timestamp": 1685541028, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": true, + "is_fuzzy": true, + "words": 0, + "custom_translation_statuses": [], + "task_id": null + }, + { + "translation_id": 2574122399, + "segment_number": 1, + "key_id": 319782372, + "language_iso": "fr", + "translation": "Éditeur", + "modified_by": 49436, + "modified_by_email": "ilya@lokalise.com", + "modified_at": "2023-05-18 12:42:23 (Etc/UTC)", + "modified_at_timestamp": 1684413743, + "is_reviewed": false, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 1, + "custom_translation_statuses": [], + "task_id": null + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/translations/update_translation.json b/spec/fixtures/translations/update_translation.json new file mode 100644 index 0000000..80c1e15 --- /dev/null +++ b/spec/fixtures/translations/update_translation.json @@ -0,0 +1,22 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "branch": "master", + "translation": { + "translation_id": 2574122388, + "segment_number": 1, + "key_id": 319782369, + "language_iso": "en", + "translation": "Updated from Ruby", + "modified_by": 20181, + "modified_by_email": "bodrovis@protonmail.com", + "modified_at": "2023-07-18 16:01:22 (Etc/UTC)", + "modified_at_timestamp": 1689696082, + "is_reviewed": true, + "reviewed_by": 0, + "is_unverified": false, + "is_fuzzy": false, + "words": 3, + "custom_translation_statuses": [], + "task_id": null + } +} \ No newline at end of file diff --git a/spec/fixtures/vcr_cassettes/add_project_to_group_chained.yml b/spec/fixtures/vcr_cassettes/add_project_to_group_chained.yml deleted file mode 100644 index 73d20ee..0000000 --- a/spec/fixtures/vcr_cassettes/add_project_to_group_chained.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/515/projects/add - body: - encoding: UTF-8 - string: '{"projects":["446952185c01a12b4d0b45.76217122"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:24:02 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d0d10a6af40cd7fb8ddfd124f6373e22; expires=Thu, 18-Jul-2019 15:24:02 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["446952185c01a12b4d0b45.76217122","803826145ba90b42d5d860.46800099"],"members":[20181,25753]}}' - http_version: - recorded_at: Sun, 19 May 2019 15:24:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/add_projects_to_group.yml b/spec/fixtures/vcr_cassettes/add_projects_to_group.yml deleted file mode 100644 index 0a04d6b..0000000 --- a/spec/fixtures/vcr_cassettes/add_projects_to_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/689/projects/add - body: - encoding: UTF-8 - string: '{"projects":["605317925c13e4ecb36a79.94825279"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:50:05 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2aa42214126016a72148d7c62e8a40cf; expires=Thu, 18-Jul-2019 14:50:05 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["605317925c13e4ecb36a79.94825279"],"members":[35554]}}' - http_version: - recorded_at: Sun, 19 May 2019 14:50:05 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/add_user_to_group_chained.yml b/spec/fixtures/vcr_cassettes/add_user_to_group_chained.yml deleted file mode 100644 index 71a9d9d..0000000 --- a/spec/fixtures/vcr_cassettes/add_user_to_group_chained.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/515/members/add - body: - encoding: UTF-8 - string: '{"users":[35554]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:43:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=1aec98fa432236a47c68555dafad6a94; expires=Thu, 18-Jul-2019 15:43:21 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["803826145ba90b42d5d860.46800099"],"members":[20181,25753,35554]}}' - http_version: - recorded_at: Sun, 19 May 2019 15:43:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/add_users_to_group.yml b/spec/fixtures/vcr_cassettes/add_users_to_group.yml deleted file mode 100644 index de0e38c..0000000 --- a/spec/fixtures/vcr_cassettes/add_users_to_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/689/members/add - body: - encoding: UTF-8 - string: '{"users":[35554]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:54:52 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=814c7fdb48e46b110717533912faef17; expires=Thu, 18-Jul-2019 14:54:52 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["605317925c13e4ecb36a79.94825279"],"members":[35554]}}' - http_version: - recorded_at: Sun, 19 May 2019 14:54:52 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_branches.yml b/spec/fixtures/vcr_cassettes/all_branches.yml deleted file mode 100644 index 0a61a1b..0000000 --- a/spec/fixtures/vcr_cassettes/all_branches.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/5.0.0 - Accept-Encoding: - - gzip,deflate,br - X-Api-Token: - - "" - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Sun, 06 Feb 2022 16:40:04 GMT - Content-Type: - - application/json - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Accept-Encoding - Cache-Control: - - max-age=0, must-revalidate, no-cache, no-store, private - X-Pagination-Total-Count: - - '4' - X-Pagination-Page-Count: - - '1' - X-Pagination-Limit: - - '100' - X-Pagination-Page: - - '1' - Pragma: - - no-cache - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - deny - X-Xss-Protection: - - 1; mode=block - Strict-Transport-Security: - - max-age=31536000 - Referrer-Policy: - - origin - X-Lokalise-Process-Id: - - a380d4d6-1ad5-486f-98d2-a29fff179e03 - Expires: - - Sun, 06 Feb 2022 16:40:04 GMT - Access-Control-Allow-Origin: - - "*" - Access-Control-Allow-Headers: - - Content-Type - Content-Encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA7XQ30vDMBAH8H+l5ElhmXeXH03yJIj/gT6plLQNWjHtaIMgY/+72XDr9iITFfL0zXH3uVuz1Ti8hiZVXcscMyAMaZSq9hZqSa1qjYal1AYArGULVo++b15yafRTCuMhCRNzD+uv710zlNraBet9DMflzRh8Cm3lU04J0HCwnGSB2oFyRMXFbWoer+7vbi5z87m6Sl0MU/JxxRwqURpQSDRX1B/MbdvhcVSF6Lu3PKge2nF476brvG4a+m26bIbINosTszaazGwO43PgXTpx7NQEHMr8CgQnpAM4T20logEJx8Q/UEsSkNfeX3qnzkefp+xvbTkiR1EgOdL5WuepS6Flac1/qMVB3Q9t4HFL/96thFM/cFstfu9+2nwCFrmZPScDAAA= - recorded_at: Sun, 06 Feb 2022 16:40:04 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_branches_pagination.yml b/spec/fixtures/vcr_cassettes/all_branches_pagination.yml deleted file mode 100644 index 1c76230..0000000 --- a/spec/fixtures/vcr_cassettes/all_branches_pagination.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches?limit=2&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/5.0.0 - Accept-Encoding: - - gzip,deflate,br - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 06 Feb 2022 16:42:31 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - x-pagination-total-count: - - '4' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '2' - x-pagination-page: - - '2' - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - b6ecd865-12a2-465d-8c2f-43254af8694c - expires: - - Sun, 06 Feb 2022 16:42:31 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA6WP3UoDMRCFX6XMlcJunfw2yZUgvoFeqSz5o66YTckGoZS+u1nRSumVeDecOXPONwfYlfwWfR3GAAYUMkUl4cJZjY7TIIKSuOZSIaLW0IErdvKvzZrsXGM5KXEG83T4Xn+FccqQdDDZFBd7LNvYt7EDX6KtMQy2Np0i0T0hPWErQg2VhuLq6r7655vHh7vrM/dQxxTnatMODBEbJvlGK/zNc3to10S10p8Ktx9isuN7K3I5lPwxzrft4ZqnRV37nODYXVCzE/WUwwLd0M9ILrgFM+IP3Fqy/3O/HD8BnfcTg70BAAA= - recorded_at: Sun, 06 Feb 2022 16:42:31 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_comments.yml b/spec/fixtures/vcr_cassettes/all_comments.yml deleted file mode 100644 index 6c857b0..0000000 --- a/spec/fixtures/vcr_cassettes/all_comments.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15305182/comments - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 15:54:56 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=29a43423ef85481a6faec047cfb41550; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 15:54:56 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comments":[{"comment_id":767938,"key_id":15305182,"comment":"test","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-03 - 19:11:58 (Etc\/UTC)"},{"comment_id":800631,"key_id":15305182,"comment":"demo - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"},{"comment_id":800632,"key_id":15305182,"comment":"from - rspec","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 15:54:49 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_comments_pagination.yml b/spec/fixtures/vcr_cassettes/all_comments_pagination.yml deleted file mode 100644 index e3bf003..0000000 --- a/spec/fixtures/vcr_cassettes/all_comments_pagination.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15305182/comments?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 15:56:11 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=490472606a1d4c0a82deeef0524f0f91; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 15:56:11 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '3' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comments":[{"comment_id":800631,"key_id":15305182,"comment":"demo - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 15:56:03 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_contributors.yml b/spec/fixtures/vcr_cassettes/all_contributors.yml deleted file mode 100644 index 5d16174..0000000 --- a/spec/fixtures/vcr_cassettes/all_contributors.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:09:33 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=9aa927bb14d96332084c9db7ef49af7a; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:09:33 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributors":[{"user_id":5870,"email":"test@example.com","fullname":"John - Doe","created_at":"2017-06-09 13:56:00 (Etc\/UTC)","is_admin":false,"is_reviewer":false,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":false}],"admin_rights":[]},{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya","created_at":"2018-08-21 - 17:35:25 (Etc\/UTC)","is_admin":true,"is_reviewer":true,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":true},{"lang_id":673,"lang_iso":"f_over","lang_name":"fr - overriden","is_writable":true},{"lang_id":597,"lang_iso":"ru","lang_name":"Russian","is_writable":true}],"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"]}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:09:25 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_contributors_pagination.yml b/spec/fixtures/vcr_cassettes/all_contributors_pagination.yml deleted file mode 100644 index 694cf84..0000000 --- a/spec/fixtures/vcr_cassettes/all_contributors_pagination.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:09:33 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d38e2c2a39623754112a034c1de05367; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:09:33 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributors":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya","created_at":"2018-08-21 - 17:35:25 (Etc\/UTC)","is_admin":true,"is_reviewer":true,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":true},{"lang_id":673,"lang_iso":"f_over","lang_name":"fr - overriden","is_writable":true},{"lang_id":597,"lang_iso":"ru","lang_name":"Russian","is_writable":true}],"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"]}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:09:26 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_files_pagination.yml b/spec/fixtures/vcr_cassettes/all_files_pagination.yml deleted file mode 100644 index ed18128..0000000 --- a/spec/fixtures/vcr_cassettes/all_files_pagination.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/files?limit=1&page=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 17:35:22 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f9337569a248daa576fe37f42cfd41b4; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 17:35:22 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '1' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","files":[{"filename":"__unassigned__","key_count":1}]}' - http_version: - recorded_at: Sun, 09 Dec 2018 17:35:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_key_segments.yml b/spec/fixtures/vcr_cassettes/all_key_segments.yml deleted file mode 100644 index 2ce5b51..0000000 --- a/spec/fixtures/vcr_cassettes/all_key_segments.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 22 Nov 2021 16:28:25 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Mon, 22 Nov 2021 16:28:25 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segments":[{"segment_number":1,"language_iso":"en","value":"Hello!","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":1,"custom_translation_statuses":[]},{"segment_number":2,"language_iso":"en","value":"This - is just a simple text.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":6,"custom_translation_statuses":[]},{"segment_number":3,"language_iso":"en","value":"It - is segmented.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":3,"custom_translation_statuses":[]},{"segment_number":4,"language_iso":"en","value":"So - good.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":2,"custom_translation_statuses":[]}]}' - recorded_at: Mon, 22 Nov 2021 16:28:25 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_key_segments_pagination.yml b/spec/fixtures/vcr_cassettes/all_key_segments_pagination.yml deleted file mode 100644 index 149ba3c..0000000 --- a/spec/fixtures/vcr_cassettes/all_key_segments_pagination.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en?disable_references=1&limit=2&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 22 Nov 2021 16:39:45 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Mon, 22 Nov 2021 16:39:45 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segments":[{"segment_number":1,"language_iso":"en","value":"Hello!","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":1,"custom_translation_statuses":[]},{"segment_number":2,"language_iso":"en","value":"This - is just a simple text.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":6,"custom_translation_statuses":[]},{"segment_number":3,"language_iso":"en","value":"It - is segmented.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":3,"custom_translation_statuses":[]},{"segment_number":4,"language_iso":"en","value":"So - good.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:25:54 (Etc\/UTC)","modified_at_timestamp":1637598354,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":2,"custom_translation_statuses":[]}]}' - recorded_at: Mon, 22 Nov 2021 16:39:44 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_keys.yml b/spec/fixtures/vcr_cassettes/all_keys.yml deleted file mode 100644 index dbdac23..0000000 --- a/spec/fixtures/vcr_cassettes/all_keys.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Jun 2020 11:44:19 GMT - x-pagination-total-count: - - '8' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 26 Jun 2020 11:44:19 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","keys":[{"key_id":44596059,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"activerecord:attributes:feedback:message","android":"activerecord:attributes:feedback:message","web":"activerecord:attributes:feedback:message","other":"activerecord:attributes:feedback:message"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596060,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"global:forms:messages:errors","android":"global:forms:messages:errors","web":"global:forms:messages:errors","other":"global:forms:messages:errors"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":true,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":15,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596061,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"global:forms:submit","android":"global:forms:submit","web":"global:forms:submit","other":"global:forms:submit"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596062,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"global:menu:home","android":"global:menu:home","web":"global:menu:home","other":"global:menu:home"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596063,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"global:menu:feedback","android":"global:menu:feedback","web":"global:menu:feedback","other":"global:menu:feedback"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596064,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"feedbacks:new:title","android":"feedbacks:new:title","web":"feedbacks:new:title","other":"feedbacks:new:title"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596065,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"feedbacks:posted_by","android":"feedbacks:posted_by","web":"feedbacks:posted_by","other":"feedbacks:posted_by"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":2,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596066,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"static_pages:index:welcome","android":"static_pages:index:welcome","web":"static_pages:index:welcome","other":"static_pages:index:welcome"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482}]}' - recorded_at: Fri, 26 Jun 2020 11:44:09 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_keys_gzip.yml b/spec/fixtures/vcr_cassettes/all_keys_gzip.yml deleted file mode 100644 index d800b30..0000000 --- a/spec/fixtures/vcr_cassettes/all_keys_gzip.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys?limit=30 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/5.0.0 - Accept-Encoding: - - gzip,deflate,br - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 06 Feb 2022 16:37:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - x-pagination-total-count: - - '75' - x-pagination-page-count: - - '3' - x-pagination-limit: - - '30' - x-pagination-page: - - '1' - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 92631862-e154-4d39-bb61-021d02a3086f - expires: - - Sun, 06 Feb 2022 16:37:58 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA+2c3Y+jNhDA/5UV0kmttLny/eG3qqqqk6r2oa360J4QAW/CXQIRON3bnvZ/7xhwsMEmCbdLcyT3tHjGNo5/jMee8X3WdkX+AcckTBMNab5u+aZr2M4yCvSlbSZO4rv6W9v1dV0PAu1eWxZRFq9BdRuVBBdQ8hE/lRr66zP9o2rFtp3A1Z3gXosLHBGchBGBCqZu6gvdWRjGnWEgU0eWdffNjyT++7s/fv/hW2io1Q5JusUlibY7DRmOHxjQnmVVXYVZtMUa+qylOfSqRTFJ/8EFjvMiQREhRbrcE1yiB4yTZRR/RNBOGa0wNB9lSZFXozyj0iNentdLTtbwq5zxYs/32kO6wXRYMCA2LuF94aF+jzc/f//LT+G733598/Zpu4Fi1psGrSS4jIt0R9I8g/5BuNtE5CEvtnR2qgbe32skWtFH+Cstw91mX0QbDT1EmxJTffrY/MC0AVBZp0mCoT1S7EEDCqIiXsMvDrA0teI8I/gTnWCosYxKHD7CXEAnBszoOirCTbpNQazD474k+RZoYNNUV9rmSfqQnowJp67ihACkJYwefooy5PShv4pCw1wY5p2uI9NGti9SqKor9OXqnmeZru8/33e5d+lAX5371SZfRhtUTS9jvES4KPKihHloWT+iWHN1RIlRNqh2ARzXkL40xs6lcmwsdH9h1dbUQIY3hmNLt3Xf9zwJx/T7nZbjcr+kpkKJ70EuofYgk8LaSC+A0Zut5Vb8L7a15oSMbnG2R+scvA8JoLxQoJMXdNBsRTcuJYv0kKvIqQvrMucrqtiaxAcAX3Uy21lhxPxdJZucQp9PTihj9CC+ccqBx0D6mjm1p+CU4VOiDD8ikpKNaELl8ppSuYxBKpPeGJ0Zo9T/fnU/tCVpl8O5RhIunwRTKpd3GeXr9hltpbNllPpj17jnd6dgFA7ESBqHOzjOKlGaJfgTesSbuOuRDqrVxA6qMHAHlG78Tm1jYa/vLUyTnpxaAbLsMXt90w0cK/BsYa8f+PDPkNtYb6FDjw4yLGQ7Yo+tRRb978DydNM3oT16Giye1T4U+87unpU0drSRMwBr6TmswckvCaPyKYvffijhGHTCA9JmXz/dCenA5HBwqmbnf9od1bTJreXAgMbQVqb/im5mU9BYwFrKUKtkN9LuNQ6dw/5mYGI49YskzZOuywMDGkNanG9yGghrD91ZSc0ae2Kw1c832uZGmyXfTR9o85ARnL6KWroFEdT+KkrXOAG2pqBmrXlgqFWP55BWlDscN0voxCHGMSsojbWN3m8MTMygXatnZngFBX/NXpgQm3GQHiCn4z2p6go21DUC3fC8wOH9NScwdYjZSEkzaHj9Dpw13UWGfhJprg6dWIYHv2OftGZzEVKyeOsmltfciWUMP770HAq3TyGLiR935N7RndBdtNvdNd3By75k6HsMl1+yDx6aRhWX3Dyq2KqX89faRzRcSvcRQwNSrLfceNRc0gwQGZd1uchlXdblkpaewyV0x5roZ1z8We/FKYnVAafAIO3p/SH9QqNHQfTlGbEg4vIxjsexxzBpjDeWHDW2h2xXtC1KKOmG07ZdcPePQvkqgWwnsBzbN6RBQgqlS82zbSL7tEQkCmXgB640EYludUNIxwhr0lpfsCOosTwU1raVQXUoflEwu/awfkPac0ukCGCD11AmxRgCaVRs7Go9NF9KANsJGwZQh3Sg18gI8mzDdXVfslrDF2UszODOsME5QOAonJIJ5xpGYJmGCZkZfasYLfM9gVQgEoU0E0ywjH1ZjWG/nJHYlTzPNkuNbhHHQTk8h0oo20kchlJs3upsHVR1Oy5kBYwV8C5kA6VkqRZ7fBEoFemZNGkQsjBRlCQpzdKDtMM0e8hFaM+u20B9dr0D9GfWnO1HMd59HUbo0r8JycHk8IBU7mv7jUsM9RHK8DZKaW5v60Ko8pXZV8RqnMY/0z6V+lp/tqyPT1MeRuPSWZccjQ4P6DVYpw7vWag3FU4jvVE+FfRK/cY5B+7hzGDAV+XUZb4HdVZVvoqs+Rf3c/x+CGB6zgmO1xmECVZiVskxwy5UO415ocqp5HOVbvxzQMsA7brFnPpF8i+5hvXy/MdwzWuVFylLTBFsukRYsywRMGJ7otlyeaW+diC5JvXyXNYXolCc5x+BzTBJy2i5gctrvHet1qkpVcsZrCqN2TL7ZUfJX68zEUjuRL0atBVVoa3bKCVhnO83kJSK4TYjvXwp4XdYXUB5WLVD9ZDybAGnTuMVHgoGklDJBHxD1KTE9GLxMNe8moJnXkXJcas0W35pxOEa+ZXcu5qA3wKTfZGFJA/h6I5mnbZHd5X1bC5mV7a8p6sguaenxLmjOVumacDiGpmeJHrY47R/TUupoiCYtaAEt1aYLa80mHCNvE4SWBRhNE2U5WGRrtZVVo3K/HbUZNx2VOTsCkqz5dccn64xvOZe+IlZMEkUsAcwM5cD8DIVBbhMrIR25gb3Wh2ESSJ5Aq8O/NdJJdw7JOs0W4WPRZ6t1F6vXFnCsFxRSrNMdb6G+FpPIyYJ3fXAZmZUYYgpekxFATETK9GduSG+Dsfh/fN/bSin/j1RAAA= - recorded_at: Sun, 06 Feb 2022 16:37:58 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_keys_pagination.yml b/spec/fixtures/vcr_cassettes/all_keys_pagination.yml deleted file mode 100644 index d49618d..0000000 --- a/spec/fixtures/vcr_cassettes/all_keys_pagination.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys?limit=2&page=3 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Jun 2020 11:52:41 GMT - x-pagination-total-count: - - '8' - x-pagination-page-count: - - '4' - x-pagination-limit: - - '2' - x-pagination-page: - - '3' - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 26 Jun 2020 11:52:41 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","keys":[{"key_id":44596063,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"global:menu:feedback","android":"global:menu:feedback","web":"global:menu:feedback","other":"global:menu:feedback"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482},{"key_id":44596064,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"feedbacks:new:title","android":"feedbacks:new:title","web":"feedbacks:new:title","other":"feedbacks:new:title"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482}]}' - recorded_at: Fri, 26 Jun 2020 11:52:31 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_orders.yml b/spec/fixtures/vcr_cassettes/all_orders.yml deleted file mode 100644 index 7e2ed78..0000000 --- a/spec/fixtures/vcr_cassettes/all_orders.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/orders - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 18:21:29 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=22433700ecd24bc3ccd8ba37150a1484; expires=Sat, 18-May-2019 18:21:29 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"orders":[{"order_id":"201903198B2","project_id":"803826145ba90b42d5d860.46800099","card_id":"1774","status":"in - progress","created_at":"2019-03-19 18:18:21 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","target_language_isos":["ru"],"keys":[15519786],"source_words":{"ru":1},"provider_slug":"gengo","translation_style":"friendly","translation_tier":1,"translation_tier_name":"Professional - translator","briefing":"Some briefing","total":0.07}]}' - http_version: - recorded_at: Tue, 19 Mar 2019 18:21:27 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_orders_pagination.yml b/spec/fixtures/vcr_cassettes/all_orders_pagination.yml deleted file mode 100644 index 71bbf16..0000000 --- a/spec/fixtures/vcr_cassettes/all_orders_pagination.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/orders?limit=1&page=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 18:22:01 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=ba9828bc1227ab59e0badfeed5bc8931; expires=Sat, 18-May-2019 18:22:01 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '1' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"orders":[{"order_id":"201903198B2","project_id":"803826145ba90b42d5d860.46800099","card_id":"1774","status":"in - progress","created_at":"2019-03-19 18:18:21 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","target_language_isos":["ru"],"keys":[15519786],"source_words":{"ru":1},"provider_slug":"gengo","translation_style":"friendly","translation_tier":1,"translation_tier_name":"Professional - translator","briefing":"Some briefing","total":0.07}]}' - http_version: - recorded_at: Tue, 19 Mar 2019 18:21:59 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_payment_cards.yml b/spec/fixtures/vcr_cassettes/all_payment_cards.yml deleted file mode 100644 index be359fe..0000000 --- a/spec/fixtures/vcr_cassettes/all_payment_cards.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/payment_cards - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:51:17 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=990a06da710689cb8bc23d8ec6968070; expires=Sat, 18-May-2019 17:51:17 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"user_id":20181,"payment_cards":[{"card_id":1774,"last4":"0358","brand":"Visa","created_at":"2019-03-19 - 17:49:07 (Etc\/UTC)"}]}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:51:15 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_payment_cards_pagination.yml b/spec/fixtures/vcr_cassettes/all_payment_cards_pagination.yml deleted file mode 100644 index d90e883..0000000 --- a/spec/fixtures/vcr_cassettes/all_payment_cards_pagination.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/payment_cards?limit=1&page=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:50:16 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=58b3d7224bd884f313dee63e78e3c31c; expires=Sat, 18-May-2019 17:50:16 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '1' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"user_id":20181,"payment_cards":[{"card_id":1774,"last4":"0358","brand":"Visa","created_at":"2019-03-19 - 17:49:07 (Etc\/UTC)"}]}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:50:14 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_project_languages.yml b/spec/fixtures/vcr_cassettes/all_project_languages.yml deleted file mode 100644 index e59ab98..0000000 --- a/spec/fixtures/vcr_cassettes/all_project_languages.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:23:55 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=c4f07b667dbd526920d19f7cab40f9a2; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:23:55 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":673,"lang_iso":"f_over","lang_name":"fr - overriden","is_rtl":false,"plural_forms":["one","few"]},{"lang_id":597,"lang_iso":"ru","lang_name":"Russian","is_rtl":false,"plural_forms":["one","few","many","other"]}]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:23:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_project_languages_pagination.yml b/spec/fixtures/vcr_cassettes/all_project_languages_pagination.yml deleted file mode 100644 index a79570c..0000000 --- a/spec/fixtures/vcr_cassettes/all_project_languages_pagination.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:23:55 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3ab02aef7ef82e58115b3e17afa228d9; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:23:55 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '3' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","languages":[{"lang_id":673,"lang_iso":"f_over","lang_name":"fr - overriden","is_rtl":false,"plural_forms":["one","few"]}]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:23:55 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_projects.yml b/spec/fixtures/vcr_cassettes/all_projects.yml deleted file mode 100644 index 65e9dcd..0000000 --- a/spec/fixtures/vcr_cassettes/all_projects.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 03 Dec 2018 19:26:02 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=70d3b5e722b31e636bafc9610629fb24; path=/; HttpOnly, locale=en_US; - expires=Wed, 02-Jan-2019 19:26:01 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '5' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"projects":[{"project_id":"803826145ba90b42d5d860.46800099","name":"demo - phoenix","description":"","created_at":"2018-09-24 18:05:22 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":33,"keys":1,"team":1,"base_words":1,"qa_issues":1,"languages":[{"language_id":640,"language_iso":"en","progress":100,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":1},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":1}]}},{"project_id":"547879415c01a0e6e0b855.29978928","name":"demo - phoenix copy","description":"","created_at":"2018-11-30 20:43:18 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":1,"team":1,"base_words":0,"qa_issues":1,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0}]}},{"project_id":"446952185c01a12b4d0b45.76217122","name":"demo - phoenix copy","description":"","created_at":"2018-11-30 20:44:27 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":1,"team":1,"base_words":0,"qa_issues":1,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0}]}},{"project_id":"672198945b7d72fc048021.15940510","name":"Demo - Rails Proj","description":"","created_at":"2018-08-22 16:28:12 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":98,"keys":10,"team":1,"base_words":37,"qa_issues":11,"languages":[{"language_id":640,"language_iso":"en","progress":100,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":97,"words_to_do":1}]}},{"project_id":"963054665b7c313dd9b323.35886655","name":"Sample - Project","description":"Lokalise sample project. Click title to edit in multilanguage - view. You can delete it in project settings.","created_at":"2018-08-21 15:35:25 - (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":27,"keys":12,"team":1,"base_words":185,"qa_issues":13,"languages":[{"language_id":640,"language_iso":"en","progress":100,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":73,"words_to_do":49},{"language_id":673,"language_iso":"fr","progress":14,"words_to_do":159},{"language_id":666,"language_iso":"de","progress":2,"words_to_do":181},{"language_id":643,"language_iso":"ja","progress":1,"words_to_do":182},{"language_id":766,"language_iso":"he","progress":1,"words_to_do":182},{"language_id":602,"language_iso":"zh_CN","progress":0,"words_to_do":185}]}}]}' - http_version: - recorded_at: Mon, 03 Dec 2018 19:26:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_projects_pagination.yml b/spec/fixtures/vcr_cassettes/all_projects_pagination.yml deleted file mode 100644 index 36ed282..0000000 --- a/spec/fixtures/vcr_cassettes/all_projects_pagination.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 03 Dec 2018 19:26:01 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=1d5aee2afe3a4ba8ff78c4d083f263b1; path=/; HttpOnly, locale=en_US; - expires=Wed, 02-Jan-2019 19:26:01 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '5' - x-pagination-page-count: - - '5' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"projects":[{"project_id":"547879415c01a0e6e0b855.29978928","name":"demo - phoenix copy","description":"","created_at":"2018-11-30 20:43:18 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":1,"team":1,"base_words":0,"qa_issues":1,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0}]}}]}' - http_version: - recorded_at: Mon, 03 Dec 2018 19:26:01 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_queued_processes.yml b/spec/fixtures/vcr_cassettes/all_queued_processes.yml deleted file mode 100644 index 9664036..0000000 --- a/spec/fixtures/vcr_cassettes/all_queued_processes.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/processes - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 15 May 2020 10:45:28 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 15 May 2020 10:45:28 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","processes":[{"process_id":"3b943469e6b3e324b5bdad639b122a623e6e7a1a","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-13 - 11:24:37 (Etc\/UTC)","created_at_timestamp":1589369077},{"process_id":"f0292f2d7e360641e2aa18db195d0a68031c8aeb","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-14 - 09:58:47 (Etc\/UTC)","created_at_timestamp":1589450327},{"process_id":"7055ee34fab2a5f38b8adaaf55132ff4659ceaf8","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-14 - 09:59:37 (Etc\/UTC)","created_at_timestamp":1589450377},{"process_id":"c0f2ea978ac6382f46babfd5de844062835280f8","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-14 - 10:00:09 (Etc\/UTC)","created_at_timestamp":1589450409},{"process_id":"596d4058c863e1d2355db8b48e37ac1355772b78","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-14 - 10:15:10 (Etc\/UTC)","created_at_timestamp":1589451310},{"process_id":"fb59937f47be1999b3643a7022d17bd46d807fad","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-14 - 10:18:03 (Etc\/UTC)","created_at_timestamp":1589451483},{"process_id":"ff1876382b7ba81f2bb465da8f030196ec401fa6","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-15 - 10:38:35 (Etc\/UTC)","created_at_timestamp":1589539115},{"process_id":"fb57b3b0704c081468c2e25a20aaaa599a004f9d","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","created_at_timestamp":1589539482}]}' - http_version: null - recorded_at: Fri, 15 May 2020 10:45:21 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/all_screenshots.yml b/spec/fixtures/vcr_cassettes/all_screenshots.yml deleted file mode 100644 index 333bff1..0000000 --- a/spec/fixtures/vcr_cassettes/all_screenshots.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:44:12 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a2613c2900bcbe1676181d481ab0b0eb; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:44:12 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshots":[{"screenshot_id":115185,"title":"rspec - screen","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/29b5bdb9c85bc973e3ada5c7a2f10f762232e8ea.jpg","key_ids":[],"width":125,"height":32}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:44:12 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_screenshots_pagination.yml b/spec/fixtures/vcr_cassettes/all_screenshots_pagination.yml deleted file mode 100644 index 1a92cbd..0000000 --- a/spec/fixtures/vcr_cassettes/all_screenshots_pagination.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots?limit=1&page=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:47:00 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f66782f0a0e34625859a8528a6039ac7; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:47:00 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '1' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshots":[{"screenshot_id":115185,"title":"rspec - screen","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/29b5bdb9c85bc973e3ada5c7a2f10f762232e8ea.jpg","key_ids":[],"width":125,"height":32}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:47:00 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_snapshots.yml b/spec/fixtures/vcr_cassettes/all_snapshots.yml deleted file mode 100644 index 6f5c969..0000000 --- a/spec/fixtures/vcr_cassettes/all_snapshots.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 17:11:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=306d5a67506ccdafe430e9ba65045b9f; expires=Tue, 16-Jul-2019 17:11:08 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '1' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshots":[{"snapshot_id":27882,"title":"test - rspec","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2018-12-10 - 17:02:04 (Etc\/UTC)","created_at_timestamp":1544461324}]}' - http_version: - recorded_at: Fri, 17 May 2019 17:10:56 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_snapshots_pagination.yml b/spec/fixtures/vcr_cassettes/all_snapshots_pagination.yml deleted file mode 100644 index 10fb936..0000000 --- a/spec/fixtures/vcr_cassettes/all_snapshots_pagination.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:03:15 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=197c0c472487b329a8a3cb0ff94c8cd3; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:03:14 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshots":[{"snapshot_id":27882,"title":"test - rspec","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2018-12-10 - 17:02:04 (Etc\/UTC)"}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:03:14 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_system_languages.yml b/spec/fixtures/vcr_cassettes/all_system_languages.yml deleted file mode 100644 index 355f03a..0000000 --- a/spec/fixtures/vcr_cassettes/all_system_languages.yml +++ /dev/null @@ -1,125 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/system/languages - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:23:55 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=9a5434a4d3fc06c014013368c79ffd75; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:23:55 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '618' - x-pagination-page-count: - - '7' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"languages":[{"lang_id":894,"lang_iso":"ab","lang_name":"Abkhaz","is_rtl":false,"plural_forms":null},{"lang_id":891,"lang_iso":"aa","lang_name":"Afar","is_rtl":false,"plural_forms":null},{"lang_id":790,"lang_iso":"af","lang_name":"Afrikaans","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":791,"lang_iso":"af_NA","lang_name":"Afrikaans - (Namibia)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":792,"lang_iso":"af_ZA","lang_name":"Afrikaans - (South Africa)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":977,"lang_iso":"agq","lang_name":"Aghem","is_rtl":false,"plural_forms":null},{"lang_id":910,"lang_iso":"ak","lang_name":"Akan","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":803,"lang_iso":"sq","lang_name":"Albanian","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":941,"lang_iso":"am","lang_name":"Amharic","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":714,"lang_iso":"ar","lang_name":"Arabic","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":715,"lang_iso":"ar_DZ","lang_name":"Arabic - (Algeria)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":716,"lang_iso":"ar_BH","lang_name":"Arabic - (Bahrain)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":717,"lang_iso":"ar_EG","lang_name":"Arabic - (Egypt)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":718,"lang_iso":"ar_IQ","lang_name":"Arabic - (Iraq)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":719,"lang_iso":"ar_JO","lang_name":"Arabic - (Jordan)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":720,"lang_iso":"ar_KW","lang_name":"Arabic - (Kuwait)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":721,"lang_iso":"ar_LB","lang_name":"Arabic - (Lebanon)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":722,"lang_iso":"ar_LY","lang_name":"Arabic - (Libya)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":723,"lang_iso":"ar_MA","lang_name":"Arabic - (Morocco)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":724,"lang_iso":"ar_OM","lang_name":"Arabic - (Oman)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":725,"lang_iso":"ar_QA","lang_name":"Arabic - (Qatar)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":726,"lang_iso":"ar_SA","lang_name":"Arabic - (Saudi Arabia)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":727,"lang_iso":"ar_SD","lang_name":"Arabic - (Sudan)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":728,"lang_iso":"ar_SY","lang_name":"Arabic - (Syria)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":729,"lang_iso":"ar_TN","lang_name":"Arabic - (Tunisia)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":730,"lang_iso":"ar_AE","lang_name":"Arabic - (United Arab Emirates)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":731,"lang_iso":"ar_001","lang_name":"Arabic - (World)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":732,"lang_iso":"ar_YE","lang_name":"Arabic - (Yemen)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":831,"lang_iso":"an","lang_name":"Aragonese","is_rtl":false,"plural_forms":null},{"lang_id":810,"lang_iso":"hy","lang_name":"Armenian","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":846,"lang_iso":"as","lang_name":"Assamese","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":978,"lang_iso":"asa","lang_name":"Asu","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":873,"lang_iso":"av","lang_name":"Avaric","is_rtl":false,"plural_forms":null},{"lang_id":833,"lang_iso":"ae","lang_name":"Avestan","is_rtl":false,"plural_forms":null},{"lang_id":877,"lang_iso":"ay","lang_name":"Aymara","is_rtl":false,"plural_forms":null},{"lang_id":795,"lang_iso":"az","lang_name":"Azerbaijani","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":794,"lang_iso":"az_AZ","lang_name":"Azerbaijani - (Azerbaijan)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":797,"lang_iso":"az_Cyrl_AZ","lang_name":"Azerbaijani - (Cyrillic, Azerbaijan)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":796,"lang_iso":"az_Cyrl","lang_name":"Azerbaijani - (Cyrillic)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":979,"lang_iso":"ksf","lang_name":"Bafia","is_rtl":false,"plural_forms":null},{"lang_id":934,"lang_iso":"bm","lang_name":"Bambara","is_rtl":false,"plural_forms":["other"]},{"lang_id":980,"lang_iso":"bas","lang_name":"Basaa","is_rtl":false,"plural_forms":null},{"lang_id":902,"lang_iso":"ba","lang_name":"Bashkir","is_rtl":false,"plural_forms":null},{"lang_id":911,"lang_iso":"eu_ES","lang_name":"Basque - (Spain)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":1069,"lang_iso":"be","lang_name":"Belarusian","is_rtl":false,"plural_forms":["one","few","many","other"]},{"lang_id":906,"lang_iso":"be_BY","lang_name":"Belarusian - (Belarus)","is_rtl":false,"plural_forms":["one","few","many","other"]},{"lang_id":981,"lang_iso":"bem","lang_name":"Bemba","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":982,"lang_iso":"bez","lang_name":"Bena","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":815,"lang_iso":"bn","lang_name":"Bengali","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":816,"lang_iso":"bn_BD","lang_name":"Bengali - (Bangladesh)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":814,"lang_iso":"bn_IN","lang_name":"Bengali - (India)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":919,"lang_iso":"bh","lang_name":"Bihari","is_rtl":false,"plural_forms":null},{"lang_id":929,"lang_iso":"bi","lang_name":"Bislama","is_rtl":false,"plural_forms":null},{"lang_id":983,"lang_iso":"brx","lang_name":"Bodo","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":802,"lang_iso":"bs_BA","lang_name":"Bosnian - (Bosnia and Herzegovina)","is_rtl":false,"plural_forms":["one","few","other"]},{"lang_id":829,"lang_iso":"br","lang_name":"Breton","is_rtl":false,"plural_forms":["one","two","few","many","other"]},{"lang_id":781,"lang_iso":"bg","lang_name":"Bulgarian","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":780,"lang_iso":"bg_BG","lang_name":"Bulgarian - (Bulgaria)","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":883,"lang_iso":"my","lang_name":"Burmese","is_rtl":false,"plural_forms":["other"]},{"lang_id":764,"lang_iso":"ca","lang_name":"Catalan","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":1068,"lang_iso":"ceb","lang_name":"Cebuano","is_rtl":false,"plural_forms":null},{"lang_id":984,"lang_iso":"tzm","lang_name":"Central - Morocco Tamazight","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":837,"lang_iso":"ch","lang_name":"Chamorro","is_rtl":false,"plural_forms":null},{"lang_id":834,"lang_iso":"ce","lang_name":"Chechen","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":985,"lang_iso":"chr","lang_name":"Cherokee","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":819,"lang_iso":"ny","lang_name":"Chichewa","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":986,"lang_iso":"cgg","lang_name":"Chiga","is_rtl":false,"plural_forms":["one","other"]},{"lang_id":602,"lang_iso":"zh_CN","lang_name":"Chinese - Simplified","is_rtl":false,"plural_forms":["other"]},{"lang_id":605,"lang_iso":"zh_Hans_CN","lang_name":"Chinese - Simplified (China)","is_rtl":false,"plural_forms":["other"]},{"lang_id":606,"lang_iso":"zh_Hans_HK","lang_name":"Chinese - Simplified (Hong Kong)","is_rtl":false,"plural_forms":["other"]},{"lang_id":608,"lang_iso":"zh_Hans_MO","lang_name":"Chinese - Simplified (Macau)","is_rtl":false,"plural_forms":["other"]},{"lang_id":10155,"lang_iso":"zh_MY","lang_name":"Chinese - Simplified (Malay)","is_rtl":false,"plural_forms":["other"]},{"lang_id":604,"lang_iso":"zh_SG","lang_name":"Chinese - Simplified (Singapore)","is_rtl":false,"plural_forms":["other"]},{"lang_id":601,"lang_iso":"zh_TW","lang_name":"Chinese - Traditional","is_rtl":false,"plural_forms":["other"]},{"lang_id":603,"lang_iso":"zh_HK","lang_name":"Chinese - Traditional (Hong Kong)","is_rtl":false,"plural_forms":["other"]},{"lang_id":607,"lang_iso":"zh_Hant_MO","lang_name":"Chinese - Traditional (Macau)","is_rtl":false,"plural_forms":["other"]},{"lang_id":609,"lang_iso":"zh_Hant_TW","lang_name":"Chinese - Traditional (Taiwan)","is_rtl":false,"plural_forms":["other"]},{"lang_id":848,"lang_iso":"cu","lang_name":"Church - Slavic","is_rtl":false,"plural_forms":null},{"lang_id":856,"lang_iso":"cv_CV","lang_name":"Chuvash","is_rtl":false,"plural_forms":null},{"lang_id":987,"lang_iso":"swc","lang_name":"Congo - Swahili","is_rtl":false,"plural_forms":null},{"lang_id":861,"lang_iso":"kw","lang_name":"Cornish","is_rtl":false,"plural_forms":["one","two","other"]},{"lang_id":843,"lang_iso":"co","lang_name":"Corsican","is_rtl":false,"plural_forms":null},{"lang_id":844,"lang_iso":"cr","lang_name":"Cree","is_rtl":false,"plural_forms":null},{"lang_id":793,"lang_iso":"hr","lang_name":"Croatian","is_rtl":false,"plural_forms":["one","few","other"]},{"lang_id":10001,"lang_iso":"custom_1","lang_name":"Custom - Language 1","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10010,"lang_iso":"custom_10","lang_name":"Custom - Language 10","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10100,"lang_iso":"custom_100","lang_name":"Custom - Language 100","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10101,"lang_iso":"custom_101","lang_name":"Custom - Language 101","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10102,"lang_iso":"custom_102","lang_name":"Custom - Language 102","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10103,"lang_iso":"custom_103","lang_name":"Custom - Language 103","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10104,"lang_iso":"custom_104","lang_name":"Custom - Language 104","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10105,"lang_iso":"custom_105","lang_name":"Custom - Language 105","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10106,"lang_iso":"custom_106","lang_name":"Custom - Language 106","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10107,"lang_iso":"custom_107","lang_name":"Custom - Language 107","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10108,"lang_iso":"custom_108","lang_name":"Custom - Language 108","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10109,"lang_iso":"custom_109","lang_name":"Custom - Language 109","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10011,"lang_iso":"custom_11","lang_name":"Custom - Language 11","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10110,"lang_iso":"custom_110","lang_name":"Custom - Language 110","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10111,"lang_iso":"custom_111","lang_name":"Custom - Language 111","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":10112,"lang_iso":"custom_112","lang_name":"Custom - Language 112","is_rtl":false,"plural_forms":["zero","one","two","few","many","other"]}]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:23:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_system_languages_pagination.yml b/spec/fixtures/vcr_cassettes/all_system_languages_pagination.yml deleted file mode 100644 index 0894338..0000000 --- a/spec/fixtures/vcr_cassettes/all_system_languages_pagination.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/system/languages?limit=10&page=3 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:23:54 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=14603a485b3a59d5382b847effa2b7d1; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:23:54 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '618' - x-pagination-page-count: - - '62' - x-pagination-limit: - - '10' - x-pagination-page: - - '3' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"languages":[{"lang_id":725,"lang_iso":"ar_QA","lang_name":"Arabic - (Qatar)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":726,"lang_iso":"ar_SA","lang_name":"Arabic - (Saudi Arabia)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":727,"lang_iso":"ar_SD","lang_name":"Arabic - (Sudan)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":728,"lang_iso":"ar_SY","lang_name":"Arabic - (Syria)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":729,"lang_iso":"ar_TN","lang_name":"Arabic - (Tunisia)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":730,"lang_iso":"ar_AE","lang_name":"Arabic - (United Arab Emirates)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":731,"lang_iso":"ar_001","lang_name":"Arabic - (World)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":732,"lang_iso":"ar_YE","lang_name":"Arabic - (Yemen)","is_rtl":true,"plural_forms":["zero","one","two","few","many","other"]},{"lang_id":831,"lang_iso":"an","lang_name":"Aragonese","is_rtl":false,"plural_forms":null},{"lang_id":810,"lang_iso":"hy","lang_name":"Armenian","is_rtl":false,"plural_forms":["one","other"]}]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:23:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_tasks.yml b/spec/fixtures/vcr_cassettes/all_tasks.yml deleted file mode 100644 index 6a75845..0000000 --- a/spec/fixtures/vcr_cassettes/all_tasks.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:41:14 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=6923d91a82f662665b6c0ceb7a3ac10f; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:41:13 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","tasks":[{"task_id":4387,"title":"another - rspec key","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"desc - here","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-10 - 18:37:02 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[15571976],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null},{"task_id":4381,"title":"rspec - key","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-10 - 18:27:19 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[15519786],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null},{"task_id":4181,"title":"demo","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":1,"created_at":"2018-12-04 - 18:59:04 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[0],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":1,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:41:13 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_tasks_pagination.yml b/spec/fixtures/vcr_cassettes/all_tasks_pagination.yml deleted file mode 100644 index ddb5978..0000000 --- a/spec/fixtures/vcr_cassettes/all_tasks_pagination.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks?limit=2&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:41:14 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a14d8fa98b486e14525b5fcb7617198f; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:41:14 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '2' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","tasks":[{"task_id":4181,"title":"demo","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":1,"created_at":"2018-12-04 - 18:59:04 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[0],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":1,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:41:14 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_team_users_pagination.yml b/spec/fixtures/vcr_cassettes/all_team_users_pagination.yml deleted file mode 100644 index 1065094..0000000 --- a/spec/fixtures/vcr_cassettes/all_team_users_pagination.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/users?limit=1&page=3 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:51:05 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=95429fb9cd2da4d772282d4bca03b74d; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:51:05 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '4' - x-pagination-page-count: - - '4' - x-pagination-limit: - - '1' - x-pagination-page: - - '3' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya","created_at":"2018-08-21 - 17:35:25 (Etc\/UTC)","role":"owner"}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:51:05 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_translation_providers.yml b/spec/fixtures/vcr_cassettes/all_translation_providers.yml deleted file mode 100644 index f9901f2..0000000 --- a/spec/fixtures/vcr_cassettes/all_translation_providers.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/translation_providers - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 20 Mar 2019 15:25:57 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=7f31ba91defcc85f2a020132428e95b3; expires=Sun, 19-May-2019 15:25:57 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"translation_providers":[{"provider_id":1,"name":"Gengo","slug":"gengo","price_pair_min":"0.00","website_url":"https:\/\/gengo.com","description":"At - Gengo, our mission is to provide language services to everyone and connect - a global community. Our network of over 18,000 translators are tested and - qualified to meet stringent project standards. Translators are based around - the world and in every timezone, which enables us to support over 35 languages - and work towards the Gengo mission."},{"provider_id":4,"name":"Lokalise","slug":"lokalise","price_pair_min":"10.00","website_url":"https:\/\/lokalise.co","description":"Our - native professional translations are experts in mobile app, software, e-learning, - website, multimedia and game localization. Translations in over 90 languages - are available.\n

\nReach out for our translation managers in our in-web - support chat. They will guide you through.\n

\nLifetime quality - guarantee<\/strong> applies."}]}' - http_version: - recorded_at: Wed, 20 Mar 2019 15:25:52 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_translation_providers_pagination.yml b/spec/fixtures/vcr_cassettes/all_translation_providers_pagination.yml deleted file mode 100644 index e89bcdf..0000000 --- a/spec/fixtures/vcr_cassettes/all_translation_providers_pagination.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/translation_providers?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 20 Mar 2019 16:44:11 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f67fcafd021cf93f17a2a99c646a4d3c; expires=Sun, 19-May-2019 16:44:11 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"translation_providers":[{"provider_id":4,"name":"Lokalise","slug":"lokalise","price_pair_min":"10.00","website_url":"https:\/\/lokalise.co","description":"Our - native professional translations are experts in mobile app, software, e-learning, - website, multimedia and game localization. Translations in over 90 languages - are available.\n

\nReach out for our translation managers in our in-web - support chat. They will guide you through.\n

\nLifetime quality - guarantee<\/strong> applies."}]}' - http_version: - recorded_at: Wed, 20 Mar 2019 16:44:06 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_translation_statuses.yml b/spec/fixtures/vcr_cassettes/all_translation_statuses.yml deleted file mode 100644 index 1233f1b..0000000 --- a/spec/fixtures/vcr_cassettes/all_translation_statuses.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:26:00 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3e71b9b8c2c510f826099b9be957328e; expires=Sun, 15-Sep-2019 16:26:00 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_statuses":[{"status_id":128,"title":"random","color":"#0079bf"},{"status_id":126,"title":"Reviewed - by doctors","color":"#f2d600"},{"status_id":127,"title":"tested","color":"#61bd4f"}]}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:25:33 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_translation_statuses_pagination.yml b/spec/fixtures/vcr_cassettes/all_translation_statuses_pagination.yml deleted file mode 100644 index e510fb9..0000000 --- a/spec/fixtures/vcr_cassettes/all_translation_statuses_pagination.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:25:59 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=6f9b89cdbb1014ff04319596a0c46c54; expires=Sun, 15-Sep-2019 16:25:59 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '3' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_statuses":[{"status_id":126,"title":"Reviewed - by doctors","color":"#f2d600"}]}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:25:33 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_translations_pagination.yml b/spec/fixtures/vcr_cassettes/all_translations_pagination.yml deleted file mode 100644 index f451171..0000000 --- a/spec/fixtures/vcr_cassettes/all_translations_pagination.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations?disable_references=0&filter_is_reviewed=0&limit=4&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 16:46:19 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=75fb6ca05c9232dc40fdf4873d412e88; expires=Tue, 16-Jul-2019 16:46:19 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '187' - x-pagination-page-count: - - '47' - x-pagination-limit: - - '4' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translations":[{"translation_id":100688218,"key_id":18925476,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2019-02-27 - 15:42:46 (Etc\/UTC)","modified_at_timestamp":1551282166,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":113286661,"key_id":20822936,"language_iso":"ru","translation":"","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:12:29 (Etc\/UTC)","modified_at_timestamp":1557763949,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":false,"words":0},{"translation_id":114013996,"key_id":20945747,"language_iso":"ru","translation":"\u0414\u043e\u0431\u0440\u043e - \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:05:07 (Etc\/UTC)","modified_at_timestamp":1557763507,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":false,"words":2},{"translation_id":114304537,"key_id":20988544,"language_iso":"ru","translation":"\u0412\u044b - \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c - \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e - \u0432\u044b\u0437\u043e\u0432\u0430","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 15:52:38 (Etc\/UTC)","modified_at_timestamp":1557762758,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":7}]}' - http_version: - recorded_at: Fri, 17 May 2019 16:46:08 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/all_webhooks_pagination.yml b/spec/fixtures/vcr_cassettes/all_webhooks_pagination.yml deleted file mode 100644 index f74c0e4..0000000 --- a/spec/fixtures/vcr_cassettes/all_webhooks_pagination.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 21 Aug 2019 12:03:28 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=0c19e8f391e53a063177f87f2b280fa4; expires=Sun, 20-Oct-2019 12:03:28 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '3' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhooks":[{"webhook_id":"c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d","url":"https:\/\/canihaz.hook","secret":"a62450cd9eeca8dfc84f3c0cf9b7a6a370267d6f","events":["project.snapshot","project.imported","project.exported","project.languages.added","project.language.removed","project.language.settings_changed","project.translation.updated"],"event_lang_map":[{"event":"project.translation.updated","lang_iso_codes":["sq","ar_001","bm","ca","custom_1","nl","en","en-us","f_over","ru","es"]}]}]}' - http_version: - recorded_at: Wed, 21 Aug 2019 12:03:23 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/another_key_segment.yml b/spec/fixtures/vcr_cassettes/another_key_segment.yml deleted file mode 100644 index 2380af3..0000000 --- a/spec/fixtures/vcr_cassettes/another_key_segment.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/4 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 17:25:00 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 9a1752ae-8dcd-4870-9ad5-b1bf4d970408 - expires: - - Wed, 15 Dec 2021 17:25:00 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":4,"language_iso":"en","value":"Chain - Updated","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-26 - 14:33:48 (Etc\/UTC)","modified_at_timestamp":1637937228,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":true,"words":2,"custom_translation_statuses":[]}}' - recorded_at: Wed, 15 Dec 2021 17:25:00 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/another_team_user.yml b/spec/fixtures/vcr_cassettes/another_team_user.yml deleted file mode 100644 index bf01300..0000000 --- a/spec/fixtures/vcr_cassettes/another_team_user.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/users/26265 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:36:01 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=e3d50ecfedc6ffb95c5f2032f9d0d956; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:36:01 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_user":{"user_id":26265,"email":"demo@test.com","fullname":"updated!","created_at":"2018-12-13 - 17:22:21 (Etc\/UTC)","role":"member"}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:35:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/another_team_user_group.yml b/spec/fixtures/vcr_cassettes/another_team_user_group.yml deleted file mode 100644 index 22637f6..0000000 --- a/spec/fixtures/vcr_cassettes/another_team_user_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/groups/689 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:00:23 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=539e7efbdac99aff6e0435881db459c3; expires=Thu, 18-Jul-2019 15:00:23 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["605317925c13e4ecb36a79.94825279"],"members":[35554]}' - http_version: - recorded_at: Sun, 19 May 2019 15:00:23 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/another_translation.yml b/spec/fixtures/vcr_cassettes/another_translation.yml deleted file mode 100644 index de5f071..0000000 --- a/spec/fixtures/vcr_cassettes/another_translation.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations/82070312 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:41:19 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d0d2bb59b9628e9e3cc4f42e1d541894; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:41:19 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translation":{"translation_id":82070312,"key_id":15814906,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:00:04 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:41:11 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/branch.yml b/spec/fixtures/vcr_cassettes/branch.yml deleted file mode 100644 index 5f2d64a..0000000 --- a/spec/fixtures/vcr_cassettes/branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/41302 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:39:55 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":41302,"name":"ruby-branch","created_at":"2019-10-30 - 14:24:41 (Etc\/UTC)","created_at_timestamp":1572445481,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:39:48 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/comment.yml b/spec/fixtures/vcr_cassettes/comment.yml deleted file mode 100644 index 5f23f6e..0000000 --- a/spec/fixtures/vcr_cassettes/comment.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15519786/comments/800746 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 16:58:57 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=ba2f4222776bc446ee77f5ff790e487c; expires=Tue, 16-Jul-2019 16:58:57 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comment":{"comment_id":800746,"key_id":15519786,"comment":"rspec - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-09 - 18:41:44 (Etc\/UTC)","added_at_timestamp":1544380904}}' - http_version: - recorded_at: Fri, 17 May 2019 16:58:45 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/contributor.yml b/spec/fixtures/vcr_cassettes/contributor.yml deleted file mode 100644 index 3f692a6..0000000 --- a/spec/fixtures/vcr_cassettes/contributor.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors/20181 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 17:02:46 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=c7e7b38b39cf48f8034a7a68b57c141f; expires=Tue, 16-Jul-2019 17:02:46 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributor":{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B","created_at":"2018-08-21 15:35:25 (Etc\/UTC)","created_at_timestamp":1534865725,"is_admin":true,"is_reviewer":true,"languages":[{"lang_id":803,"lang_iso":"sq","lang_name":"Albanian","is_writable":true},{"lang_id":731,"lang_iso":"ar_001","lang_name":"Arabic - (World)","is_writable":true},{"lang_id":934,"lang_iso":"bm","lang_name":"Bambara","is_writable":true},{"lang_id":764,"lang_iso":"ca","lang_name":"Catalan","is_writable":true},{"lang_id":601,"lang_iso":"zh_TW","lang_name":"Chinese - Traditional","is_writable":true},{"lang_id":10111,"lang_iso":"custom_111","lang_name":"Custom - Language 111","is_writable":true},{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":true},{"lang_id":1055,"lang_iso":"en-us","lang_name":"English - (United States)","is_writable":true},{"lang_id":673,"lang_iso":"f_over","lang_name":"fr - overriden","is_writable":true},{"lang_id":597,"lang_iso":"ru","lang_name":"Russian","is_writable":true},{"lang_id":1056,"lang_iso":"es","lang_name":"Spanish","is_writable":true}],"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"]}}' - http_version: - recorded_at: Fri, 17 May 2019 17:02:34 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_branch.yml b/spec/fixtures/vcr_cassettes/create_another_branch.yml deleted file mode 100644 index 9e747f8..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches - body: - encoding: UTF-8 - string: '{"name":"ruby-second-branch"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:47:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":41306,"name":"ruby-second-branch","created_at":"2019-10-30 - 14:47:07 (Etc\/UTC)","created_at_timestamp":1572446827,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:47:01 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_comment.yml b/spec/fixtures/vcr_cassettes/create_another_comment.yml deleted file mode 100644 index 577c5f9..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_comment.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15519786/comments - body: - encoding: UTF-8 - string: '{"comments":[{"comment":"chained comment"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 13 Dec 2018 17:59:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=03946d5443ef301b7bd52d4cc1ae675a; path=/; HttpOnly, locale=en_US; - expires=Sat, 12-Jan-2019 17:59:09 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comments":[{"comment_id":802031,"key_id":15519786,"comment":"chained - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-13 - 17:59:09 (Etc\/UTC)"}]}' - http_version: - recorded_at: Thu, 13 Dec 2018 17:59:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_contributor.yml b/spec/fixtures/vcr_cassettes/create_another_contributor.yml deleted file mode 100644 index 1848efa..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_contributor.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors - body: - encoding: UTF-8 - string: '{"contributors":[{"email":"demo@test.com","fullname":"chained","languages":[{"lang_iso":"en"}]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 13 Dec 2018 17:22:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=000af629446828cbfce93727bcd561a0; path=/; HttpOnly, locale=en_US; - expires=Sat, 12-Jan-2019 17:22:21 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributors":[{"user_id":26265,"email":"demo@test.com","fullname":"chained","created_at":"2018-12-13 - 17:22:21 (Etc\/UTC)","is_admin":false,"is_reviewer":false,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":false}],"admin_rights":[]}]}' - http_version: - recorded_at: Thu, 13 Dec 2018 17:22:15 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_key.yml b/spec/fixtures/vcr_cassettes/create_another_key.yml deleted file mode 100644 index 6c3cc23..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_key.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[{"key_name":"chained_k","platforms":["ios"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:03:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2f9c87c40f59d87f23e74a630ef8dc0b; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:03:58 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys":[{"key_id":15814946,"created_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","key_name":{"ios":"chained_k","android":"chained_k","web":"chained_k","other":"chained_k"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":82070423,"key_id":15814946,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82070422,"key_id":15814946,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82070424,"key_id":15814946,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}],"errors":[]}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:03:50 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_language.yml b/spec/fixtures/vcr_cassettes/create_another_language.yml deleted file mode 100644 index 7d2ed72..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_language.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages - body: - encoding: UTF-8 - string: '{"languages":[{"lang_iso":"ab","custom_name":"chained lang"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:49:05 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=8a38b558df91e37175c0a8843d1aee06; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:49:05 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","languages":[{"lang_id":894,"lang_iso":"ab","lang_name":"chained - lang","is_rtl":false,"plural_forms":null}],"errors":[]}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:48:58 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_project.yml b/spec/fixtures/vcr_cassettes/create_another_project.yml deleted file mode 100644 index e97738e..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_project.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects - body: - encoding: UTF-8 - string: '{"name":"chained proj"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:12:36 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3f4d81941c22cd64100e6ce6cae31291; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:12:35 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"186050335c13d673e9c638.47201999","name":"chained proj","description":"","created_at":"2018-12-14 - 16:12:35 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":0,"team":1,"base_words":0,"qa_issues":0,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0}]}}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:12:28 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_screenshot.yml b/spec/fixtures/vcr_cassettes/create_another_screenshot.yml deleted file mode 100644 index 10dad5f..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_screenshot.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots - body: - encoding: UTF-8 - string: '{"screenshots":[{"data":"data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAgCAIAAACw8uBbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAASdEVYdFNvZnR3YXJlAEdyZWVuc2hvdF5VCAUAAALkSURBVGhD7ZnNattAEIDzAO65r+CWtNCrqWUby01SHISVCqMeQujBhda0hlx8co6pDy0Un9pT60AuPRZKUK59APeNOquR5NXoZ7XyOnJgzYeQRrOzu99uJIj2Hjwycnj42PjZ7P1pH8DxSdOafflGIPlArf7u0rsem00Sz6d2uvCuLp7VJVuxvrzb8Od5C0uyAo/12SsxBkS2rcA7sP+0DdLhSOJZyHqvmRc/PPhJL5USavVX46tg5WSXbZO2Yu+abaC9V8Pe81ZHc/do79WgvVeDhPf351M4Xi6+8/AJmuIU9Q7S0TIvHSOaEhTyjtLRcmQ8imhKIPYeSUfL0XkU2QUaxtFy5MzNNomXQGGpHKTfq/fduzBzV7wT0QSSXBXaO4zbnJ+5/96+BpZ9NnoSwYktXWc1GkyMdsM8vhmxu3jJ8uORQIQ9wAo3tplVc94PGmIOX4pLCy5X7hHm+NXWQ/rYPEwtpRbp54x1MhR47w/iU2KC+NHj5EN9vi9/c0FDCGZEXKzJiuNi0F78nLPjId5aL5gbrD1bAFaWr0+ac0MKS4Wt+GQlZHr/1O39PThMAnHypiXgFotE+5fBRg4i3Mz5/Yh7MCXC54fntJfMnHXXE5etAZ8Zkdocb2ErPFdIpneim+elNcjxjgxtB6yxeYq9x+/m58elrHtJy9ncO/6x3qn3adckuhGIT6YzoXcApPhPidTnDD/J5N38/Ji1sJeUHCyF1qI1yM7kg8EAkptAFXnP968mfdRAZPThPJKe6h0er8EjIhwxzgSDyR3nzy32riORhBTfVLyX1By+1IrrETY+qZxsDu9YrL+NzQ4I3qu/ei8i6XDunr7hpad61xRB4N1sdX776uFoWzaRDpB8TUEE3gGn0wXpcCRxzSaIvWu2gfZeDdp7NWjv1aC9V4OEd/19VSFFvevvq2op5F1/X1WO2PvufF9tGOOFdz1zFPzDRGGpcki/V++Fd2Fmxd5bnf90pEGocXtKKgAAAABJRU5ErkJggg==","title":"chained - screen"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:56:38 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=12228216d04e451fa64fe332e60a0c0f; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:56:37 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshots":[{"screenshot_id":117310,"title":"chained - screen","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/88239e72fb0b79f59001e14f66844bae5e8c64ef.jpg","key_ids":[],"width":125,"height":32}],"errors":[]}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:56:30 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_snapshot.yml b/spec/fixtures/vcr_cassettes/create_another_snapshot.yml deleted file mode 100644 index 3acca47..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_snapshot.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots - body: - encoding: UTF-8 - string: '{"title":"chained"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:02:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=717efb03b618e8107584d62a58a0e9bc; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:02:08 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshot":{"snapshot_id":28533,"title":"chained","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2018-12-14 - 17:02:08 (Etc\/UTC)"}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:02:01 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_task.yml b/spec/fixtures/vcr_cassettes/create_another_task.yml deleted file mode 100644 index 925e2b4..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_task.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks - body: - encoding: UTF-8 - string: '{"title":"chained","keys":[15571976],"languages":[{"language_iso":"ru","users":["20181"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:25:25 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=614831ad371fe7f628ed10c13a553f22; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:25:24 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task":{"task_id":4622,"title":"chained","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-14 - 17:25:24 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"keys":[15571976],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:25:17 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_another_translation_status.yml b/spec/fixtures/vcr_cassettes/create_another_translation_status.yml deleted file mode 100644 index d908eb8..0000000 --- a/spec/fixtures/vcr_cassettes/create_another_translation_status.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses - body: - encoding: UTF-8 - string: '{"title":"rspec","color":"#c377e0"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:56:45 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=46606ebcb471e58b97674a8c48589a05; expires=Sun, 15-Sep-2019 16:56:45 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status":{"status_id":129,"title":"rspec","color":"#c377e0"}}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:56:19 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_branch.yml b/spec/fixtures/vcr_cassettes/create_branch.yml deleted file mode 100644 index 4ce72f6..0000000 --- a/spec/fixtures/vcr_cassettes/create_branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches - body: - encoding: UTF-8 - string: '{"name":"ruby-branch"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:24:41 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":41302,"name":"ruby-branch","created_at":"2019-10-30 - 14:24:41 (Etc\/UTC)","created_at_timestamp":1572445481,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:24:35 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_branch_to_merge.yml b/spec/fixtures/vcr_cassettes/create_branch_to_merge.yml deleted file mode 100644 index af75033..0000000 --- a/spec/fixtures/vcr_cassettes/create_branch_to_merge.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches - body: - encoding: UTF-8 - string: '{"name":"merge-me"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 13 Nov 2019 12:26:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":42301,"name":"merge-me","created_at":"2019-11-13 - 12:26:20 (Etc\/UTC)","created_at_timestamp":1573647980,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 13 Nov 2019 12:26:01 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_branch_to_merge2.yml b/spec/fixtures/vcr_cassettes/create_branch_to_merge2.yml deleted file mode 100644 index d75be32..0000000 --- a/spec/fixtures/vcr_cassettes/create_branch_to_merge2.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches - body: - encoding: UTF-8 - string: '{"name":"merge-me-plz"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 13 Nov 2019 12:40:47 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":42302,"name":"merge-me-plz","created_at":"2019-11-13 - 12:40:46 (Etc\/UTC)","created_at_timestamp":1573648846,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 13 Nov 2019 12:40:27 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_comments.yml b/spec/fixtures/vcr_cassettes/create_comments.yml deleted file mode 100644 index 7e7651a..0000000 --- a/spec/fixtures/vcr_cassettes/create_comments.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15305182/comments - body: - encoding: UTF-8 - string: '{"comments":[{"comment":"demo comment"},{"comment":"from rspec"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 15:48:51 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=4842555e336630c7587f3ec6997352e6; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 15:48:51 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comments":[{"comment_id":800631,"key_id":15305182,"comment":"demo - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"},{"comment_id":800632,"key_id":15305182,"comment":"from - rspec","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 15:48:44 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_contributors.yml b/spec/fixtures/vcr_cassettes/create_contributors.yml deleted file mode 100644 index 61775be..0000000 --- a/spec/fixtures/vcr_cassettes/create_contributors.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors - body: - encoding: UTF-8 - string: '{"contributors":[{"email":"rspec@test.com","fullname":"Rspec test","languages":[{"lang_iso":"en"},{"lang_iso":"ru"}]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:21:24 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=5d972f49937bae54df5045fe201edcff; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:21:24 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributors":[{"user_id":25953,"email":"rspec@test.com","fullname":"Rspec - test","created_at":"2018-12-07 18:21:24 (Etc\/UTC)","is_admin":false,"is_reviewer":false,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":false},{"lang_id":597,"lang_iso":"ru","lang_name":"Russian","is_writable":false}],"admin_rights":[]}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:21:17 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_keys.yml b/spec/fixtures/vcr_cassettes/create_keys.yml deleted file mode 100644 index c0c60a0..0000000 --- a/spec/fixtures/vcr_cassettes/create_keys.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[{"key_name":"rspec_k","platforms":["ios"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:02:49 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=36ce50060c31145f828b9560a03ba60c; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:02:48 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys":[{"key_id":15519770,"created_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","key_name":{"ios":"rspec_k","android":"rspec_k","web":"rspec_k","other":"rspec_k"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":79607515,"key_id":15519770,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607514,"key_id":15519770,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607516,"key_id":15519770,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}],"errors":[]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:02:48 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_keys_collection.yml b/spec/fixtures/vcr_cassettes/create_keys_collection.yml deleted file mode 100644 index 45d68f7..0000000 --- a/spec/fixtures/vcr_cassettes/create_keys_collection.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[{"key_name":"key_collect1","platforms":["ios"]},{"key_name":"key_collect2","platforms":["ios"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:51:02 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=05e17c0c06611f30ca1674c4b4d332d9; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:51:01 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys":[{"key_id":15815825,"created_at":"2018-12-14 - 17:51:01 (Etc\/UTC)","key_name":{"ios":"key_collect1","android":"key_collect1","web":"key_collect1","other":"key_collect1"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":82074428,"key_id":15815825,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:01 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82074427,"key_id":15815825,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:01 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82074429,"key_id":15815825,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:01 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""},{"key_id":15815826,"created_at":"2018-12-14 - 17:51:02 (Etc\/UTC)","key_name":{"ios":"key_collect2","android":"key_collect2","web":"key_collect2","other":"key_collect2"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":82074431,"key_id":15815826,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:02 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82074430,"key_id":15815826,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:02 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82074432,"key_id":15815826,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:51:02 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}],"errors":[]}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:50:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_languages.yml b/spec/fixtures/vcr_cassettes/create_languages.yml deleted file mode 100644 index c12bfe3..0000000 --- a/spec/fixtures/vcr_cassettes/create_languages.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages - body: - encoding: UTF-8 - string: '{"languages":[{"lang_iso":"ab","custom_name":"rspec lang"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:30:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=57f90642e5c694b3dbf5b6e2f0aa2d2a; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:30:58 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","languages":[{"lang_id":894,"lang_iso":"ab","lang_name":"rspec - lang","is_rtl":false,"plural_forms":null}],"errors":[]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:30:57 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_order.yml b/spec/fixtures/vcr_cassettes/create_order.yml deleted file mode 100644 index 4fdaa2f..0000000 --- a/spec/fixtures/vcr_cassettes/create_order.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/teams/176692/orders - body: - encoding: UTF-8 - string: '{"project_id":"803826145ba90b42d5d860.46800099","card_id":1774,"briefing":"Some - briefing","source_language_iso":"en","target_language_isos":["ru"],"keys":[15519786],"provider_slug":"gengo","translation_tier":"1"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 18:18:22 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=04baffacdcc657a5925d6149f2eff0af; expires=Sat, 18-May-2019 18:18:21 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"order_id":"201903198B2","project_id":"803826145ba90b42d5d860.46800099","card_id":1774,"status":"in - progress","created_at":"2019-03-19 18:18:21 (Etc\/UTC)","created_by":"20181","created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","target_language_isos":["ru"],"keys":[15519786],"source_words":{"ru":1},"provider_slug":"gengo","translation_tier":"1","translation_tier_name":"Native - speaker","briefing":"Some briefing","total":0.07,"dry_run":false}' - http_version: - recorded_at: Tue, 19 Mar 2019 18:18:20 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_order_dry_run.yml b/spec/fixtures/vcr_cassettes/create_order_dry_run.yml deleted file mode 100644 index 14fdc52..0000000 --- a/spec/fixtures/vcr_cassettes/create_order_dry_run.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/teams/176692/orders - body: - encoding: UTF-8 - string: '{"project_id":"803826145ba90b42d5d860.46800099","card_id":1774,"briefing":"Some - briefing","source_language_iso":"en","target_language_isos":["ru"],"keys":[74189435],"provider_slug":"gengo","translation_tier":"1","dry_run":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Feb 2021 15:30:01 GMT - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Fri, 26 Feb 2021 15:30:01 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"order_id":null,"project_id":"803826145ba90b42d5d860.46800099","branch":"master","card_id":1774,"payment_method":"credit_card","status":"draft","created_at":"2021-02-26 - 15:30:01 (Etc\/UTC)","created_at_timestamp":1614353401,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","target_language_isos":["ru"],"keys":["74189435"],"source_words":{"ru":2},"provider_slug":"gengo","translation_tier":"1","translation_tier_name":"Native - speaker","briefing":"Some briefing","total":0.14,"dry_run":true}' - recorded_at: Fri, 26 Feb 2021 15:30:01 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_screenshots.yml b/spec/fixtures/vcr_cassettes/create_screenshots.yml deleted file mode 100644 index 3a3c472..0000000 --- a/spec/fixtures/vcr_cassettes/create_screenshots.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots - body: - encoding: UTF-8 - string: '{"screenshots":[{"data":"data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAgCAIAAACw8uBbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAASdEVYdFNvZnR3YXJlAEdyZWVuc2hvdF5VCAUAAALkSURBVGhD7ZnNattAEIDzAO65r+CWtNCrqWUby01SHISVCqMeQujBhda0hlx8co6pDy0Un9pT60AuPRZKUK59APeNOquR5NXoZ7XyOnJgzYeQRrOzu99uJIj2Hjwycnj42PjZ7P1pH8DxSdOafflGIPlArf7u0rsem00Sz6d2uvCuLp7VJVuxvrzb8Od5C0uyAo/12SsxBkS2rcA7sP+0DdLhSOJZyHqvmRc/PPhJL5USavVX46tg5WSXbZO2Yu+abaC9V8Pe81ZHc/do79WgvVeDhPf351M4Xi6+8/AJmuIU9Q7S0TIvHSOaEhTyjtLRcmQ8imhKIPYeSUfL0XkU2QUaxtFy5MzNNomXQGGpHKTfq/fduzBzV7wT0QSSXBXaO4zbnJ+5/96+BpZ9NnoSwYktXWc1GkyMdsM8vhmxu3jJ8uORQIQ9wAo3tplVc94PGmIOX4pLCy5X7hHm+NXWQ/rYPEwtpRbp54x1MhR47w/iU2KC+NHj5EN9vi9/c0FDCGZEXKzJiuNi0F78nLPjId5aL5gbrD1bAFaWr0+ac0MKS4Wt+GQlZHr/1O39PThMAnHypiXgFotE+5fBRg4i3Mz5/Yh7MCXC54fntJfMnHXXE5etAZ8Zkdocb2ErPFdIpneim+elNcjxjgxtB6yxeYq9x+/m58elrHtJy9ncO/6x3qn3adckuhGIT6YzoXcApPhPidTnDD/J5N38/Ji1sJeUHCyF1qI1yM7kg8EAkptAFXnP968mfdRAZPThPJKe6h0er8EjIhwxzgSDyR3nzy32riORhBTfVLyX1By+1IrrETY+qZxsDu9YrL+NzQ4I3qu/ei8i6XDunr7hpad61xRB4N1sdX776uFoWzaRDpB8TUEE3gGn0wXpcCRxzSaIvWu2gfZeDdp7NWjv1aC9V4OEd/19VSFFvevvq2op5F1/X1WO2PvufF9tGOOFdz1zFPzDRGGpcki/V++Fd2Fmxd5bnf90pEGocXtKKgAAAABJRU5ErkJggg==","title":"rspec - screen"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:43:02 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=065e91abcd4572f4a1907c9f058ccfb4; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:43:02 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshots":[{"screenshot_id":115185,"title":"rspec - screen","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/29b5bdb9c85bc973e3ada5c7a2f10f762232e8ea.jpg","key_ids":[],"width":125,"height":32}],"errors":[]}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:43:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_snapshot.yml b/spec/fixtures/vcr_cassettes/create_snapshot.yml deleted file mode 100644 index aae2050..0000000 --- a/spec/fixtures/vcr_cassettes/create_snapshot.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots - body: - encoding: UTF-8 - string: '{"title":"test rspec"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:02:07 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3724c9065e2fd1cebf288f996549b10c; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:02:04 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshot":{"snapshot_id":27882,"title":"test - rspec","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2018-12-10 - 17:02:04 (Etc\/UTC)"}}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:02:07 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_snapshot_for_chained.yml b/spec/fixtures/vcr_cassettes/create_snapshot_for_chained.yml deleted file mode 100644 index 11c0758..0000000 --- a/spec/fixtures/vcr_cassettes/create_snapshot_for_chained.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots - body: - encoding: UTF-8 - string: '{"title":"chained rspec snap"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.10.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Mon, 11 May 2020 13:29:12 GMT - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Mon, 11 May 2020 13:29:12 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","snapshot":{"snapshot_id":243330,"title":"chained - rspec snap","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-11 - 13:29:12 (Etc\/UTC)","created_at_timestamp":1589203752}}' - http_version: null - recorded_at: Mon, 11 May 2020 13:29:12 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/create_task.yml b/spec/fixtures/vcr_cassettes/create_task.yml deleted file mode 100644 index b33e3c2..0000000 --- a/spec/fixtures/vcr_cassettes/create_task.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks - body: - encoding: UTF-8 - string: '{"title":"another rspec key","keys":[15571976],"languages":[{"language_iso":"ru","users":["20181"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:37:03 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f3dc32b48d48ad91fee799b3cd741975; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:37:02 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task":{"task_id":4387,"title":"another - rspec key","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-10 - 18:37:02 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[15571976],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:37:03 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_team_user_billing_details.yml b/spec/fixtures/vcr_cassettes/create_team_user_billing_details.yml deleted file mode 100644 index 1f4174a..0000000 --- a/spec/fixtures/vcr_cassettes/create_team_user_billing_details.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/teams/273879/billing_details - body: - encoding: UTF-8 - string: '{"billing_email":"ruby@example.com","country_code":"LV","zip":"LV-1111"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 19:38:20 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - e0200745-acdf-4e1c-a6e9-8bc7558dcc1f - expires: - - Wed, 15 Dec 2021 19:38:20 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"company":"","address1":"","address2":"","city":"","zip":"LV-1111","phone":"","vatnumber":null,"country_code":"LV","billing_email":"ruby@example.com","state_code":""}' - recorded_at: Wed, 15 Dec 2021 19:38:21 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_team_user_group.yml b/spec/fixtures/vcr_cassettes/create_team_user_group.yml deleted file mode 100644 index a6079b6..0000000 --- a/spec/fixtures/vcr_cassettes/create_team_user_group.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/teams/176692/groups - body: - encoding: UTF-8 - string: '{"name":"RSpec group","is_reviewer":false,"is_admin":false,"languages":{"reference":[],"contributable":[640]}}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Jun 2020 13:08:21 GMT - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 26 Jun 2020 13:08:21 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":2500,"name":"RSpec group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":true}]},"created_at":"2020-06-26 - 13:08:21 (Etc\/UTC)","created_at_timestamp":1593176901,"team_id":176692,"projects":[],"members":[]}}' - recorded_at: Fri, 26 Jun 2020 13:08:11 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_translation_status.yml b/spec/fixtures/vcr_cassettes/create_translation_status.yml deleted file mode 100644 index e750a51..0000000 --- a/spec/fixtures/vcr_cassettes/create_translation_status.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses - body: - encoding: UTF-8 - string: '{"title":"Reviewed by doctors","color":"#f2d600"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:22:53 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=30e45c2f866c05f09ac989bc190aeae5; expires=Sun, 15-Sep-2019 16:22:52 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status":{"status_id":126,"title":"Reviewed - by doctors","color":"#f2d600"}}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:22:26 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/create_webhook.yml b/spec/fixtures/vcr_cassettes/create_webhook.yml deleted file mode 100644 index e82c06a..0000000 --- a/spec/fixtures/vcr_cassettes/create_webhook.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks - body: - encoding: UTF-8 - string: '{"url":"http://thatz.ahook","events":["project.imported","project.exported"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 19 Aug 2019 19:59:25 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=cb3f0f2c045a7eae8591e758e0cae24c; expires=Fri, 18-Oct-2019 19:59:25 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhook":{"webhook_id":"b345ccc6499920c490e8f4fe9487b1378dbf1dbf","url":"http:\/\/thatz.ahook","secret":"fd3a2ceab9e2e9d4f68f40b7c199a273e19492f8","events":["project.imported","project.exported"],"event_lang_map":[]}}' - http_version: - recorded_at: Mon, 19 Aug 2019 19:59:25 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/created_team_user_group.yml b/spec/fixtures/vcr_cassettes/created_team_user_group.yml deleted file mode 100644 index 34f0323..0000000 --- a/spec/fixtures/vcr_cassettes/created_team_user_group.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/groups/2500 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Jun 2020 13:08:21 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 26 Jun 2020 13:08:21 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"group_id":2500,"name":"RSpec group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":true}]},"created_at":"2020-06-26 - 13:08:21 (Etc\/UTC)","created_at_timestamp":1593176901,"team_id":176692,"projects":[],"members":[]}' - recorded_at: Fri, 26 Jun 2020 13:08:12 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_all_keys_chained.yml b/spec/fixtures/vcr_cassettes/delete_all_keys_chained.yml deleted file mode 100644 index 71aec40..0000000 --- a/spec/fixtures/vcr_cassettes/delete_all_keys_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[15815825,15815826]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:51:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=1c162687cf62b2f4c87f1195c278ccd0; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:51:08 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys_removed":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:51:00 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_another_translation_status.yml b/spec/fixtures/vcr_cassettes/delete_another_translation_status.yml deleted file mode 100644 index 2ecc938..0000000 --- a/spec/fixtures/vcr_cassettes/delete_another_translation_status.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/129 - body: - encoding: UTF-8 - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:57:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3a994eb5ed458b40f744e0f0e6603801; expires=Sun, 15-Sep-2019 16:57:08 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status_deleted":true}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:56:42 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_comment.yml b/spec/fixtures/vcr_cassettes/delete_comment.yml deleted file mode 100644 index 6380a65..0000000 --- a/spec/fixtures/vcr_cassettes/delete_comment.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15305182/comments/767938 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:05:49 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=eda035966f7df3f6294e2c49ae00ed8d; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:05:49 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comment_deleted":true}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:05:41 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_comment_chained.yml b/spec/fixtures/vcr_cassettes/delete_comment_chained.yml deleted file mode 100644 index 3d9153d..0000000 --- a/spec/fixtures/vcr_cassettes/delete_comment_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15519786/comments/802031 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 13 Dec 2018 17:59:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=021e8bbd7276ba228cfd5f1e3c3f6a2e; path=/; HttpOnly, locale=en_US; - expires=Sat, 12-Jan-2019 17:59:09 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comment_deleted":true}' - http_version: - recorded_at: Thu, 13 Dec 2018 17:59:03 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_contributor.yml b/spec/fixtures/vcr_cassettes/delete_contributor.yml deleted file mode 100644 index 1457241..0000000 --- a/spec/fixtures/vcr_cassettes/delete_contributor.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors/25953 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:26:04 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2121983539ae118e19f6689fb07c729e; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:26:04 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributor_deleted":true}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:25:57 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_contributor_chained.yml b/spec/fixtures/vcr_cassettes/delete_contributor_chained.yml deleted file mode 100644 index 507958a..0000000 --- a/spec/fixtures/vcr_cassettes/delete_contributor_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors/26265 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 13 Dec 2018 17:29:54 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=ca4e19fce8b907c219637f1eb5045253; path=/; HttpOnly, locale=en_US; - expires=Sat, 12-Jan-2019 17:29:54 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributor_deleted":true}' - http_version: - recorded_at: Thu, 13 Dec 2018 17:29:48 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_key.yml b/spec/fixtures/vcr_cassettes/delete_key.yml deleted file mode 100644 index 2927df0..0000000 --- a/spec/fixtures/vcr_cassettes/delete_key.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15519771 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:13:32 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=b9aea5c4fcd9bcc6c60f186c58785823; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:13:31 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","key_removed":true}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:13:31 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_key_chained.yml b/spec/fixtures/vcr_cassettes/delete_key_chained.yml deleted file mode 100644 index d6393b4..0000000 --- a/spec/fixtures/vcr_cassettes/delete_key_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15814946 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:06:05 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=667c00fa19fc40575a96d53f07506ccd; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:06:05 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","key_removed":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:05:57 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_keys.yml b/spec/fixtures/vcr_cassettes/delete_keys.yml deleted file mode 100644 index af8ebd0..0000000 --- a/spec/fixtures/vcr_cassettes/delete_keys.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[15519770,15305182]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:15:47 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=941d820cc91a17d67d56290aac7983ee; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:15:47 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys_removed":true}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:15:47 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_language.yml b/spec/fixtures/vcr_cassettes/delete_language.yml deleted file mode 100644 index 0f7eb17..0000000 --- a/spec/fixtures/vcr_cassettes/delete_language.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages/894 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:33:33 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=09313a0193da898fb787e94d2358cc51; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:33:33 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","language_deleted":true}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:33:33 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_language_chained.yml b/spec/fixtures/vcr_cassettes/delete_language_chained.yml deleted file mode 100644 index 9443d71..0000000 --- a/spec/fixtures/vcr_cassettes/delete_language_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages/894 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:49:20 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=88deee6502551e6c5dde73ad05f99566; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:49:20 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","language_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:49:13 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_project.yml b/spec/fixtures/vcr_cassettes/delete_project.yml deleted file mode 100644 index 95a7028..0000000 --- a/spec/fixtures/vcr_cassettes/delete_project.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/572222075c0953fd70d492.30502628 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 06 Dec 2018 17:08:13 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=0e7e9dc29edb57a2f4b4314e542649e6; path=/; HttpOnly, locale=en_US; - expires=Sat, 05-Jan-2019 17:08:13 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"572222075c0953fd70d492.30502628","project_deleted":true}' - http_version: - recorded_at: Thu, 06 Dec 2018 17:08:07 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_project_chained.yml b/spec/fixtures/vcr_cassettes/delete_project_chained.yml deleted file mode 100644 index 010cfdb..0000000 --- a/spec/fixtures/vcr_cassettes/delete_project_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/186050335c13d673e9c638.47201999 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:39:47 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=4218389611b4fd4ac13d33ec7b9d2496; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:39:47 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"186050335c13d673e9c638.47201999","project_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:39:40 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_restored_project.yml b/spec/fixtures/vcr_cassettes/delete_restored_project.yml deleted file mode 100644 index 5a36e66..0000000 --- a/spec/fixtures/vcr_cassettes/delete_restored_project.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/481179005eb95329728d52.65842327 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.10.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Mon, 11 May 2020 13:31:28 GMT - pragma: - - no-cache - allow: - - GET, PUT - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Mon, 11 May 2020 13:31:28 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"481179005eb95329728d52.65842327","project_deleted":true}' - http_version: null - recorded_at: Mon, 11 May 2020 13:31:28 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/delete_screenshot.yml b/spec/fixtures/vcr_cassettes/delete_screenshot.yml deleted file mode 100644 index 116173a..0000000 --- a/spec/fixtures/vcr_cassettes/delete_screenshot.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots/115185 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:58:34 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f6f141bd4f28728f3e2716e440e65548; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:58:34 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshot_deleted":true}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:58:34 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_screenshot_chained.yml b/spec/fixtures/vcr_cassettes/delete_screenshot_chained.yml deleted file mode 100644 index 96d1030..0000000 --- a/spec/fixtures/vcr_cassettes/delete_screenshot_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots/117310 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:57:55 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=330ec0baf930735896df9007a103b2cc; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:57:54 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshot_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:57:47 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_snapshot.yml b/spec/fixtures/vcr_cassettes/delete_snapshot.yml deleted file mode 100644 index cef7787..0000000 --- a/spec/fixtures/vcr_cassettes/delete_snapshot.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots/27881 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:12:16 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d5eba8102665cd1432e544e11c645fb3; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:12:15 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshot_deleted":true}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:12:15 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_snapshot_chained.yml b/spec/fixtures/vcr_cassettes/delete_snapshot_chained.yml deleted file mode 100644 index 315ecc8..0000000 --- a/spec/fixtures/vcr_cassettes/delete_snapshot_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots/28533 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:15:19 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=e4dea52ef7d30e0fefc24cee59d0e3c8; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:15:18 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","snapshot_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:15:11 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_task.yml b/spec/fixtures/vcr_cassettes/delete_task.yml deleted file mode 100644 index 808b238..0000000 --- a/spec/fixtures/vcr_cassettes/delete_task.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks/4387 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:48:52 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=51e1a432398aea06d66c26590d34ff66; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:48:51 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task_deleted":true}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:48:52 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_task_chained.yml b/spec/fixtures/vcr_cassettes/delete_task_chained.yml deleted file mode 100644 index 0dab62b..0000000 --- a/spec/fixtures/vcr_cassettes/delete_task_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks/4622 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:26:14 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2eb81f491dc3a6e7571cbd9d14300241; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:26:13 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:26:06 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_team_user.yml b/spec/fixtures/vcr_cassettes/delete_team_user.yml deleted file mode 100644 index 57bb2e3..0000000 --- a/spec/fixtures/vcr_cassettes/delete_team_user.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/teams/176692/users/25953 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:56:17 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=b72d385d55a84592a2e3daa1ea3c465c; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:56:17 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_user_deleted":true}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:56:16 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/delete_team_user_chained.yml b/spec/fixtures/vcr_cassettes/delete_team_user_chained.yml deleted file mode 100644 index 3b96458..0000000 --- a/spec/fixtures/vcr_cassettes/delete_team_user_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/teams/176692/users/26265 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:36:13 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d7a3d91a93fd3a5ebfd9e76100019568; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:36:13 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_user_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:36:06 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_another_branch.yml b/spec/fixtures/vcr_cassettes/destroy_another_branch.yml deleted file mode 100644 index 4692cc7..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_another_branch.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/41306 - body: - encoding: UTF-8 - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:47:10 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch_deleted":true}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:47:04 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_another_team_user_group.yml b/spec/fixtures/vcr_cassettes/destroy_another_team_user_group.yml deleted file mode 100644 index dc105a9..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_another_team_user_group.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/teams/176692/groups/689 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:06:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=997d4b83e5f54a45c30d6e0efbc21088; expires=Thu, 18-Jul-2019 15:06:58 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group_deleted":true}' - http_version: - recorded_at: Sun, 19 May 2019 15:06:58 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_branch.yml b/spec/fixtures/vcr_cassettes/destroy_branch.yml deleted file mode 100644 index e4e89b8..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_branch.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/41302 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:44:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch_deleted":true}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:44:02 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_file.yml b/spec/fixtures/vcr_cassettes/destroy_file.yml deleted file mode 100644 index 5cf3b3e..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_file.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/507504186242fccb32f015.15252556/files/1161428 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/6.0.0 - Accept-Encoding: - - gzip,deflate,br - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - date: - - Wed, 27 Jul 2022 14:15:29 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - server: - - nginx - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - a99169ac-527d-4192-852b-3adfae57aed3 - expires: - - Wed, 27 Jul 2022 14:15:29 GMT - set-cookie: - - PHPSESSID=deleted; expires=Tue, 27-Jul-2021 14:15:28 GMT; Max-Age=0; path=/; - httponly - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA6tWKijKz0pNLonPTFGyUjI1MDc1MDG0MDMyMUpLTk4yNkozMDTVMzQ1AkJTMyUdpbTMnNT4lNSc1JJUoIaSotLUWgDICqUkRAAAAA== - recorded_at: Wed, 27 Jul 2022 14:15:28 GMT -recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_payment_card.yml b/spec/fixtures/vcr_cassettes/destroy_payment_card.yml deleted file mode 100644 index 1d12df0..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_payment_card.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/payment_cards/1773 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:44:49 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=00cb711f8f38841fc9e404d14d455ee0; expires=Sat, 18-May-2019 17:44:46 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"card_id":1773,"card_deleted":true}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:44:47 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_team_user_group.yml b/spec/fixtures/vcr_cassettes/destroy_team_user_group.yml deleted file mode 100644 index faae5d9..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_team_user_group.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/teams/176692/groups/690 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:12:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=14221c1b2038cf285a35d61092b92e7f; expires=Thu, 18-Jul-2019 14:12:09 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group_deleted":true}' - http_version: - recorded_at: Sun, 19 May 2019 14:12:09 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_translation_status.yml b/spec/fixtures/vcr_cassettes/destroy_translation_status.yml deleted file mode 100644 index 9fd8bcb..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_translation_status.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/126 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:36:10 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a39bce76d6824ab4810b9164c5c26858; expires=Sun, 15-Sep-2019 16:36:10 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status_deleted":true}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:35:44 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/destroy_webhook.yml b/spec/fixtures/vcr_cassettes/destroy_webhook.yml deleted file mode 100644 index d63921d..0000000 --- a/spec/fixtures/vcr_cassettes/destroy_webhook.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/b345ccc6499920c490e8f4fe9487b1378dbf1dbf - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 19 Aug 2019 20:05:19 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=9a84179bb1b4e3b11afb7689e08b3dfe; expires=Fri, 18-Oct-2019 20:05:19 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhook_deleted":true}' - http_version: - recorded_at: Mon, 19 Aug 2019 20:05:19 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/download_files.yml b/spec/fixtures/vcr_cassettes/download_files.yml deleted file mode 100644 index 57d9178..0000000 --- a/spec/fixtures/vcr_cassettes/download_files.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/files/download - body: - encoding: UTF-8 - string: '{"format":"po","original_filenames":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 17:35:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=7cd6804ece709796da8cee5817a165c1; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 17:35:21 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","bundle_url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/export\/803826145ba90b42d5d860.46800099\/1544376921\/demo_phoenix-locale.zip"}' - http_version: - recorded_at: Sun, 09 Dec 2018 17:35:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/empty_project.yml b/spec/fixtures/vcr_cassettes/empty_project.yml deleted file mode 100644 index 805bc43..0000000 --- a/spec/fixtures/vcr_cassettes/empty_project.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/572222075c0953fd70d492.30502628/empty - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 06 Dec 2018 17:06:27 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=fb5644156ad61a410327718a041c2a05; path=/; HttpOnly, locale=en_US; - expires=Sat, 05-Jan-2019 17:06:27 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"572222075c0953fd70d492.30502628","keys_deleted":true}' - http_version: - recorded_at: Thu, 06 Dec 2018 17:06:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/empty_project_chained.yml b/spec/fixtures/vcr_cassettes/empty_project_chained.yml deleted file mode 100644 index 5707d76..0000000 --- a/spec/fixtures/vcr_cassettes/empty_project_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/186050335c13d673e9c638.47201999/empty - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:38:41 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=91041b37cf66981bea5da1be096518b4; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:38:41 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"186050335c13d673e9c638.47201999","keys_deleted":true}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:38:33 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/error_invalid_token.yml b/spec/fixtures/vcr_cassettes/error_invalid_token.yml deleted file mode 100644 index fb089f8..0000000 --- a/spec/fixtures/vcr_cassettes/error_invalid_token.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - invalid - response: - status: - code: 400 - message: Bad Request - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 19:16:10 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - set-cookie: - - PHPSESSID=349aebdef554caf2cd1030cbe161264f; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 19:16:10 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - body: - encoding: UTF-8 - string: '{"error":{"message":"Invalid `X-Api-Token` header","code":400}}' - http_version: - recorded_at: Mon, 10 Dec 2018 19:16:10 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/error_not_found.yml b/spec/fixtures/vcr_cassettes/error_not_found.yml deleted file mode 100644 index 44889af..0000000 --- a/spec/fixtures/vcr_cassettes/error_not_found.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/invalid_path - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 404 - message: Not Found - headers: - server: - - nginx - date: - - Mon, 03 Dec 2018 19:26:00 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2f4677fe5833431bca5b23908df3de17; path=/; HttpOnly, locale=en_US; - expires=Wed, 02-Jan-2019 19:26:00 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - body: - encoding: ASCII-8BIT - string: '{"error":{"message":"Not Found","code":404}}' - http_version: - recorded_at: Mon, 03 Dec 2018 19:26:01 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/error_unknown_code.yml b/spec/fixtures/vcr_cassettes/error_unknown_code.yml deleted file mode 100644 index 86dc558..0000000 --- a/spec/fixtures/vcr_cassettes/error_unknown_code.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - invalid - response: - status: - code: 413 - message: Payload Too Large - headers: - server: - - nginx - date: - - Mon, 10 May 2020 19:16:10 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - set-cookie: - - PHPSESSID=349aebdef554caf2cd1030cbe161264f; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 19:16:10 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - body: - encoding: UTF-8 - string: '{"error":{"message":"Payload Too Large","code":413}}' - http_version: - recorded_at: Mon, 10 May 2020 19:16:10 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/files.yml b/spec/fixtures/vcr_cassettes/files.yml deleted file mode 100644 index 249e06a..0000000 --- a/spec/fixtures/vcr_cassettes/files.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/files - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/6.0.0 - Accept-Encoding: - - gzip,deflate,br - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - date: - - Wed, 27 Jul 2022 14:05:25 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - server: - - nginx - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - x-pagination-total-count: - - '5' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - b7149d41-0345-4a1f-8c6d-e86a1ec690d0 - expires: - - Wed, 27 Jul 2022 14:05:25 GMT - set-cookie: - - PHPSESSID=deleted; expires=Tue, 27-Jul-2021 14:05:24 GMT; Max-Age=0; path=/; - httponly - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA2XOPQ/CIBAG4P9C4qYNUCDQzcmYGB0cjblQitpqqSl0aJr+d+vHIOl2ubvn3hvQs20qawKUBcqQxKmkgjCea4VzRgteSIETJiTGWCm0RHmrnblNq7X2wbZT51I+rEfZafhUnzuSMCa+E6drO20vduv9BrbHwyLp68ek7rYH03QuoEyIcfmHU8o5oZGue3invG8llW9c7EnEKVeK4Ii3/mkNaN87M0+fa6wiHawPPzzPTqPsFYkkQOe09+XV2QIgfpqN5/EFMCMSmX0BAAA= - recorded_at: Wed, 27 Jul 2022 14:05:24 GMT -recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/vcr_cassettes/jwt.yml b/spec/fixtures/vcr_cassettes/jwt.yml deleted file mode 100644 index d07911d..0000000 --- a/spec/fixtures/vcr_cassettes/jwt.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/2273827860c1e2473eb195.11207948/tokens - body: - encoding: UTF-8 - string: '{"service":"ota"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/7.1.1 - x-api-token: - - "" - Accept-Encoding: - - gzip,deflate,br - response: - status: - code: 200 - message: OK - headers: - date: - - Wed, 11 Jan 2023 16:03:31 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - server: - - nginx - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - f7439f1c-3351-476c-96ef-d393928580c7 - expires: - - Wed, 11 Jan 2023 16:03:31 GMT - set-cookie: - - PHPSESSID=deleted; expires=Tue, 11-Jan-2022 16:03:30 GMT; Max-Age=0; path=/; - httponly - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEAxWQybKaQABF/+XtTdFMSnYMAg0yaWMDGwpBxpZJGVP595jlPXXO5v75qZfPz++f52ZQz0CsnMow78CrLrJRPrT0/775OwR2ZQi/vhJI6ft2w17l1HCxULF+xSV9CUOEbSrdII+Zd5Vp9/LhkwbW3WrvIe0g+IattD3onoTM1YhkyMMabvZusVadsnYt1Rb2N1tJ9wjD1UH+ZKHzZikpZytFld+pN3zd2fTbWShkrN0DX75aOvXrbp5jQmUjVGokmtpjDVozSjxHR6Wmlke/aZDOtyFiGtFzXrvytAkrOYbeJkSV56inMRiknmRVJr6SODhjQc5DcNbNqHzyQtAEXQLk5WC4tDq2bMsR+yqbFLcDbL2vp/mTLVCgqKgS3+hWxM9XXyRTn66tmvPzRAYVjKSvu80cMb4eYQZ3jhXsgypvbrX1HUQSjuFyLrwqfXr35KKtrWX5egBsi+v5g65qQO81KMWf4QC+cI12ws0PnIrbGxpZ3qElL8RWk29TziqCNQzH/MZuhEv1RP3w76cWs+UpCnPLOoIA8KdLJTsIj4i0n+FDzwBgPVcOToDmcWM1BYkyY14lhXPpwB2HF9TzKRPlSTa86ROl8axwmnZSp3sZpVRHPYy19+KGmUvjxO6Lcsh84dRf0hVbuRC+unxHLUqm70d6Sw4NJXEyjI4T0fUmCkWDYeQbU+OLnNX+hxOI2DAi/cg4rtvvjkeRgGh0kkcoatwjaaFvdu9UVF2TZMgQ9CGmJ9s+ESWnUVxdI45QhVH4LtlOU/HA5HM+04Cor1bqUjHIF8yDOanPb0yLQas68JUC9nY07aZtDp27z6l5EqrPMqrS7GGXNwbpmFDb0JqBf1165RbdNkpy/TGnvOQZhaXfhO3KcGsXAIKLg28osnXp8Pgw2pGtgGvqSVtmNlOdnl1XbO+fv/8ALi7W0G4DAAA= - recorded_at: Wed, 11 Jan 2023 16:03:30 GMT -recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/vcr_cassettes/key.yml b/spec/fixtures/vcr_cassettes/key.yml deleted file mode 100644 index 35af960..0000000 --- a/spec/fixtures/vcr_cassettes/key.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/44596066?disable_references=0 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Jun 2020 11:47:26 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 26 Jun 2020 11:47:26 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","key":{"key_id":44596066,"created_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","created_at_timestamp":1589196033,"key_name":{"ios":"static_pages:index:welcome","android":"static_pages:index:welcome","web":"static_pages:index:welcome","other":"static_pages:index:welcome"},"filenames":{"ios":"","android":"","web":"%LANG_ISO%.yml","other":""},"description":"","platforms":["web"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":304581295,"key_id":44596066,"language_iso":"ru","translation":"\u0414\u043e\u0431\u0440\u043e - \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c!","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","modified_at_timestamp":1589539482,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":2,"custom_translation_statuses":[]},{"translation_id":304581285,"key_id":44596066,"language_iso":"en","translation":"Welcome!","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":1,"custom_translation_statuses":[]},{"translation_id":304581294,"key_id":44596066,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581289,"key_id":44596066,"language_iso":"ar_001","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581287,"key_id":44596066,"language_iso":"nl","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581292,"key_id":44596066,"language_iso":"ca","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581290,"key_id":44596066,"language_iso":"sq","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581291,"key_id":44596066,"language_iso":"bm","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581293,"key_id":44596066,"language_iso":"en-us","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581288,"key_id":44596066,"language_iso":"es","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]},{"translation_id":304581286,"key_id":44596066,"language_iso":"custom_1","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0,"custom_translation_statuses":[]}],"is_plural":false,"plural_name":"","is_hidden":true,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":"","modified_at":"2020-05-11 - 11:20:33 (Etc\/UTC)","modified_at_timestamp":1589196033,"translations_modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","translations_modified_at_timestamp":1589539482}}' - recorded_at: Fri, 26 Jun 2020 11:47:17 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/key_segment.yml b/spec/fixtures/vcr_cassettes/key_segment.yml deleted file mode 100644 index 0612816..0000000 --- a/spec/fixtures/vcr_cassettes/key_segment.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 22 Nov 2021 16:46:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Mon, 22 Nov 2021 16:46:58 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":2,"language_iso":"en","value":"This - is just a simple text.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:46:50 (Etc\/UTC)","modified_at_timestamp":1637599610,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":6,"custom_translation_statuses":[{"status_id":5734,"title":"context","color":"#61bd4f"}]}}' - recorded_at: Mon, 22 Nov 2021 16:46:58 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/key_segment_params.yml b/spec/fixtures/vcr_cassettes/key_segment_params.yml deleted file mode 100644 index 464de8a..0000000 --- a/spec/fixtures/vcr_cassettes/key_segment_params.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/2?disable_references=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 22 Nov 2021 16:51:33 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Mon, 22 Nov 2021 16:51:33 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":2,"language_iso":"en","value":"This - is just a simple text.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:46:50 (Etc\/UTC)","modified_at_timestamp":1637599610,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":6,"custom_translation_statuses":[{"status_id":5734,"title":"context","color":"#61bd4f"}]}}' - recorded_at: Mon, 22 Nov 2021 16:51:33 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/language.yml b/spec/fixtures/vcr_cassettes/language.yml deleted file mode 100644 index 150a120..0000000 --- a/spec/fixtures/vcr_cassettes/language.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages/640 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:29:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d85b390331dc24f03e6d53bd98db6295; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:29:09 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","language":{"lang_id":640,"lang_iso":"en","lang_name":"English","is_rtl":false,"plural_forms":["one","other"]}}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:29:08 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/merge_branch.yml b/spec/fixtures/vcr_cassettes/merge_branch.yml deleted file mode 100644 index 1e6ecf1..0000000 --- a/spec/fixtures/vcr_cassettes/merge_branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/42301/merge - body: - encoding: UTF-8 - string: '{"force_conflict_resolve_using":"master"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 13 Nov 2019 12:37:45 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch_merged":true,"branch":{"branch_id":42301,"name":"merge-me","created_at":"2019-11-13 - 12:26:20 (Etc\/UTC)","created_at_timestamp":1573647980,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 13 Nov 2019 12:37:26 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/merge_branch_chained.yml b/spec/fixtures/vcr_cassettes/merge_branch_chained.yml deleted file mode 100644 index 2e64a7f..0000000 --- a/spec/fixtures/vcr_cassettes/merge_branch_chained.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/42302/merge - body: - encoding: UTF-8 - string: '{"force_conflict_resolve_using":"master"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 13 Nov 2019 12:43:19 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch_merged":true,"branch":{"branch_id":42302,"name":"merge-me-plz","created_at":"2019-11-13 - 12:40:46 (Etc\/UTC)","created_at_timestamp":1573648846,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 13 Nov 2019 12:43:00 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/new_payment_card.yml b/spec/fixtures/vcr_cassettes/new_payment_card.yml deleted file mode 100644 index 6d60574..0000000 --- a/spec/fixtures/vcr_cassettes/new_payment_card.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/payment_cards - body: - encoding: UTF-8 - string: '{"number":"4242424242424242","cvc":"123","exp_month":1,"exp_year":2030}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:01:22 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=11254382f4f05968d7ba0b4462a04b2e; expires=Sat, 18-May-2019 17:01:19 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"card_id":1773,"last4":"4242","brand":"Visa","created_at":"2019-03-19 - 17:01:22 (Etc\/UTC)"}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:01:20 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/new_project.yml b/spec/fixtures/vcr_cassettes/new_project.yml deleted file mode 100644 index 5dd911a..0000000 --- a/spec/fixtures/vcr_cassettes/new_project.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects - body: - encoding: UTF-8 - string: '{"name":"rspec proj","description":"demo project for rspec"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 06 Dec 2018 16:53:17 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=ba22be0ddc70690c231abab8ec4bf2f8; path=/; HttpOnly, locale=en_US; - expires=Sat, 05-Jan-2019 16:53:17 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"572222075c0953fd70d492.30502628","name":"rspec proj","description":"demo - project for rspec","created_at":"2018-12-06 17:53:17 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":0,"team":1,"base_words":0,"qa_issues":0,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0}]}}' - http_version: - recorded_at: Thu, 06 Dec 2018 16:53:11 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/oauth2/new_project.yml b/spec/fixtures/vcr_cassettes/oauth2/new_project.yml deleted file mode 100644 index 809c4f2..0000000 --- a/spec/fixtures/vcr_cassettes/oauth2/new_project.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects - body: - encoding: UTF-8 - string: '{"name":"OAuth 2 project","description":"Via OAuth 2"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - Authorization: - - Bearer - Accept-Encoding: - - gzip,deflate,br - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 03 Feb 2022 17:49:13 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 2d61d683-6a18-45e0-8327-fd84e1e3eee0 - expires: - - Thu, 03 Feb 2022 17:49:13 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA31TTY/TMBD9K1VOIC1L0rQJzQmEOHMBLoCsiTNJzfoj2JNWZdX/zjjpNtmutFIunvfmzeQ9+zHpvfuDkoRqkiopyu2mzLdlkbUy2+52m7qBsrjPN2mZF1mW3F3pdOqRG7SToNU/IOWsaJXGwBwLJmJfPw20X61XlwkMNBikV30kM/5DwerCYUx6BMJGADG0Ttfrdyl/+Sorq82uyvLVmy8kf73//u3z22dsQcpgIDB9UmXFJt9l6Xabz3r1KanWafYhW5YEGlCaB9Wu8e6gwkdekpyN1XvpDE8gBDOakpVFsVvfJTUEFBpsN0CHI1Js0hfl4FgVLQsEJFK2C0n1mPToRa+BWueNeMCTiBYx0oIOeJd4PCg8MjmpyA9cGPqDi81XBgzkBLmu0ygGe0CvWoWc2ER3bauVRUEebOAxo78X7TgNGzWpTXRlR7YBub/p4pUmSs1KEZ03CNgZtPRcXA6BnFnOFRwFDWHxc69wBGjtjsIMmlSv+c6MO5/ZuzgnkJKTe951HkNgAwg4NXad/2p5jGFxzJc0js433Mi0vyBUCAMuuddaDMY6EpP70U3uWJrLx9CjZrM60XkwBvzIUVY6G3g/9iPGKnHvdIN+mvkM3ZOZFm5U26KPDXYwNV8H14rB66llBq8ljdDEuce9Igw9zxhHc8Jq3OemPivM8uMdF9A00buxe2a9hnH28gHptmUSvlTdUPNNnPdin6QCvXTjYmcN/GYkP+yFLCf89JBY7+fj9TQ/qyec87u+KH6j4z0YlceQ+UaIhvH0/Pt8/g+5s5sqzAQAAA== - recorded_at: Thu, 03 Feb 2022 17:49:13 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/oauth2/refresh.yml b/spec/fixtures/vcr_cassettes/oauth2/refresh.yml deleted file mode 100644 index 0887e81..0000000 --- a/spec/fixtures/vcr_cassettes/oauth2/refresh.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://app.lokalise.com/oauth2/token - body: - encoding: UTF-8 - string: '{"client_id":"","client_secret":"","refresh_token":"","grant_type":"refresh_token"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 03 Feb 2022 17:48:33 GMT - content-type: - - application/json - vary: - - Accept-Encoding - expires: - - Thu, 19 Nov 1981 08:52:00 GMT, Thu, 03 Feb 2022 17:48:33 GMT - cache-control: - - no-store, no-cache, must-revalidate, max-age=0, must-revalidate, private - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - fbc7b540-024d-40b8-98eb-3125f34d61a0 - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: '{"access_token":"fake","expires_in":3600,"scope":"write_projects - write_team_groups write_tasks","token_type":"Bearer"}' - recorded_at: Thu, 03 Feb 2022 17:48:33 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/oauth2/refresh_error.yml b/spec/fixtures/vcr_cassettes/oauth2/refresh_error.yml deleted file mode 100644 index ab37c94..0000000 --- a/spec/fixtures/vcr_cassettes/oauth2/refresh_error.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://app.lokalise.com/oauth2/token - body: - encoding: UTF-8 - string: '{"client_id":"","client_secret":"","refresh_token":"incorrect_token","grant_type":"refresh_token"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - response: - status: - code: 400 - message: Bad Request - headers: - server: - - nginx - date: - - Tue, 01 Feb 2022 20:19:13 GMT - content-type: - - application/json - expires: - - Thu, 19 Nov 1981 08:52:00 GMT, Tue, 01 Feb 2022 20:19:13 GMT - cache-control: - - no-store, no-cache, must-revalidate, max-age=0, must-revalidate, private - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - b8aa2bf5-fbb0-409c-acc1-5e97dc56b869 - body: - encoding: ASCII-8BIT - string: '{"error":"invalid_request","error_description":"Invalid request parameters","error_uri":""}' - recorded_at: Tue, 01 Feb 2022 20:19:13 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/oauth2/token.yml b/spec/fixtures/vcr_cassettes/oauth2/token.yml deleted file mode 100644 index f524567..0000000 --- a/spec/fixtures/vcr_cassettes/oauth2/token.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://app.lokalise.com/oauth2/token - body: - encoding: UTF-8 - string: '{"client_id":"","client_secret":"","code":"","grant_type":"authorization_code"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 01 Feb 2022 20:08:06 GMT - content-type: - - application/json - vary: - - Accept-Encoding - expires: - - Thu, 19 Nov 1981 08:52:00 GMT, Tue, 01 Feb 2022 20:08:06 GMT - cache-control: - - no-store, no-cache, must-revalidate, max-age=0, must-revalidate, private - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 21db3bfd-a51f-43e6-bb83-b4537c3c6deb - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: '{"access_token":"123fake","refresh_token":"345refresh","expires_in":3600,"token_type":"Bearer"}' - recorded_at: Tue, 01 Feb 2022 20:08:06 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/oauth2/token_error.yml b/spec/fixtures/vcr_cassettes/oauth2/token_error.yml deleted file mode 100644 index 97b8128..0000000 --- a/spec/fixtures/vcr_cassettes/oauth2/token_error.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://app.lokalise.com/oauth2/token - body: - encoding: UTF-8 - string: '{"client_id":"","client_secret":"","code":"incorrect_code","grant_type":"authorization_code"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - response: - status: - code: 400 - message: Bad Request - headers: - server: - - nginx - date: - - Tue, 01 Feb 2022 20:16:45 GMT - content-type: - - application/json - expires: - - Thu, 19 Nov 1981 08:52:00 GMT, Tue, 01 Feb 2022 20:16:45 GMT - cache-control: - - no-store, no-cache, must-revalidate, max-age=0, must-revalidate, private - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 3741669b-0219-4e39-a164-2943bcb99904 - body: - encoding: ASCII-8BIT - string: '{"error":"invalid_request","error_description":"code: Code must be - 40 characters long","error_uri":""}' - recorded_at: Tue, 01 Feb 2022 20:16:45 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/order.yml b/spec/fixtures/vcr_cassettes/order.yml deleted file mode 100644 index 7cb7674..0000000 --- a/spec/fixtures/vcr_cassettes/order.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/orders/201903198B2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 26 Feb 2021 14:43:25 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Fri, 26 Feb 2021 14:43:25 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"order_id":"201903198B2","project_id":"803826145ba90b42d5d860.46800099","branch":null,"payment_method":null,"card_id":1774,"status":"completed","created_at":"2019-03-19 - 18:18:21 (Etc\/UTC)","created_at_timestamp":1553019501,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","target_language_isos":["ru"],"keys":[15519786],"source_words":{"ru":1},"provider_slug":"gengo","translation_style":"friendly","translation_tier":1,"translation_tier_name":"Professional - translator","briefing":"Some briefing","total":0.07}' - recorded_at: Fri, 26 Feb 2021 14:43:25 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/payment_card.yml b/spec/fixtures/vcr_cassettes/payment_card.yml deleted file mode 100644 index f9bccdd..0000000 --- a/spec/fixtures/vcr_cassettes/payment_card.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/payment_cards/1773 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:41:23 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a22cd39419c6ce233ebfe4bca6df6fbc; expires=Sat, 18-May-2019 17:41:23 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"user_id":20181,"payment_card":{"card_id":1773,"last4":"4242","brand":"Visa","created_at":"2019-03-19 - 17:01:22 (Etc\/UTC)"}}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:41:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/project.yml b/spec/fixtures/vcr_cassettes/project.yml deleted file mode 100644 index ca8fe07..0000000 --- a/spec/fixtures/vcr_cassettes/project.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 16:25:47 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=c8f5a243dde5e31b8b8546ff15f971af; expires=Tue, 16-Jul-2019 16:25:47 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","name":"demo phoenix","description":"","created_at":"2018-09-24 - 16:05:22 (Etc\/UTC)","created_at_timestamp":1537805122,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"base_language_id":640,"base_language_iso":"en","settings":{"per_platform_key_names":false,"reviewing":true,"upvoting":false,"auto_toggle_unverified":true,"offline_translation":true,"key_editing":true,"inline_machine_translations":true},"statistics":{"progress_total":18,"keys_total":17,"team":8,"base_words":39,"qa_issues_total":229,"qa_issues":{"not_reviewed":158,"unverified":66,"spelling_grammar":4,"inconsistent_placeholders":1,"inconsistent_html":0,"different_number_of_urls":0,"different_urls":0,"leading_whitespace":0,"trailing_whitespace":0,"different_number_of_email_address":0,"different_email_address":0,"different_brackets":0,"different_numbers":0,"double_space":0,"special_placeholder":0},"languages":[{"language_id":640,"language_iso":"en","progress":100,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":66,"words_to_do":13},{"language_id":673,"language_iso":"f_over","progress":25,"words_to_do":29},{"language_id":1055,"language_iso":"en-us","progress":0,"words_to_do":39},{"language_id":10111,"language_iso":"custom_111","progress":0,"words_to_do":39},{"language_id":764,"language_iso":"ca","progress":2,"words_to_do":38},{"language_id":934,"language_iso":"bm","progress":0,"words_to_do":39},{"language_id":803,"language_iso":"sq","progress":0,"words_to_do":39},{"language_id":731,"language_iso":"ar_001","progress":2,"words_to_do":38},{"language_id":601,"language_iso":"zh_TW","progress":0,"words_to_do":39},{"language_id":1056,"language_iso":"es","progress":10,"words_to_do":35}]}}' - http_version: - recorded_at: Fri, 17 May 2019 16:25:35 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/project_comments.yml b/spec/fixtures/vcr_cassettes/project_comments.yml deleted file mode 100644 index 89d108c..0000000 --- a/spec/fixtures/vcr_cassettes/project_comments.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/comments - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:02:31 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2a1b1991e47f8363daca541b3caceaaf; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:02:31 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","comments":[{"comment_id":767938,"key_id":15305182,"comment":"test","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-03 - 19:11:58 (Etc\/UTC)"},{"comment_id":800631,"key_id":15305182,"comment":"demo - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"},{"comment_id":800632,"key_id":15305182,"comment":"from - rspec","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"}]}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:02:24 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/queued_process.yml b/spec/fixtures/vcr_cassettes/queued_process.yml deleted file mode 100644 index ffb6551..0000000 --- a/spec/fixtures/vcr_cassettes/queued_process.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/processes/3b943469e6b3e324b5bdad639b122a623e6e7a1a - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 15 May 2020 10:47:04 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 15 May 2020 10:47:04 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","process":{"process_id":"3b943469e6b3e324b5bdad639b122a623e6e7a1a","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-05-13 - 11:24:37 (Etc\/UTC)","created_at_timestamp":1589369077,"details":{"files":[{"status":"finished","message":"","name_original":"test_async.json","name_custom":null,"word_count_total":3,"key_count_total":3,"key_count_inserted":1,"key_count_updated":0,"key_count_skipped":2}]}}}' - http_version: null - recorded_at: Fri, 15 May 2020 10:46:57 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/regenerate_webhook_secret.yml b/spec/fixtures/vcr_cassettes/regenerate_webhook_secret.yml deleted file mode 100644 index 8d7cf06..0000000 --- a/spec/fixtures/vcr_cassettes/regenerate_webhook_secret.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: patch - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/795565582e5ab15a59bb68156c7e2e9eaa1e8d1a/secret/regenerate - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.9.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 28 Feb 2020 13:13:01 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 28 Feb 2020 13:13:01 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","secret":"2007af3a30e5028d321db292608172fa06666662"}' - http_version: null - recorded_at: Fri, 28 Feb 2020 13:12:55 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/regenerate_webhook_secret_2.yml b/spec/fixtures/vcr_cassettes/regenerate_webhook_secret_2.yml deleted file mode 100644 index b8f7f77..0000000 --- a/spec/fixtures/vcr_cassettes/regenerate_webhook_secret_2.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: patch - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/795565582e5ab15a59bb68156c7e2e9eaa1e8d1a/secret/regenerate - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.9.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 28 Feb 2020 13:18:09 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 28 Feb 2020 13:18:09 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","secret":"e6aa374377ec8ed04c81e656277c96d781bdce00"}' - http_version: null - recorded_at: Fri, 28 Feb 2020 13:18:03 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/reload_key_segment.yml b/spec/fixtures/vcr_cassettes/reload_key_segment.yml deleted file mode 100644 index cea2118..0000000 --- a/spec/fixtures/vcr_cassettes/reload_key_segment.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 22 Nov 2021 17:02:03 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Mon, 22 Nov 2021 17:02:03 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":2,"language_iso":"en","value":"This - is just a simple text.","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-11-22 - 16:46:50 (Etc\/UTC)","modified_at_timestamp":1637599610,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":6,"custom_translation_statuses":[{"status_id":5734,"title":"context","color":"#61bd4f"}]}}' - recorded_at: Mon, 22 Nov 2021 17:02:02 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/remove_project_from_group_chained.yml b/spec/fixtures/vcr_cassettes/remove_project_from_group_chained.yml deleted file mode 100644 index 4ef1c03..0000000 --- a/spec/fixtures/vcr_cassettes/remove_project_from_group_chained.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/515/projects/remove - body: - encoding: UTF-8 - string: '{"projects":["446952185c01a12b4d0b45.76217122"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:38:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f38c3a79b8cf19ce1a12b4f8eafe6b96; expires=Thu, 18-Jul-2019 15:38:58 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["803826145ba90b42d5d860.46800099"],"members":[20181,25753]}}' - http_version: - recorded_at: Sun, 19 May 2019 15:38:58 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/remove_projects_from_group.yml b/spec/fixtures/vcr_cassettes/remove_projects_from_group.yml deleted file mode 100644 index c610d39..0000000 --- a/spec/fixtures/vcr_cassettes/remove_projects_from_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/689/projects/remove - body: - encoding: UTF-8 - string: '{"projects":["446952185c01a12b4d0b45.76217122"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:45:44 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=09b20858ffc7e68811a652f223fa2969; expires=Thu, 18-Jul-2019 14:45:44 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":[],"members":[35554]}}' - http_version: - recorded_at: Sun, 19 May 2019 14:45:44 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/remove_user_from_group_chained.yml b/spec/fixtures/vcr_cassettes/remove_user_from_group_chained.yml deleted file mode 100644 index 35c7261..0000000 --- a/spec/fixtures/vcr_cassettes/remove_user_from_group_chained.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/515/members/remove - body: - encoding: UTF-8 - string: '{"users":[35554]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:43:35 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=e4fd1d4c17907851d8cc760cd9a5ba09; expires=Thu, 18-Jul-2019 15:43:34 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["803826145ba90b42d5d860.46800099"],"members":[20181,25753]}}' - http_version: - recorded_at: Sun, 19 May 2019 15:43:35 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/remove_users_from_group.yml b/spec/fixtures/vcr_cassettes/remove_users_from_group.yml deleted file mode 100644 index e8b6d6c..0000000 --- a/spec/fixtures/vcr_cassettes/remove_users_from_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/689/members/remove - body: - encoding: UTF-8 - string: '{"users":[35554]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:54:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3892dc7614c65856af876dc6a7794860; expires=Thu, 18-Jul-2019 14:54:09 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["605317925c13e4ecb36a79.94825279"],"members":[]}}' - http_version: - recorded_at: Sun, 19 May 2019 14:54:09 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/restore_snapshot.yml b/spec/fixtures/vcr_cassettes/restore_snapshot.yml deleted file mode 100644 index e86f8c2..0000000 --- a/spec/fixtures/vcr_cassettes/restore_snapshot.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots/27881 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:06:15 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=1efb4d535030c0eb3438c2894932ed0c; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:06:14 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"399244385c0e9d07374685.57781732","name":"demo phoenix - copy","description":"","created_at":"2018-12-10 17:06:15 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":0,"team":2,"base_words":0,"qa_issues":0,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0}]}}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:06:15 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/restore_snapshot_chained.yml b/spec/fixtures/vcr_cassettes/restore_snapshot_chained.yml deleted file mode 100644 index 9c49380..0000000 --- a/spec/fixtures/vcr_cassettes/restore_snapshot_chained.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots/28533 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:14:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=eae8be2016e7edab9d5d16da49915cc6; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:14:20 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"605317925c13e4ecb36a79.94825279","name":"demo phoenix - copy","description":"","created_at":"2018-12-14 17:14:20 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":33,"keys":1,"team":2,"base_words":2,"qa_issues":2,"languages":[{"language_id":640,"language_iso":"en","progress":100,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":2},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":2}]}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:14:13 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/restore_snapshot_for_chained.yml b/spec/fixtures/vcr_cassettes/restore_snapshot_for_chained.yml deleted file mode 100644 index e4ddd9e..0000000 --- a/spec/fixtures/vcr_cassettes/restore_snapshot_for_chained.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/snapshots/243330 - body: - encoding: UTF-8 - string: "{}" - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.10.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Mon, 11 May 2020 13:29:13 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Mon, 11 May 2020 13:29:14 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"481179005eb95329728d52.65842327","project_type":"localization_files","name":"Demo - Phoenix copy","description":"Description Phoenix","created_at":"2020-05-11 - 13:29:13 (Etc\/UTC)","created_at_timestamp":1589203753,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"base_language_id":640,"base_language_iso":"en","settings":{"per_platform_key_names":false,"reviewing":true,"upvoting":false,"auto_toggle_unverified":true,"offline_translation":true,"key_editing":true,"inline_machine_translations":true,"branching":true},"statistics":{"progress_total":0,"keys_total":0,"team":9,"base_words":0,"qa_issues_total":0,"qa_issues":{"not_reviewed":0,"unverified":0,"spelling_grammar":0,"inconsistent_placeholders":0,"inconsistent_html":0,"different_number_of_urls":0,"different_urls":0,"leading_whitespace":0,"trailing_whitespace":0,"different_number_of_email_address":0,"different_email_address":0,"different_brackets":0,"different_numbers":0,"double_space":0,"special_placeholder":0},"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0},{"language_id":1055,"language_iso":"en-us","progress":0,"words_to_do":0},{"language_id":764,"language_iso":"ca","progress":0,"words_to_do":0},{"language_id":934,"language_iso":"bm","progress":0,"words_to_do":0},{"language_id":803,"language_iso":"sq","progress":0,"words_to_do":0},{"language_id":731,"language_iso":"ar_001","progress":0,"words_to_do":0},{"language_id":1056,"language_iso":"es","progress":0,"words_to_do":0},{"language_id":737,"language_iso":"nl","progress":0,"words_to_do":0},{"language_id":10001,"language_iso":"custom_1","progress":0,"words_to_do":0}]}}' - http_version: null - recorded_at: Mon, 11 May 2020 13:29:15 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/restored_updated_project.yml b/spec/fixtures/vcr_cassettes/restored_updated_project.yml deleted file mode 100644 index d4a769c..0000000 --- a/spec/fixtures/vcr_cassettes/restored_updated_project.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/481179005eb95329728d52.65842327 - body: - encoding: UTF-8 - string: '{"name":"Restored and updated"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.10.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Mon, 11 May 2020 13:29:15 GMT - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Mon, 11 May 2020 13:29:15 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"481179005eb95329728d52.65842327","project_type":"localization_files","name":"Restored - and updated","description":"Description Phoenix","created_at":"2020-05-11 - 13:29:13 (Etc\/UTC)","created_at_timestamp":1589203753,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"base_language_id":640,"base_language_iso":"en","settings":{"per_platform_key_names":false,"reviewing":true,"upvoting":false,"auto_toggle_unverified":true,"offline_translation":true,"key_editing":true,"inline_machine_translations":true,"branching":true},"statistics":{"progress_total":0,"keys_total":0,"team":9,"base_words":0,"qa_issues_total":0,"qa_issues":{"not_reviewed":0,"unverified":0,"spelling_grammar":0,"inconsistent_placeholders":0,"inconsistent_html":0,"different_number_of_urls":0,"different_urls":0,"leading_whitespace":0,"trailing_whitespace":0,"different_number_of_email_address":0,"different_email_address":0,"different_brackets":0,"different_numbers":0,"double_space":0,"special_placeholder":0},"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0},{"language_id":597,"language_iso":"ru","progress":0,"words_to_do":0},{"language_id":673,"language_iso":"f_over","progress":0,"words_to_do":0},{"language_id":1055,"language_iso":"en-us","progress":0,"words_to_do":0},{"language_id":764,"language_iso":"ca","progress":0,"words_to_do":0},{"language_id":934,"language_iso":"bm","progress":0,"words_to_do":0},{"language_id":803,"language_iso":"sq","progress":0,"words_to_do":0},{"language_id":731,"language_iso":"ar_001","progress":0,"words_to_do":0},{"language_id":1056,"language_iso":"es","progress":0,"words_to_do":0},{"language_id":737,"language_iso":"nl","progress":0,"words_to_do":0},{"language_id":10001,"language_iso":"custom_1","progress":0,"words_to_do":0}]}}' - http_version: null - recorded_at: Mon, 11 May 2020 13:29:15 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/screenshot.yml b/spec/fixtures/vcr_cassettes/screenshot.yml deleted file mode 100644 index 3e38c61..0000000 --- a/spec/fixtures/vcr_cassettes/screenshot.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots/115185 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:46:59 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=df797ecdd900705c3c9bb02cc85e8e41; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:46:59 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshot":{"screenshot_id":115185,"title":"rspec - screen","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/29b5bdb9c85bc973e3ada5c7a2f10f762232e8ea.jpg","key_ids":[],"width":125,"height":32}}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:46:59 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/task.yml b/spec/fixtures/vcr_cassettes/task.yml deleted file mode 100644 index 71791b4..0000000 --- a/spec/fixtures/vcr_cassettes/task.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks/11925 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.0.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Tue, 02 Feb 2021 11:50:49 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Tue, 02 Feb 2021 11:50:49 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","task":{"task_id":11925,"title":"node - updated","can_be_parent":false,"task_type":"review","parent_task_id":null,"closing_tags":[],"description":"","status":"completed","progress":0,"due_date":null,"due_date_timestamp":null,"keys_count":16,"words_count":275,"created_at":"2019-05-13 - 16:15:26 (Etc\/UTC)","created_at_timestamp":1557764126,"created_by":20181,"created_by_email":"bodrovis@protonmail.com","source_language_iso":"en","languages":[{"language_iso":"sq","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":16,"words_count":37,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"ar_001","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"},{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":15,"words_count":36,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"bm","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"},{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":12,"words_count":17,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"ca","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"},{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":11,"words_count":16,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":null,"users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":14,"words_count":29,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":null,"users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"},{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":16,"words_count":37,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"en-us","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":16,"words_count":37,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"ru","users":[{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"},{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":9,"words_count":11,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"es","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"},{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":13,"words_count":28,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null},{"language_iso":"f_over","users":[{"user_id":33599,"email":"twilight_church@list.ru","fullname":"Joe"},{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"groups":[],"keys":[],"status":"created","progress":0,"initial_tm_leverage":{"0%+":0,"60%+":0,"75%+":0,"95%+":0,"100%":0},"keys_count":14,"words_count":27,"completed_at":null,"completed_at_timestamp":null,"completed_by":null,"completed_by_email":null}],"auto_close_items":true,"auto_close_languages":true,"auto_close_task":true,"completed_at":"2019-10-01 - 11:09:12 (Etc\/UTC)","completed_at_timestamp":1569928152,"completed_by":20181,"completed_by_email":"bodrovis@protonmail.com","do_lock_translations":false,"custom_translation_status_ids":[]}}' - recorded_at: Tue, 02 Feb 2021 11:50:50 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_user.yml b/spec/fixtures/vcr_cassettes/team_user.yml deleted file mode 100644 index ee5a0c0..0000000 --- a/spec/fixtures/vcr_cassettes/team_user.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/users/20181 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.1 - x-api-token: - - "" - Accept-Encoding: - - gzip,deflate,br - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 04 Feb 2022 12:09:41 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - d88c4f69-8d88-4f41-9b13-bff4110139ad - expires: - - Fri, 04 Feb 2022 12:09:41 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - content-encoding: - - gzip - body: - encoding: ASCII-8BIT - string: !binary |- - H4sIAAAAAAAEA1WOsQrCMBRFf6W8SSHVJjVtzSSKg7tuQontKwSSpqSpIqX/bqKT04VzD5c7g0dpatWCoGVR7Bn5gWlEB2KGmN+WZbSiBNBIpUHAw7bOPtV4GJz1to9001gDBLpJ614aDNJFv2VyDKxxKD22tfSBxqU0q1JGE8pFzgXjyersm/v2dj2t/+zaK4Ojl2YI93i+qwpeMk7AWR337asPL5flA2U4V9rFAAAA - recorded_at: Fri, 04 Feb 2022 12:09:42 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_user_billing_details.yml b/spec/fixtures/vcr_cassettes/team_user_billing_details.yml deleted file mode 100644 index ad49678..0000000 --- a/spec/fixtures/vcr_cassettes/team_user_billing_details.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/billing_details - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 17:45:27 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 5ef1efa9-b664-4549-ba96-cbcd09828678 - expires: - - Wed, 15 Dec 2021 17:45:27 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"company":"Self-employed","address1":"Sample line 1","address2":"Sample - line 2","city":"Riga","zip":"LV-6543","phone":"+371123456","vatnumber":"123","country_code":"LV","billing_email":"hello@example.com","state_code":""}' - recorded_at: Wed, 15 Dec 2021 17:45:27 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_user_group.yml b/spec/fixtures/vcr_cassettes/team_user_group.yml deleted file mode 100644 index 10b375b..0000000 --- a/spec/fixtures/vcr_cassettes/team_user_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/groups/515 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:01:54 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=6d058eba4d87e284fae3b2d36b829f5d; expires=Thu, 18-Jul-2019 14:01:54 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["803826145ba90b42d5d860.46800099"],"members":[20181,25753]}' - http_version: - recorded_at: Sun, 19 May 2019 14:01:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_user_groups.yml b/spec/fixtures/vcr_cassettes/team_user_groups.yml deleted file mode 100644 index d2a4ba2..0000000 --- a/spec/fixtures/vcr_cassettes/team_user_groups.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/groups - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 13:15:11 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=d8b864af20f63b97039eced79f069cd2; expires=Thu, 18-Jul-2019 13:15:11 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"user_groups":[{"group_id":515,"name":"Demo","permissions":{"is_admin":true,"is_reviewer":false,"admin_rights":["upload","download","tasks","contributors","screenshots","keys","languages","settings","activity","statistics"],"languages":[]},"created_at":"2019-03-19 - 19:53:04 (Etc\/UTC)","created_at_timestamp":1553025184,"team_id":176692,"projects":["803826145ba90b42d5d860.46800099"],"members":[20181,25753]},{"group_id":689,"name":"Second - Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["446952185c01a12b4d0b45.76217122"],"members":[35554]}]}' - http_version: - recorded_at: Sun, 19 May 2019 13:15:11 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_user_groups_pagination.yml b/spec/fixtures/vcr_cassettes/team_user_groups_pagination.yml deleted file mode 100644 index 8b0c60b..0000000 --- a/spec/fixtures/vcr_cassettes/team_user_groups_pagination.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/groups?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 13:15:11 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=4dc8cece1150a982f407d84130380c13; expires=Thu, 18-Jul-2019 13:15:11 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"user_groups":[{"group_id":689,"name":"Second Group","permissions":{"is_admin":false,"is_reviewer":false,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["446952185c01a12b4d0b45.76217122"],"members":[35554]}]}' - http_version: - recorded_at: Sun, 19 May 2019 13:15:11 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/team_users.yml b/spec/fixtures/vcr_cassettes/team_users.yml deleted file mode 100644 index 90df5c0..0000000 --- a/spec/fixtures/vcr_cassettes/team_users.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/users - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:50:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a48f536d3fa3ade8567f8beafbfdef74; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:50:09 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '4' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_users":[{"user_id":25953,"email":"rspec@test.com","fullname":"Rspec - test","created_at":"2018-12-07 18:21:24 (Etc\/UTC)","role":"member"},{"user_id":25753,"email":"test2@example.com","fullname":"Unnamed","created_at":"2018-12-04 - 18:13:19 (Etc\/UTC)","role":"member"},{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya","created_at":"2018-08-21 - 17:35:25 (Etc\/UTC)","role":"owner"},{"user_id":5870,"email":"test@example.com","fullname":"John - Doe","created_at":"2017-06-09 13:56:00 (Etc\/UTC)","role":"member"}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:50:08 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/teams.yml b/spec/fixtures/vcr_cassettes/teams.yml deleted file mode 100644 index dabe295..0000000 --- a/spec/fixtures/vcr_cassettes/teams.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams?limit=1&page=2 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 17:22:47 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f7d3a5589e761e552e1bd11e847c667a; expires=Tue, 16-Jul-2019 17:22:47 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '2' - x-pagination-page-count: - - '2' - x-pagination-limit: - - '1' - x-pagination-page: - - '2' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"teams":[{"team_id":176692,"name":"Ilya''s Team","plan":"Trial","created_at":"2018-08-21 - 15:35:25 (Etc\/UTC)","created_at_timestamp":1534865725,"quota_usage":{"users":9,"keys":71,"projects":10,"mau":0},"quota_allowed":{"users":999999999,"keys":999999999,"projects":999999999,"mau":999999999}}]}' - http_version: - recorded_at: Fri, 17 May 2019 17:22:35 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/translation.yml b/spec/fixtures/vcr_cassettes/translation.yml deleted file mode 100644 index 099c177..0000000 --- a/spec/fixtures/vcr_cassettes/translation.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations/304581218 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 28 Apr 2021 12:01:27 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - expires: - - Wed, 28 Apr 2021 12:01:27 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","translation":{"translation_id":304581218,"key_id":44596059,"language_iso":"ru","translation":"\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2020-05-15 - 10:44:42 (Etc\/UTC)","modified_at_timestamp":1589539482,"is_reviewed":false,"reviewed_by":0,"is_unverified":false,"is_fuzzy":false,"words":1,"custom_translation_statuses":[],"task_id":null}}' - recorded_at: Wed, 28 Apr 2021 12:01:27 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/translation_provider.yml b/spec/fixtures/vcr_cassettes/translation_provider.yml deleted file mode 100644 index 20f659d..0000000 --- a/spec/fixtures/vcr_cassettes/translation_provider.yml +++ /dev/null @@ -1,303 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/teams/176692/translation_providers/1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Tue, 19 Mar 2019 17:58:56 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=3fd1eb0d4612b30f268c373a8723aff8; expires=Sat, 18-May-2019 17:58:56 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"provider_id":1,"name":"Gengo","slug":"gengo","price_pair_min":"0.00","website_url":"https:\/\/gengo.com","description":"At - Gengo, our mission is to provide language services to everyone and connect - a global community. Our network of over 18,000 translators are tested and - qualified to meet stringent project standards. Translators are based around - the world and in every timezone, which enables us to support over 35 languages - and work towards the Gengo mission.","tiers":[{"tier_id":1,"title":"Native - speaker"},{"tier_id":2,"title":"Professional translator"}],"pairs":[{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"ru","from_lang_name":"Russian","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"ru","from_lang_name":"Russian","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"ru_RU","from_lang_name":"Russian - (Russia)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"ru_RU","from_lang_name":"Russian - (Russia)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ru","to_lang_name":"Russian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ru_RU","to_lang_name":"Russian - (Russia)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"zh_TW","to_lang_name":"Chinese - Traditional"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"zh_CN","to_lang_name":"Chinese - Simplified"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ja","to_lang_name":"Japanese"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es_419","to_lang_name":"Spanish - (Latin America)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es_ES","to_lang_name":"Spanish - (Spain)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"de_DE","to_lang_name":"German - (Germany)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr_CA","to_lang_name":"French - (Canada)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr_FR","to_lang_name":"French - (France)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt_PT","to_lang_name":"Portuguese - (Portugal)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt_BR","to_lang_name":"Portuguese - (Brazil)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ar","to_lang_name":"Arabic"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ar_AE","to_lang_name":"Arabic - (United Arab Emirates)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ko","to_lang_name":"Korean"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"it","to_lang_name":"Italian"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"it_IT","to_lang_name":"Italian - (Italy)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"nl_NL","to_lang_name":"Dutch - (Netherlands)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"tr","to_lang_name":"Turkish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pl","to_lang_name":"Polish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ms","to_lang_name":"Malay"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"th","to_lang_name":"Thai"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sv","to_lang_name":"Swedish"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sv_SE","to_lang_name":"Swedish - (Sweden)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"id","to_lang_name":"Indonesian"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"no","to_lang_name":"Norwegian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"el","to_lang_name":"Greek"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"el_GR","to_lang_name":"Greek - (Greece)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"cs","to_lang_name":"Czech"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"he","to_lang_name":"Hebrew"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"da","to_lang_name":"Danish"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fi","to_lang_name":"Finnish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"uk","to_lang_name":"Ukrainian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ro","to_lang_name":"Romanian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ro_RO","to_lang_name":"Romanian - (Romania)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"hu","to_lang_name":"Hungarian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"vi","to_lang_name":"Vietnamese"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"hi_IN","to_lang_name":"Hindi - (India)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"bg_BG","to_lang_name":"Bulgarian - (Bulgaria)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"bg","to_lang_name":"Bulgarian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sr","to_lang_name":"Serbian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sk","to_lang_name":"Slovak"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es","to_lang_name":"Spanish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt","to_lang_name":"Portuguese"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"tl","to_lang_name":"Tagalog"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"es_ES","to_lang_name":"Spanish (Spain)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"es","to_lang_name":"Spanish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"fr_FR","to_lang_name":"French - (France)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"nl_NL","to_lang_name":"Dutch - (Netherlands)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"fr_FR","to_lang_name":"French (France)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"nl_NL","to_lang_name":"Dutch (Netherlands)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"de_DE","to_lang_name":"German - (Germany)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_CA","from_lang_name":"French - (Canada)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_CA","from_lang_name":"French - (Canada)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"de_DE","to_lang_name":"German (Germany)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt_PT","from_lang_name":"Portuguese - (Portugal)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt_PT","from_lang_name":"Portuguese - (Portugal)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt_PT","from_lang_name":"Portuguese - (Portugal)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt_BR","from_lang_name":"Portuguese - (Brazil)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt_BR","from_lang_name":"Portuguese - (Brazil)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"sv","from_lang_name":"Swedish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"sv_SE","from_lang_name":"Swedish - (Sweden)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"no","from_lang_name":"Norwegian","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"da","from_lang_name":"Danish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ru","to_lang_name":"Russian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ru_RU","to_lang_name":"Russian (Russia)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"zh_TW","to_lang_name":"Chinese Traditional"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"zh_CN","to_lang_name":"Chinese Simplified"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ja","to_lang_name":"Japanese"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es_419","to_lang_name":"Spanish (Latin America)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es_ES","to_lang_name":"Spanish (Spain)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"de_DE","to_lang_name":"German (Germany)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr_CA","to_lang_name":"French (Canada)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr_FR","to_lang_name":"French (France)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt_PT","to_lang_name":"Portuguese (Portugal)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt_BR","to_lang_name":"Portuguese (Brazil)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ar","to_lang_name":"Arabic"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ar_AE","to_lang_name":"Arabic (United Arab - Emirates)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ko","to_lang_name":"Korean"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"it","to_lang_name":"Italian"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"it_IT","to_lang_name":"Italian (Italy)"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":1,"price_per_word":"0.07","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"nl_NL","to_lang_name":"Dutch (Netherlands)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"tr","to_lang_name":"Turkish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pl","to_lang_name":"Polish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ms","to_lang_name":"Malay"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"th","to_lang_name":"Thai"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sv","to_lang_name":"Swedish"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sv_SE","to_lang_name":"Swedish (Sweden)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"id","to_lang_name":"Indonesian"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"no","to_lang_name":"Norwegian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"el","to_lang_name":"Greek"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"el_GR","to_lang_name":"Greek (Greece)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"cs","to_lang_name":"Czech"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"he","to_lang_name":"Hebrew"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"da","to_lang_name":"Danish"},{"tier_id":1,"price_per_word":"0.09","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fi","to_lang_name":"Finnish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"uk","to_lang_name":"Ukrainian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ro","to_lang_name":"Romanian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ro_RO","to_lang_name":"Romanian (Romania)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"hu","to_lang_name":"Hungarian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"vi","to_lang_name":"Vietnamese"},{"tier_id":1,"price_per_word":"0.03","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"hi_IN","to_lang_name":"Hindi (India)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"bg_BG","to_lang_name":"Bulgarian (Bulgaria)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"bg","to_lang_name":"Bulgarian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sr","to_lang_name":"Serbian"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sk","to_lang_name":"Slovak"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es","to_lang_name":"Spanish"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt","to_lang_name":"Portuguese"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"tl","to_lang_name":"Tagalog"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt","from_lang_name":"Portuguese","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt","from_lang_name":"Portuguese","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":1,"price_per_word":"0.05","from_lang_iso":"pt","from_lang_name":"Portuguese","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"ru","from_lang_name":"Russian","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"ru","from_lang_name":"Russian","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"ru_RU","from_lang_name":"Russian - (Russia)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"ru_RU","from_lang_name":"Russian - (Russia)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ru","to_lang_name":"Russian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ru_RU","to_lang_name":"Russian - (Russia)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"zh_TW","to_lang_name":"Chinese - Traditional"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"zh_CN","to_lang_name":"Chinese - Simplified"},{"tier_id":2,"price_per_word":"0.06","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ja","to_lang_name":"Japanese"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es_419","to_lang_name":"Spanish - (Latin America)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es_ES","to_lang_name":"Spanish - (Spain)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"de_DE","to_lang_name":"German - (Germany)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr_CA","to_lang_name":"French - (Canada)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fr_FR","to_lang_name":"French - (France)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt_PT","to_lang_name":"Portuguese - (Portugal)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt_BR","to_lang_name":"Portuguese - (Brazil)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ar","to_lang_name":"Arabic"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ar_AE","to_lang_name":"Arabic - (United Arab Emirates)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ko","to_lang_name":"Korean"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"it","to_lang_name":"Italian"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"it_IT","to_lang_name":"Italian - (Italy)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"nl_NL","to_lang_name":"Dutch - (Netherlands)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"tr","to_lang_name":"Turkish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pl","to_lang_name":"Polish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ms","to_lang_name":"Malay"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"th","to_lang_name":"Thai"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sv","to_lang_name":"Swedish"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sv_SE","to_lang_name":"Swedish - (Sweden)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"id","to_lang_name":"Indonesian"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"no","to_lang_name":"Norwegian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"el","to_lang_name":"Greek"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"el_GR","to_lang_name":"Greek - (Greece)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"cs","to_lang_name":"Czech"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"he","to_lang_name":"Hebrew"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"da","to_lang_name":"Danish"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"fi","to_lang_name":"Finnish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"uk","to_lang_name":"Ukrainian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ro","to_lang_name":"Romanian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"ro_RO","to_lang_name":"Romanian - (Romania)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"hu","to_lang_name":"Hungarian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"vi","to_lang_name":"Vietnamese"},{"tier_id":2,"price_per_word":"0.05","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"hi_IN","to_lang_name":"Hindi - (India)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"bg_BG","to_lang_name":"Bulgarian - (Bulgaria)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"bg","to_lang_name":"Bulgarian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sr","to_lang_name":"Serbian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"sk","to_lang_name":"Slovak"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"es","to_lang_name":"Spanish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"pt","to_lang_name":"Portuguese"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en","from_lang_name":"English","to_lang_iso":"tl","to_lang_name":"Tagalog"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es_419","from_lang_name":"Spanish - (Latin America)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es_ES","from_lang_name":"Spanish - (Spain)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"fr_FR","to_lang_name":"French - (France)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"nl_NL","to_lang_name":"Dutch - (Netherlands)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de","from_lang_name":"German","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"fr_FR","to_lang_name":"French (France)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"nl_NL","to_lang_name":"Dutch (Netherlands)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"de_DE","from_lang_name":"German - (Germany)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"de_DE","to_lang_name":"German - (Germany)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr","from_lang_name":"French","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_CA","from_lang_name":"French - (Canada)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_CA","from_lang_name":"French - (Canada)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"de_DE","to_lang_name":"German (Germany)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"fr_FR","from_lang_name":"French - (France)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt_PT","from_lang_name":"Portuguese - (Portugal)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt_PT","from_lang_name":"Portuguese - (Portugal)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt_BR","from_lang_name":"Portuguese - (Brazil)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt_BR","from_lang_name":"Portuguese - (Brazil)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it","from_lang_name":"Italian","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"it_IT","from_lang_name":"Italian - (Italy)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl","from_lang_name":"Dutch","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"nl_NL","from_lang_name":"Dutch - (Netherlands)","to_lang_iso":"en_US","to_lang_name":"English (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pl","from_lang_name":"Polish","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"sv","from_lang_name":"Swedish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"sv_SE","from_lang_name":"Swedish - (Sweden)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"no","from_lang_name":"Norwegian","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"da","from_lang_name":"Danish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ru","to_lang_name":"Russian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ru_RU","to_lang_name":"Russian (Russia)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"zh_TW","to_lang_name":"Chinese Traditional"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"zh_CN","to_lang_name":"Chinese Simplified"},{"tier_id":2,"price_per_word":"0.06","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"en_GB","to_lang_name":"English (United Kingdom)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ja","to_lang_name":"Japanese"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es_419","to_lang_name":"Spanish (Latin America)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es_ES","to_lang_name":"Spanish (Spain)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"de","to_lang_name":"German"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"de_DE","to_lang_name":"German (Germany)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr","to_lang_name":"French"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr_CA","to_lang_name":"French (Canada)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fr_FR","to_lang_name":"French (France)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt_PT","to_lang_name":"Portuguese (Portugal)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt_BR","to_lang_name":"Portuguese (Brazil)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ar","to_lang_name":"Arabic"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ar_AE","to_lang_name":"Arabic (United Arab - Emirates)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ko","to_lang_name":"Korean"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"it","to_lang_name":"Italian"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"it_IT","to_lang_name":"Italian (Italy)"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"nl","to_lang_name":"Dutch"},{"tier_id":2,"price_per_word":"0.13","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"nl_NL","to_lang_name":"Dutch (Netherlands)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"tr","to_lang_name":"Turkish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pl","to_lang_name":"Polish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ms","to_lang_name":"Malay"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"th","to_lang_name":"Thai"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sv","to_lang_name":"Swedish"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sv_SE","to_lang_name":"Swedish (Sweden)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"id","to_lang_name":"Indonesian"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"no","to_lang_name":"Norwegian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"el","to_lang_name":"Greek"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"el_GR","to_lang_name":"Greek (Greece)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"cs","to_lang_name":"Czech"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"he","to_lang_name":"Hebrew"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"da","to_lang_name":"Danish"},{"tier_id":2,"price_per_word":"0.15","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"fi","to_lang_name":"Finnish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"uk","to_lang_name":"Ukrainian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ro","to_lang_name":"Romanian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"ro_RO","to_lang_name":"Romanian (Romania)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"hu","to_lang_name":"Hungarian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"vi","to_lang_name":"Vietnamese"},{"tier_id":2,"price_per_word":"0.05","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"hi_IN","to_lang_name":"Hindi (India)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"bg_BG","to_lang_name":"Bulgarian (Bulgaria)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"bg","to_lang_name":"Bulgarian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sr","to_lang_name":"Serbian"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"sk","to_lang_name":"Slovak"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"es","to_lang_name":"Spanish"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"pt","to_lang_name":"Portuguese"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"en_US","from_lang_name":"English - (United States)","to_lang_iso":"tl","to_lang_name":"Tagalog"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en_GB","to_lang_name":"English - (United Kingdom)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"es","from_lang_name":"Spanish","to_lang_iso":"en_US","to_lang_name":"English - (United States)"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt","from_lang_name":"Portuguese","to_lang_iso":"en","to_lang_name":"English"},{"tier_id":2,"price_per_word":"0.11","from_lang_iso":"pt","from_lang_name":"Portuguese","to_lang_iso":"en_US","to_lang_name":"English - (United States)"}]}' - http_version: - recorded_at: Tue, 19 Mar 2019 17:58:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/translation_status.yml b/spec/fixtures/vcr_cassettes/translation_status.yml deleted file mode 100644 index 1b445bd..0000000 --- a/spec/fixtures/vcr_cassettes/translation_status.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/128 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:30:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=e85bbe1f841440323e5cebe00af15295; expires=Sun, 15-Sep-2019 16:30:09 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status":{"status_id":128,"title":"random","color":"#0079bf"}}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:29:43 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/translation_status_colors.yml b/spec/fixtures/vcr_cassettes/translation_status_colors.yml deleted file mode 100644 index cbba4dd..0000000 --- a/spec/fixtures/vcr_cassettes/translation_status_colors.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/colors - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:48:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=cee8291f1ca404b90b7adb45176a47b7; expires=Sun, 15-Sep-2019 16:48:21 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"colors":["#61bd4f","#f2d600","#ff9f1a","#eb5a46","#c377e0","#0079bf","#00c2e0","#344563","#ff78cb"]}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:47:55 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/translations.yml b/spec/fixtures/vcr_cassettes/translations.yml deleted file mode 100644 index 21659c8..0000000 --- a/spec/fixtures/vcr_cassettes/translations.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:58:03 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=75e1abf8110154cf99ed9a4ed54ccbce; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:58:03 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - x-pagination-total-count: - - '9' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translations":[{"translation_id":79607647,"key_id":15519786,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:39:20 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015148,"key_id":15571975,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:35:35 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015151,"key_id":15571976,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:36:41 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607646,"key_id":15519786,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:39:20 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015147,"key_id":15571975,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:35:35 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015150,"key_id":15571976,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:36:41 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607648,"key_id":15519786,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:39:20 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015149,"key_id":15571975,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:35:35 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":80015152,"key_id":15571976,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 18:36:41 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}]}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:58:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/translations_next_page.yml b/spec/fixtures/vcr_cassettes/translations_next_page.yml deleted file mode 100644 index 118a68f..0000000 --- a/spec/fixtures/vcr_cassettes/translations_next_page.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations?disable_references=0&filter_is_reviewed=0&limit=4&page=3 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 16:54:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=651dc4812a70b4d6942a96daa78552a6; expires=Tue, 16-Jul-2019 16:54:08 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '187' - x-pagination-page-count: - - '47' - x-pagination-limit: - - '4' - x-pagination-page: - - '3' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translations":[{"translation_id":114304556,"key_id":20988547,"language_iso":"ru","translation":"\u042f - \u0437\u043d\u0430\u044e JS!","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:08:01 (Etc\/UTC)","modified_at_timestamp":1557763681,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":false,"words":3},{"translation_id":114304604,"key_id":20988554,"language_iso":"ru","translation":"\u0414\u043e\u0431\u0440\u043e - \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c, [%1$s:username]!","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:00:41 (Etc\/UTC)","modified_at_timestamp":1557763241,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":2},{"translation_id":114306163,"key_id":20988567,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2019-04-16 - 12:08:50 (Etc\/UTC)","modified_at_timestamp":1555416530,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":114306173,"key_id":20988568,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2019-04-16 - 12:08:56 (Etc\/UTC)","modified_at_timestamp":1555416536,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}]}' - http_version: - recorded_at: Fri, 17 May 2019 16:53:56 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/translations_prev_page.yml b/spec/fixtures/vcr_cassettes/translations_prev_page.yml deleted file mode 100644 index 79c1292..0000000 --- a/spec/fixtures/vcr_cassettes/translations_prev_page.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations?disable_references=0&filter_is_reviewed=0&limit=4&page=1 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 17 May 2019 16:55:14 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=89d3722a8c4579bc83051bf3e78f990e; expires=Tue, 16-Jul-2019 16:55:14 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '187' - x-pagination-page-count: - - '47' - x-pagination-limit: - - '4' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translations":[{"translation_id":79607647,"key_id":15519786,"language_iso":"ru","translation":"\u0415\u0449\u0451 - \u043e\u0434\u0438\u043d \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439 - \u043a\u043b\u044e\u0447","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:13:34 (Etc\/UTC)","modified_at_timestamp":1557764014,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":false,"words":4},{"translation_id":80015148,"key_id":15571975,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 17:35:35 (Etc\/UTC)","modified_at_timestamp":1544463335,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":true,"words":0},{"translation_id":80015151,"key_id":15571976,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 17:36:41 (Etc\/UTC)","modified_at_timestamp":1544463401,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":true,"words":0},{"translation_id":82070311,"key_id":15814906,"language_iso":"ru","translation":"\u0444\u0443\u043d\u043a\u0446\u0438\u044f - \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430","modified_by":33599,"modified_by_email":"twilight_church@list.ru","modified_at":"2019-05-13 - 16:09:17 (Etc\/UTC)","modified_at_timestamp":1557763757,"is_reviewed":true,"reviewed_by":33599,"is_fuzzy":false,"words":3}]}' - http_version: - recorded_at: Fri, 17 May 2019 16:55:02 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_another_branch.yml b/spec/fixtures/vcr_cassettes/update_another_branch.yml deleted file mode 100644 index f3d89df..0000000 --- a/spec/fixtures/vcr_cassettes/update_another_branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/41306 - body: - encoding: UTF-8 - string: '{"name":"updated-ruby-second-branch"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:47:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":41306,"name":"updated-ruby-second-branch","created_at":"2019-10-30 - 14:47:07 (Etc\/UTC)","created_at_timestamp":1572446827,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:47:01 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_another_team_user_group.yml b/spec/fixtures/vcr_cassettes/update_another_team_user_group.yml deleted file mode 100644 index 37061d2..0000000 --- a/spec/fixtures/vcr_cassettes/update_another_team_user_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/689 - body: - encoding: UTF-8 - string: '{"name":"another group updated","is_admin":true,"is_reviewer":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 15:00:23 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=ce0b400f517d0c788871307aefdc3425; expires=Thu, 18-Jul-2019 15:00:23 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":689,"name":"another group updated","permissions":{"is_admin":true,"is_reviewer":true,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:14:25 (Etc\/UTC)","created_at_timestamp":1558271665,"team_id":176692,"projects":["605317925c13e4ecb36a79.94825279"],"members":[35554]}}' - http_version: - recorded_at: Sun, 19 May 2019 15:00:23 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_another_translation_status.yml b/spec/fixtures/vcr_cassettes/update_another_translation_status.yml deleted file mode 100644 index 66051a3..0000000 --- a/spec/fixtures/vcr_cassettes/update_another_translation_status.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/129 - body: - encoding: UTF-8 - string: '{"title":"updated rspec","color":"#0079bf"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:57:08 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=9bfabd9a574bd9f30d1f84d19f1c159f; expires=Sun, 15-Sep-2019 16:57:08 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status":{"status_id":129,"title":"updated - rspec","color":"#0079bf"}}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:56:42 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_branch.yml b/spec/fixtures/vcr_cassettes/update_branch.yml deleted file mode 100644 index f40ec06..0000000 --- a/spec/fixtures/vcr_cassettes/update_branch.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/branches/41302 - body: - encoding: UTF-8 - string: '{"name":"updated-ruby-branch"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.7.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 30 Oct 2019 14:42:25 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - pragma: - - no-cache - cache-control: - - no-store, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":{"branch_id":41302,"name":"updated-ruby-branch","created_at":"2019-10-30 - 14:24:41 (Etc\/UTC)","created_at_timestamp":1572445481,"created_by":20181,"created_by_email":"bodrovis@protonmail.com"}}' - http_version: - recorded_at: Wed, 30 Oct 2019 14:42:18 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_contributor.yml b/spec/fixtures/vcr_cassettes/update_contributor.yml deleted file mode 100644 index 51e50f7..0000000 --- a/spec/fixtures/vcr_cassettes/update_contributor.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors/25953 - body: - encoding: UTF-8 - string: '{"languages":[{"lang_iso":"en"}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 07 Dec 2018 17:24:53 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=6ff498ca2f7c05d0996baeb7c462d561; path=/; HttpOnly, locale=en_US; - expires=Sun, 06-Jan-2019 17:24:52 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributor":{"user_id":25953,"email":"rspec@test.com","fullname":"Rspec - test","created_at":"2018-12-07 18:21:24 (Etc\/UTC)","is_admin":false,"is_reviewer":false,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":false}],"admin_rights":[]}}' - http_version: - recorded_at: Fri, 07 Dec 2018 17:24:45 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_contributor_chained.yml b/spec/fixtures/vcr_cassettes/update_contributor_chained.yml deleted file mode 100644 index dc6ca09..0000000 --- a/spec/fixtures/vcr_cassettes/update_contributor_chained.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/contributors/26265 - body: - encoding: UTF-8 - string: '{"fullname":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 13 Dec 2018 17:22:41 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=b6d32863b411a05cabe1bc2fccabedfa; path=/; HttpOnly, locale=en_US; - expires=Sat, 12-Jan-2019 17:22:41 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","contributor":{"user_id":26265,"email":"demo@test.com","fullname":"updated!","created_at":"2018-12-13 - 17:22:21 (Etc\/UTC)","is_admin":false,"is_reviewer":false,"languages":[{"lang_id":640,"lang_iso":"en","lang_name":"English","is_writable":false}],"admin_rights":[]}}' - http_version: - recorded_at: Thu, 13 Dec 2018 17:22:35 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_key.yml b/spec/fixtures/vcr_cassettes/update_key.yml deleted file mode 100644 index 60fbd6e..0000000 --- a/spec/fixtures/vcr_cassettes/update_key.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15519770 - body: - encoding: UTF-8 - string: '{"key_name":"updated_rspec_k","description":"desc here"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:10:37 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=a744a7244d32843ca52e8df1e58d0f2c; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:10:37 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","key":{"key_id":15519770,"created_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","key_name":{"ios":"updated_rspec_k","android":"updated_rspec_k","web":"updated_rspec_k","other":"updated_rspec_k"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"desc - here","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":79607515,"key_id":15519770,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607514,"key_id":15519770,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607516,"key_id":15519770,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:10:37 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_key_chained.yml b/spec/fixtures/vcr_cassettes/update_key_chained.yml deleted file mode 100644 index 7165e5c..0000000 --- a/spec/fixtures/vcr_cassettes/update_key_chained.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys/15814946 - body: - encoding: UTF-8 - string: '{"key_name":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:05:06 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=fabd09ae779c9fdd3d2bc17f48be1322; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:05:05 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","key":{"key_id":15814946,"created_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","key_name":{"ios":"updated!","android":"updated!","web":"updated!","other":"updated!"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":82070423,"key_id":15814946,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82070422,"key_id":15814946,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":82070424,"key_id":15814946,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 16:03:58 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:04:58 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_key_segment.yml b/spec/fixtures/vcr_cassettes/update_key_segment.yml deleted file mode 100644 index a347eb1..0000000 --- a/spec/fixtures/vcr_cassettes/update_key_segment.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/3 - body: - encoding: UTF-8 - string: '{"value":"Updated via API","is_reviewed":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 17:26:01 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 31ff159e-3879-4cfe-a47d-1d29c8d67325 - expires: - - Wed, 15 Dec 2021 17:26:01 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":3,"language_iso":"en","value":"Updated - via API","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-12-15 - 17:25:59 (Etc\/UTC)","modified_at_timestamp":1639589159,"is_reviewed":true,"reviewed_by":20181,"is_fuzzy":false,"words":3,"custom_translation_statuses":[]}}' - recorded_at: Wed, 15 Dec 2021 17:26:01 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_key_segment_chained.yml b/spec/fixtures/vcr_cassettes/update_key_segment_chained.yml deleted file mode 100644 index 41af976..0000000 --- a/spec/fixtures/vcr_cassettes/update_key_segment_chained.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/39066161618d4ecb9fdc12.00274309/keys/129358815/segments/en/4 - body: - encoding: UTF-8 - string: '{"value":"Chain Updated","is_fuzzy":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.4.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 17:25:01 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - allow: - - GET - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 2187a6ed-e23d-4044-be2c-bc530eac660f - expires: - - Wed, 15 Dec 2021 17:25:01 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"39066161618d4ecb9fdc12.00274309","key_id":129358815,"language_iso":"en","segment":{"segment_number":4,"language_iso":"en","value":"Chain - Updated","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2021-12-15 - 17:25:00 (Etc\/UTC)","modified_at_timestamp":1639589100,"is_reviewed":false,"reviewed_by":0,"is_fuzzy":true,"words":2,"custom_translation_statuses":[]}}' - recorded_at: Wed, 15 Dec 2021 17:25:01 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_keys.yml b/spec/fixtures/vcr_cassettes/update_keys.yml deleted file mode 100644 index d6db84a..0000000 --- a/spec/fixtures/vcr_cassettes/update_keys.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/keys - body: - encoding: UTF-8 - string: '{"keys":[{"key_id":15519770,"description":"bulk updated"},{"key_id":15305182,"tags":["bulk","upd"]}]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:10:38 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=771ea4f2bd4cf54a966de6fed85a6581; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:10:38 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","keys":[{"key_id":15305182,"created_at":"2018-12-03 - 19:11:30 (Etc\/UTC)","key_name":{"ios":"test","android":"test","web":"test","other":"test"},"filenames":{"ios":"","android":"","web":"rspec.yml","other":""},"description":"","platforms":["web"],"tags":["bulk","upd"],"comments":[{"comment_id":800631,"key_id":15305182,"comment":"demo - comment","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"},{"comment_id":800632,"key_id":15305182,"comment":"from - rspec","added_by":20181,"added_by_email":"bodrovis@protonmail.com","added_at":"2018-12-07 - 16:48:51 (Etc\/UTC)"}],"screenshots":[],"translations":[{"translation_id":77852857,"key_id":15305182,"language_iso":"ru","translation":"translation","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 18:41:13 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":1},{"translation_id":77852856,"key_id":15305182,"language_iso":"en","translation":"en","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-03 - 19:11:31 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":1},{"translation_id":77852858,"key_id":15305182,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-03 - 19:11:31 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":true,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":1,"char_limit":0,"custom_attributes":""},{"key_id":15519770,"created_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","key_name":{"ios":"updated_rspec_k","android":"updated_rspec_k","web":"updated_rspec_k","other":"updated_rspec_k"},"filenames":{"ios":"","android":"","web":"","other":""},"description":"bulk - updated","platforms":["ios"],"tags":[],"comments":[],"screenshots":[],"translations":[{"translation_id":79607515,"key_id":15519770,"language_iso":"ru","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607514,"key_id":15519770,"language_iso":"en","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0},{"translation_id":79607516,"key_id":15519770,"language_iso":"f_over","translation":"","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-09 - 19:02:48 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":0}],"is_plural":false,"plural_name":"","is_hidden":false,"is_archived":false,"context":"","base_words":0,"char_limit":0,"custom_attributes":""}],"errors":[]}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:10:37 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_language.yml b/spec/fixtures/vcr_cassettes/update_language.yml deleted file mode 100644 index d79563e..0000000 --- a/spec/fixtures/vcr_cassettes/update_language.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages/894 - body: - encoding: UTF-8 - string: '{"lang_name":"updated lang","plural_forms":["one"]}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 09 Dec 2018 18:32:34 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=0e760fe2f295377835763f17220c0a83; path=/; HttpOnly, locale=en_US; - expires=Tue, 08-Jan-2019 18:32:34 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","language":{"lang_id":894,"lang_iso":"ab","lang_name":"updated - lang","is_rtl":false,"plural_forms":["one"]}}' - http_version: - recorded_at: Sun, 09 Dec 2018 18:32:33 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_language_chained.yml b/spec/fixtures/vcr_cassettes/update_language_chained.yml deleted file mode 100644 index 6c2427f..0000000 --- a/spec/fixtures/vcr_cassettes/update_language_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/languages/894 - body: - encoding: UTF-8 - string: '{"lang_name":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:49:06 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f86860755bebcbbd3dcf8e0235f214bf; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:49:06 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","language":{"lang_id":894,"lang_iso":"ab","lang_name":"updated!","is_rtl":false,"plural_forms":null}}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:48:58 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_project.yml b/spec/fixtures/vcr_cassettes/update_project.yml deleted file mode 100644 index e505f00..0000000 --- a/spec/fixtures/vcr_cassettes/update_project.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/572222075c0953fd70d492.30502628 - body: - encoding: UTF-8 - string: '{"name":"rspec proj updated","description":"updated project for rspec"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Thu, 06 Dec 2018 17:03:11 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=5817fc6d7007c739ed9bf34558ec6794; path=/; HttpOnly, locale=en_US; - expires=Sat, 05-Jan-2019 17:03:11 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"572222075c0953fd70d492.30502628","name":"rspec proj - updated","description":"updated project for rspec","created_at":"2018-12-06 - 17:53:17 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":0,"team":1,"base_words":0,"qa_issues":0,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0}]}}' - http_version: - recorded_at: Thu, 06 Dec 2018 17:03:05 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_project_chained.yml b/spec/fixtures/vcr_cassettes/update_project_chained.yml deleted file mode 100644 index 8cbc957..0000000 --- a/spec/fixtures/vcr_cassettes/update_project_chained.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/186050335c13d673e9c638.47201999 - body: - encoding: UTF-8 - string: '{"name":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:29:34 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=f8f10cad5d5d8e05275b5e5d0b23279a; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:29:34 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"186050335c13d673e9c638.47201999","name":"updated!","description":"","created_at":"2018-12-14 - 16:12:35 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","team_id":176692,"statistics":{"progress":0,"keys":0,"team":1,"base_words":0,"qa_issues":0,"languages":[{"language_id":640,"language_iso":"en","progress":0,"words_to_do":0}]}}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:29:26 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_screenshot.yml b/spec/fixtures/vcr_cassettes/update_screenshot.yml deleted file mode 100644 index aa2c131..0000000 --- a/spec/fixtures/vcr_cassettes/update_screenshot.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots/115185 - body: - encoding: UTF-8 - string: '{"tags":["demo","rspec"],"description":"demo desc"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 16:52:27 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=e3652b48f64ce195a1710fefac2cc5e0; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 16:52:27 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshot":{"screenshot_id":115185,"title":"rspec - screen","description":"demo desc","screenshot_tags":["demo","rspec"],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/29b5bdb9c85bc973e3ada5c7a2f10f762232e8ea.jpg","key_ids":[],"width":125,"height":32}}' - http_version: - recorded_at: Mon, 10 Dec 2018 16:52:27 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_screenshot_chained.yml b/spec/fixtures/vcr_cassettes/update_screenshot_chained.yml deleted file mode 100644 index b32eecc..0000000 --- a/spec/fixtures/vcr_cassettes/update_screenshot_chained.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/screenshots/117310 - body: - encoding: UTF-8 - string: '{"title":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 16:57:54 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=cbe778b35aafef4827acda87d0d95162; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 16:57:54 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","screenshot":{"screenshot_id":117310,"title":"updated!","description":"","screenshot_tags":[],"url":"https:\/\/s3-eu-west-1.amazonaws.com\/lokalise-assets\/files\/screenshots\/803826145ba90b42d5d860.46800099\/88239e72fb0b79f59001e14f66844bae5e8c64ef.jpg","key_ids":[],"width":125,"height":32}}' - http_version: - recorded_at: Fri, 14 Dec 2018 16:57:46 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_task.yml b/spec/fixtures/vcr_cassettes/update_task.yml deleted file mode 100644 index 9c027dd..0000000 --- a/spec/fixtures/vcr_cassettes/update_task.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks/4387 - body: - encoding: UTF-8 - string: '{"description":"desc here","auto_close_task":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:41:13 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=9c878de2192716e05508b1ecad581513; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:41:11 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task":{"task_id":4387,"title":"another - rspec key","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"desc - here","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-10 - 18:37:02 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya"}],"keys":[15571976],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:41:12 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_task_chained.yml b/spec/fixtures/vcr_cassettes/update_task_chained.yml deleted file mode 100644 index 3f402dc..0000000 --- a/spec/fixtures/vcr_cassettes/update_task_chained.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/tasks/4622 - body: - encoding: UTF-8 - string: '{"title":"updated!"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:26:12 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=259e22b2fe6c431873e50e00fdd4cd91; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:26:11 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","task":{"task_id":4622,"title":"updated!","can_be_parent":true,"task_type":"translation","parent_task_id":null,"closing_tags":[],"description":"","status":"created","progress":0,"due_date":null,"keys_count":1,"words_count":0,"created_at":"2018-12-14 - 17:25:24 (Etc\/UTC)","created_by":20181,"created_by_email":"bodrovis@protonmail.com","languages":[{"language_iso":"ru","users":[{"user_id":20181,"email":"bodrovis@protonmail.com","fullname":"Ilya - B"}],"keys":[15571976],"status":"created","progress":0,"initial_tm_leverage":[],"keys_count":1,"words_count":0,"completed_at":null,"completed_by":null,"completed_by_email":null}],"auto_close_languages":true,"auto_close_task":true,"completed_at":null,"completed_by":null,"completed_by_email":null}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:26:05 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_team_user.yml b/spec/fixtures/vcr_cassettes/update_team_user.yml deleted file mode 100644 index 80218ca..0000000 --- a/spec/fixtures/vcr_cassettes/update_team_user.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/users/25953 - body: - encoding: UTF-8 - string: '{"role":"admin"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 17:55:35 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=1a73ffb5efa7f1a84234cc2874beed1b; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 17:55:35 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_user":{"user_id":25953,"email":"rspec@test.com","fullname":"Rspec - test","created_at":"2018-12-07 18:21:24 (Etc\/UTC)","role":"admin"}}' - http_version: - recorded_at: Mon, 10 Dec 2018 17:55:35 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_team_user_billing_details.yml b/spec/fixtures/vcr_cassettes/update_team_user_billing_details.yml deleted file mode 100644 index 5d9b2af..0000000 --- a/spec/fixtures/vcr_cassettes/update_team_user_billing_details.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/273879/billing_details - body: - encoding: UTF-8 - string: '{"billing_email":"ruby_rspec@example.com","country_code":"LV","zip":"LV-1111","address1":"Addr - line 1"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/4.5.0 - x-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 15 Dec 2021 19:39:57 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - pragma: - - no-cache - allow: - - GET, POST - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - referrer-policy: - - origin - x-lokalise-process-id: - - 1c44394f-82f1-407f-824a-776f8976f3bf - expires: - - Wed, 15 Dec 2021 19:39:57 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"company":"","address1":"Addr line 1","address2":"","city":"","zip":"LV-1111","phone":"","vatnumber":null,"country_code":"LV","billing_email":"ruby_rspec@example.com","state_code":""}' - recorded_at: Wed, 15 Dec 2021 19:39:58 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_team_user_chained.yml b/spec/fixtures/vcr_cassettes/update_team_user_chained.yml deleted file mode 100644 index 33ea325..0000000 --- a/spec/fixtures/vcr_cassettes/update_team_user_chained.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/users/26265 - body: - encoding: UTF-8 - string: '{"role":"admin"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:36:02 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=848105f40a1c9e2e6f18e410a21c1008; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:36:02 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"team_user":{"user_id":26265,"email":"demo@test.com","fullname":"updated!","created_at":"2018-12-13 - 17:22:21 (Etc\/UTC)","role":"admin"}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:35:54 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_team_user_group.yml b/spec/fixtures/vcr_cassettes/update_team_user_group.yml deleted file mode 100644 index fbfcdd9..0000000 --- a/spec/fixtures/vcr_cassettes/update_team_user_group.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/teams/176692/groups/690 - body: - encoding: UTF-8 - string: '{"name":"updated rspec","is_admin":true,"is_reviewer":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.1.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Sun, 19 May 2019 14:09:20 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=66c703890f0cfb916f1e889f621b6e24; expires=Thu, 18-Jul-2019 14:09:20 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"team_id":176692,"group":{"group_id":690,"name":"updated rspec","permissions":{"is_admin":true,"is_reviewer":true,"admin_rights":[],"languages":[]},"created_at":"2019-05-19 - 13:21:20 (Etc\/UTC)","created_at_timestamp":1558272080,"team_id":176692,"projects":[],"members":[]}}' - http_version: - recorded_at: Sun, 19 May 2019 14:09:21 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_translation.yml b/spec/fixtures/vcr_cassettes/update_translation.yml deleted file mode 100644 index 1d49857..0000000 --- a/spec/fixtures/vcr_cassettes/update_translation.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations/80015147 - body: - encoding: UTF-8 - string: '{"translation":"rspec trans","is_reviewed":true}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.0.0.pre1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 10 Dec 2018 18:04:09 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=6af39bf3cf8d0af5eeaf3560c108d5b9; path=/; HttpOnly, locale=en_US; - expires=Wed, 09-Jan-2019 18:04:08 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translation":{"translation_id":80015147,"key_id":15571975,"language_iso":"en","translation":"rspec - trans","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-10 - 19:04:08 (Etc\/UTC)","is_reviewed":true,"reviewed_by":0,"is_fuzzy":false,"words":2}}' - http_version: - recorded_at: Mon, 10 Dec 2018 18:04:08 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_translation_chained.yml b/spec/fixtures/vcr_cassettes/update_translation_chained.yml deleted file mode 100644 index 5a75fb5..0000000 --- a/spec/fixtures/vcr_cassettes/update_translation_chained.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/translations/82070312 - body: - encoding: UTF-8 - string: '{"translation":"chained updated"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/1.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Fri, 14 Dec 2018 17:41:20 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=562c0dd33c392aea9503061694c70ba2; path=/; HttpOnly, locale=en_US; - expires=Sun, 13-Jan-2019 17:41:19 GMT; Max-Age=2592000; path=/; secure - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","translation":{"translation_id":82070312,"key_id":15814906,"language_iso":"f_over","translation":"chained - updated","modified_by":20181,"modified_by_email":"bodrovis@protonmail.com","modified_at":"2018-12-14 - 17:41:19 (Etc\/UTC)","is_reviewed":false,"reviewed_by":0,"is_fuzzy":false,"words":2}}' - http_version: - recorded_at: Fri, 14 Dec 2018 17:41:12 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_translation_status.yml b/spec/fixtures/vcr_cassettes/update_translation_status.yml deleted file mode 100644 index 941c1ce..0000000 --- a/spec/fixtures/vcr_cassettes/update_translation_status.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/custom_translation_statuses/126 - body: - encoding: UTF-8 - string: '{"title":"Reviewed by rubyists","color":"#c377e0"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.2.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 17 Jul 2019 16:33:58 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=658e6fba5015422222663659fdbafbaf; expires=Sun, 15-Sep-2019 16:33:58 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","custom_translation_status":{"status_id":126,"title":"Reviewed - by rubyists","color":"#c377e0"}}' - http_version: - recorded_at: Wed, 17 Jul 2019 16:33:32 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/update_webhook.yml b/spec/fixtures/vcr_cassettes/update_webhook.yml deleted file mode 100644 index 0194c3e..0000000 --- a/spec/fixtures/vcr_cassettes/update_webhook.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/b345ccc6499920c490e8f4fe9487b1378dbf1dbf - body: - encoding: UTF-8 - string: '{"url":"http://ihaz.cheezburger"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 19 Aug 2019 20:02:54 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=2b4e2ad74fa14c3db9a09788fa3af337; expires=Fri, 18-Oct-2019 20:02:54 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhook":{"webhook_id":"b345ccc6499920c490e8f4fe9487b1378dbf1dbf","url":"http:\/\/ihaz.cheezburger","secret":"fd3a2ceab9e2e9d4f68f40b7c199a273e19492f8","events":["project.imported","project.exported"],"event_lang_map":[]}}' - http_version: - recorded_at: Mon, 19 Aug 2019 20:02:54 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/upload_file.yml b/spec/fixtures/vcr_cassettes/upload_file.yml deleted file mode 100644 index 77b6b87..0000000 --- a/spec/fixtures/vcr_cassettes/upload_file.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/files/upload - body: - encoding: UTF-8 - string: '{"data":"ZnI6DQogIHRlc3Q6IHRyYW5zbGF0aW9u","filename":"rspec_async.yml","lang_iso":"ru"}' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.1.0 - X-api-token: - - "" - response: - status: - code: 202 - message: Accepted - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Thu, 02 Jul 2020 15:17:18 GMT - location: - - "/api2/projects/803826145ba90b42d5d860.46800099/processes/85c42bf5eff44648ca2f01f9db67b7d306a2f282" - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Thu, 02 Jul 2020 15:17:19 GMT - body: - encoding: UTF-8 - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","process":{"process_id":"85c42bf5eff44648ca2f01f9db67b7d306a2f282","type":"file-import","status":"queued","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-07-02 - 15:17:19 (Etc\/UTC)","created_at_timestamp":1593703039}}' - recorded_at: Thu, 02 Jul 2020 15:17:18 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/upload_file_queued_reload.yml b/spec/fixtures/vcr_cassettes/upload_file_queued_reload.yml deleted file mode 100644 index c9ca6b2..0000000 --- a/spec/fixtures/vcr_cassettes/upload_file_queued_reload.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/processes/85c42bf5eff44648ca2f01f9db67b7d306a2f282 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Thu, 02 Jul 2020 15:18:56 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Thu, 02 Jul 2020 15:18:56 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","process":{"process_id":"85c42bf5eff44648ca2f01f9db67b7d306a2f282","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-07-02 - 15:17:19 (Etc\/UTC)","created_at_timestamp":1593703039,"details":{"files":[{"status":"finished","message":"","name_original":"rspec_async.yml","name_custom":null,"word_count_total":1,"key_count_total":1,"key_count_inserted":1,"key_count_updated":0,"key_count_skipped":0}]}}}' - recorded_at: Thu, 02 Jul 2020 15:18:55 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/upload_file_status.yml b/spec/fixtures/vcr_cassettes/upload_file_status.yml deleted file mode 100644 index b21317a..0000000 --- a/spec/fixtures/vcr_cassettes/upload_file_status.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/processes/85c42bf5eff44648ca2f01f9db67b7d306a2f282 - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/3.1.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - keep-alive - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Thu, 02 Jul 2020 15:20:25 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Thu, 02 Jul 2020 15:20:25 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","process":{"process_id":"85c42bf5eff44648ca2f01f9db67b7d306a2f282","type":"file-import","status":"finished","message":"","created_by":20181,"created_by_email":"bodrovis@protonmail.com","created_at":"2020-07-02 - 15:17:19 (Etc\/UTC)","created_at_timestamp":1593703039,"details":{"files":[{"status":"finished","message":"","name_original":"rspec_async.yml","name_custom":null,"word_count_total":1,"key_count_total":1,"key_count_inserted":1,"key_count_updated":0,"key_count_skipped":0}]}}}' - recorded_at: Thu, 02 Jul 2020 15:20:25 GMT -recorded_with: VCR 6.0.0 diff --git a/spec/fixtures/vcr_cassettes/webhook.yml b/spec/fixtures/vcr_cassettes/webhook.yml deleted file mode 100644 index d21a5e8..0000000 --- a/spec/fixtures/vcr_cassettes/webhook.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Mon, 19 Aug 2019 19:53:21 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=713f077e64ae86b03f500d4cb3af457c; expires=Fri, 18-Oct-2019 19:53:21 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhook":{"webhook_id":"c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d","url":"https:\/\/canihaz.hook","secret":"a62450cd9eeca8dfc84f3c0cf9b7a6a370267d6f","events":["project.snapshot","project.imported","project.exported","project.languages.added","project.language.removed","project.language.settings_changed","project.translation.updated"],"event_lang_map":[{"event":"project.translation.updated","lang_iso_codes":["sq","ar_001","bm","ca","custom_1","nl","en","en-us","f_over","ru","es"]}]}}' - http_version: - recorded_at: Mon, 19 Aug 2019 19:53:21 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/vcr_cassettes/webhook_2.yml b/spec/fixtures/vcr_cassettes/webhook_2.yml deleted file mode 100644 index dcbe0eb..0000000 --- a/spec/fixtures/vcr_cassettes/webhook_2.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks/795565582e5ab15a59bb68156c7e2e9eaa1e8d1a - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.9.0.1 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - cache-control: - - max-age=0, must-revalidate, no-cache, no-store, private - date: - - Fri, 28 Feb 2020 13:18:09 GMT - pragma: - - no-cache - x-content-type-options: - - nosniff - x-frame-options: - - deny - x-xss-protection: - - 1; mode=block - strict-transport-security: - - max-age=31536000 - expires: - - Fri, 28 Feb 2020 13:18:09 GMT - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","branch":"master","webhook":{"webhook_id":"795565582e5ab15a59bb68156c7e2e9eaa1e8d1a","url":"https:\/\/serios.webhook","secret":"2007af3a30e5028d321db292608172fa06666662","events":["project.imported","project.key.added","project.keys.deleted","project.translation.updated"],"event_lang_map":[{"event":"project.translation.updated","lang_iso_codes":["nl"]}]}}' - http_version: null - recorded_at: Fri, 28 Feb 2020 13:18:03 GMT -recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/webhooks.yml b/spec/fixtures/vcr_cassettes/webhooks.yml deleted file mode 100644 index b6ab2e3..0000000 --- a/spec/fixtures/vcr_cassettes/webhooks.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.lokalise.com/api2/projects/803826145ba90b42d5d860.46800099/webhooks - body: - encoding: US-ASCII - string: '' - headers: - Accept: - - application/json - User-Agent: - - ruby-lokalise-api gem/2.5.0 - X-api-token: - - "" - response: - status: - code: 200 - message: OK - headers: - server: - - nginx - date: - - Wed, 21 Aug 2019 12:03:29 GMT - content-type: - - application/json - transfer-encoding: - - chunked - connection: - - close - vary: - - Accept-Encoding - set-cookie: - - PHPSESSID=fd95fd34631dbc44a406e2d518e2c171; expires=Sun, 20-Oct-2019 12:03:29 - GMT; Max-Age=5184000; path=/; secure; HttpOnly - expires: - - Thu, 19 Nov 1981 08:52:00 GMT - cache-control: - - no-store, no-cache, must-revalidate, no-store, no-cache - pragma: - - no-cache, no-cache - x-pagination-total-count: - - '3' - x-pagination-page-count: - - '1' - x-pagination-limit: - - '100' - x-pagination-page: - - '1' - access-control-allow-origin: - - "*" - access-control-allow-headers: - - Content-Type - body: - encoding: ASCII-8BIT - string: '{"project_id":"803826145ba90b42d5d860.46800099","webhooks":[{"webhook_id":"795565582e5ab15a59bb68156c7e2e9eaa1e8d1a","url":"https:\/\/serios.webhook","secret":"5efb67362d6408c43e2cc541729e07925cf636d1","events":["project.imported","project.key.added","project.keys.deleted","project.translation.updated"],"event_lang_map":[{"event":"project.translation.updated","lang_iso_codes":["nl"]}]},{"webhook_id":"c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d","url":"https:\/\/canihaz.hook","secret":"a62450cd9eeca8dfc84f3c0cf9b7a6a370267d6f","events":["project.snapshot","project.imported","project.exported","project.languages.added","project.language.removed","project.language.settings_changed","project.translation.updated"],"event_lang_map":[{"event":"project.translation.updated","lang_iso_codes":["sq","ar_001","bm","ca","custom_1","nl","en","en-us","f_over","ru","es"]}]},{"webhook_id":"b1a98c63f7e8a03b1c7aadc0a8171d637b7a9e02","url":"http:\/\/node.hook","secret":"bd21b9b2983f3d7d2c2297294c90bb742f6cccae","events":["project.exported"],"event_lang_map":[]}]}' - http_version: - recorded_at: Wed, 21 Aug 2019 12:03:23 GMT -recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/webhooks/create_webhook.json b/spec/fixtures/webhooks/create_webhook.json new file mode 100644 index 0000000..0e84a10 --- /dev/null +++ b/spec/fixtures/webhooks/create_webhook.json @@ -0,0 +1,14 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhook": { + "webhook_id": "99c76b24e3dac9ddf5f839ad30a0c88601fd9a77", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "9d8df6602a94bfcd2de113635f36c9701822f678", + "events": [ + "project.snapshot", + "project.branch.merged" + ], + "event_lang_map": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/destroy_webhook.json b/spec/fixtures/webhooks/destroy_webhook.json new file mode 100644 index 0000000..8a99281 --- /dev/null +++ b/spec/fixtures/webhooks/destroy_webhook.json @@ -0,0 +1,4 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhook_deleted": true +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/regenerate_webhook_secret.json b/spec/fixtures/webhooks/regenerate_webhook_secret.json new file mode 100644 index 0000000..f3df84d --- /dev/null +++ b/spec/fixtures/webhooks/regenerate_webhook_secret.json @@ -0,0 +1,4 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "secret": "70fb5bd741511fe5204c14c58faaf1d38a920b0e" +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/update_webhook.json b/spec/fixtures/webhooks/update_webhook.json new file mode 100644 index 0000000..95d5552 --- /dev/null +++ b/spec/fixtures/webhooks/update_webhook.json @@ -0,0 +1,13 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhook": { + "webhook_id": "b47d698677ba426854ceee2982fe304d84c547f4", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "baa11503d459876a6ca11a51be54c65bf0f111c4", + "events": [ + "project.exported" + ], + "event_lang_map": [] + } +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/webhook.json b/spec/fixtures/webhooks/webhook.json new file mode 100644 index 0000000..c035db7 --- /dev/null +++ b/spec/fixtures/webhooks/webhook.json @@ -0,0 +1,27 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhook": { + "webhook_id": "b47d698677ba426854ceee2982fe304d84c547f4", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "baa11503d459876a6ca11a51be54c65bf0f111c4", + "events": [ + "project.translation.proofread", + "project.translations.proofread" + ], + "event_lang_map": [ + { + "event": "project.translation.proofread", + "lang_iso_codes": [ + "nl" + ] + }, + { + "event": "project.translations.proofread", + "lang_iso_codes": [ + "nl" + ] + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/webhooks.json b/spec/fixtures/webhooks/webhooks.json new file mode 100644 index 0000000..17d42a4 --- /dev/null +++ b/spec/fixtures/webhooks/webhooks.json @@ -0,0 +1,49 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhooks": [ + { + "webhook_id": "b47d698677ba426854ceee2982fe304d84c547f4", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "baa11503d459876a6ca11a51be54c65bf0f111c4", + "events": [ + "project.translation.proofread", + "project.translations.proofread" + ], + "event_lang_map": [ + { + "event": "project.translation.proofread", + "lang_iso_codes": [ + "nl" + ] + }, + { + "event": "project.translations.proofread", + "lang_iso_codes": [ + "nl" + ] + } + ] + }, + { + "webhook_id": "a139a53820e4e0cdb5b910988dccdcb27b8b2074", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "d128c8261b09e4d58fefc872ee52be72c35dd91f", + "events": [ + "project.exported" + ], + "event_lang_map": [] + }, + { + "webhook_id": "91406cf0845170ab007abe81ee2513542ec3febb", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "a418b3ea773655a2b7608cacd73f1977b463bbae", + "events": [ + "project.copied" + ], + "event_lang_map": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/webhooks_page1.json b/spec/fixtures/webhooks/webhooks_page1.json new file mode 100644 index 0000000..1b4f2d7 --- /dev/null +++ b/spec/fixtures/webhooks/webhooks_page1.json @@ -0,0 +1,39 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhooks": [ + { + "webhook_id": "b47d698677ba426854ceee2982fe304d84c547f4", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "baa11503d459876a6ca11a51be54c65bf0f111c4", + "events": [ + "project.translation.proofread", + "project.translations.proofread" + ], + "event_lang_map": [ + { + "event": "project.translation.proofread", + "lang_iso_codes": [ + "nl" + ] + }, + { + "event": "project.translations.proofread", + "lang_iso_codes": [ + "nl" + ] + } + ] + }, + { + "webhook_id": "a139a53820e4e0cdb5b910988dccdcb27b8b2074", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "d128c8261b09e4d58fefc872ee52be72c35dd91f", + "events": [ + "project.exported" + ], + "event_lang_map": [] + } + ] +} \ No newline at end of file diff --git a/spec/fixtures/webhooks/webhooks_page2.json b/spec/fixtures/webhooks/webhooks_page2.json new file mode 100644 index 0000000..b1e94e2 --- /dev/null +++ b/spec/fixtures/webhooks/webhooks_page2.json @@ -0,0 +1,15 @@ +{ + "project_id": "88628569645b945648b474.25982965", + "webhooks": [ + { + "webhook_id": "91406cf0845170ab007abe81ee2513542ec3febb", + "url": "https://bodrovis.tech/lokalise", + "branch": null, + "secret": "a418b3ea773655a2b7608cacd73f1977b463bbae", + "events": [ + "project.copied" + ], + "event_lang_map": [] + } + ] +} \ No newline at end of file diff --git a/spec/lib/ruby_lokalise_api/client/branches_spec.rb b/spec/lib/ruby_lokalise_api/client/branches_spec.rb deleted file mode 100644 index 314c59f..0000000 --- a/spec/lib/ruby_lokalise_api/client/branches_spec.rb +++ /dev/null @@ -1,152 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:branch_id) { 41_302 } - - describe '#branches' do - it 'returns all branches' do - branches = VCR.use_cassette('all_branches') do - test_client.branches project_id - end.collection - - expect(branches.count).to eq(4) - end - - it 'supports pagination' do - branches = VCR.use_cassette('all_branches_pagination') do - test_client.branches project_id, limit: 2, page: 2 - end - - expect(branches.collection.count).to eq(2) - expect(branches.total_results).to eq(4) - expect(branches.total_pages).to eq(2) - expect(branches.results_per_page).to eq(2) - expect(branches.current_page).to eq(2) - expect(branches.collection.first.name).to eq('merge-me') - end - end - - specify '#branch' do - branch = VCR.use_cassette('branch') do - test_client.branch project_id, branch_id - end - - expect(branch.branch_id).to eq(branch_id) - expect(branch.name).to eq('ruby-branch') - expect(branch.created_at).to eq('2019-10-30 14:24:41 (Etc/UTC)') - expect(branch.created_at_timestamp).to eq(1_572_445_481) - expect(branch.created_by).to eq(20_181) - expect(branch.created_by_email).to eq('bodrovis@protonmail.com') - end - - specify '#[]' do - branch = VCR.use_cassette('branch') do - test_client.branch project_id, branch_id - end - - expect(branch[:branch_id]).to eq(branch_id) - expect(branch[:project_id]).to eq(project_id) - expect(branch['name']).to eq('ruby-branch') - expect(branch['unknown_attr']).to be_nil - expect(branch[:unknown_attr]).to be_nil - end - - specify '#reload_data' do - branch = VCR.use_cassette('branch') do - test_client.branch project_id, branch_id - end - - reloaded_branch = VCR.use_cassette('branch') do - branch.reload_data - end - - expect(reloaded_branch.branch_id).to eq(branch.branch_id) - end - - specify '#create_branch' do - branch = VCR.use_cassette('create_branch') do - test_client.create_branch project_id, name: 'ruby-branch' - end - - expect(branch.name).to eq('ruby-branch') - end - - specify '#update_branch' do - branch = VCR.use_cassette('update_branch') do - test_client.update_branch project_id, branch_id, name: 'updated-ruby-branch' - end - - expect(branch.name).to eq('updated-ruby-branch') - end - - specify '#destroy_branch' do - response = VCR.use_cassette('destroy_branch') do - test_client.destroy_branch project_id, branch_id - end - - expect(response['project_id']).to eq(project_id) - expect(response['branch_deleted']).to be(true) - end - - specify '#merge_branch' do - branch = VCR.use_cassette('create_branch_to_merge') do - test_client.create_branch project_id, name: 'merge-me' - end - - expect(branch.name).to eq('merge-me') - - branch_id = branch.branch_id - - response = VCR.use_cassette('merge_branch') do - test_client.merge_branch project_id, branch_id, force_conflict_resolve_using: 'master' - end - - expect(response['project_id']).to eq(project_id) - expect(response['branch_merged']).to be(true) - expect(response['branch']['branch_id']).to eq(branch_id) - expect(response['branch']['name']).to eq(branch.name) - end - - context 'when branch methods are chained' do - it 'supports merge' do - branch = VCR.use_cassette('create_branch_to_merge2') do - test_client.create_branch project_id, name: 'merge-me-plz' - end - - expect(branch.name).to eq('merge-me-plz') - - branch_id = branch.branch_id - - response = VCR.use_cassette('merge_branch_chained') do - branch.merge force_conflict_resolve_using: 'master' - end - - expect(response['project_id']).to eq(project_id) - expect(response['branch_merged']).to be(true) - expect(response['branch']['branch_id']).to eq(branch_id) - expect(response['branch']['name']).to eq(branch.name) - end - - it 'supports update and destroy' do - branch = VCR.use_cassette('create_another_branch') do - test_client.create_branch project_id, name: 'ruby-second-branch' - end - - expect(branch.name).to eq('ruby-second-branch') - - branch = VCR.use_cassette('update_another_branch') do - branch.update name: 'updated-ruby-second-branch' - end - - expect(branch.name).to eq('updated-ruby-second-branch') - - response = VCR.use_cassette('destroy_another_branch') do - branch.destroy - end - - expect(response['project_id']).to eq(project_id) - expect(response['branch_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/comments_spec.rb b/spec/lib/ruby_lokalise_api/client/comments_spec.rb deleted file mode 100644 index 56a3c45..0000000 --- a/spec/lib/ruby_lokalise_api/client/comments_spec.rb +++ /dev/null @@ -1,118 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:key_id) { 15_305_182 } - let(:another_key_id) { 15_519_786 } - - describe '#comments' do - it 'returns all comments' do - comments = VCR.use_cassette('all_comments') do - test_client.comments project_id, key_id - end.collection - - expect(comments.count).to eq(3) - end - - it 'supports pagination' do - comments = VCR.use_cassette('all_comments_pagination') do - test_client.comments project_id, key_id, limit: 1, page: 2 - end - - expect(comments.collection.count).to eq(1) - expect(comments.total_results).to eq(3) - expect(comments.total_pages).to eq(3) - expect(comments.results_per_page).to eq(1) - expect(comments.current_page).to eq(2) - expect(comments.collection.first.comment).to eq('demo comment') - - expect(comments.next_page?).to be(true) - expect(comments.last_page?).to be(false) - expect(comments.prev_page?).to be(true) - expect(comments.first_page?).to be(false) - - expect(comments.client).to be_an_instance_of(described_class) - end - end - - specify '#comment' do - comment = VCR.use_cassette('comment') do - test_client.comment project_id, another_key_id, '800746' - end - - expect(comment.comment).to eq('rspec comment') - expect(comment.comment_id).to eq(800_746) - expect(comment.key_id).to eq(another_key_id) - expect(comment.added_by).to eq(20_181) - expect(comment.added_by_email).to eq('bodrovis@protonmail.com') - expect(comment.added_at).to eq('2018-12-09 18:41:44 (Etc/UTC)') - expect(comment.added_at_timestamp).to eq(1_544_380_904) - end - - specify '#reload_data' do - comment = VCR.use_cassette('comment') do - test_client.comment project_id, another_key_id, '800746' - end - - reloaded_comment = VCR.use_cassette('comment') do - comment.reload_data - end - - expect(reloaded_comment.key_id).to eq(comment.key_id) - end - - specify '#create_comments' do - comments = VCR.use_cassette('create_comments') do - test_client.create_comments project_id, key_id, [ - {comment: 'demo comment'}, - {comment: 'from rspec'} - ] - end - - first_comment = comments.collection.first - second_comment = comments.collection[1] - - expect(comments.project_id).to eq(project_id) - expect(first_comment.comment).to eq('demo comment') - expect(first_comment.key_id).to eq(key_id) - expect(second_comment.comment).to eq('from rspec') - expect(second_comment.key_id).to eq(key_id) - end - - specify '#project_comments' do - comments = VCR.use_cassette('project_comments') do - test_client.project_comments project_id - end - - comment = comments.collection.first - - expect(comments.total_results).to eq(3) - expect(comment.comment).to eq('test') - expect(comment.comment_id).to eq(767_938) - end - - specify '#destroy_comment' do - response = VCR.use_cassette('delete_comment') do - test_client.destroy_comment project_id, key_id, 767_938 - end - expect(response['project_id']).to eq(project_id) - expect(response['comment_deleted']).to be(true) - end - - context 'when comment methods are chained' do - it 'supports destroy' do - comment = VCR.use_cassette('create_another_comment') do - test_client.create_comments project_id, another_key_id, comment: 'chained comment' - end.collection.first - - expect(comment.comment).to eq('chained comment') - - delete_response = VCR.use_cassette('delete_comment_chained') do - comment.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['comment_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/contributors_spec.rb b/spec/lib/ruby_lokalise_api/client/contributors_spec.rb deleted file mode 100644 index 0e59efb..0000000 --- a/spec/lib/ruby_lokalise_api/client/contributors_spec.rb +++ /dev/null @@ -1,132 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:contributor_id) { 25_953 } - - describe '#contributors' do - it 'returns all contributors' do - contributors = VCR.use_cassette('all_contributors') do - test_client.contributors project_id - end.collection - - expect(contributors.count).to eq(2) - expect(contributors.first.fullname).to eq('John Doe') - end - - it 'supports pagination' do - contributors = VCR.use_cassette('all_contributors_pagination') do - test_client.contributors project_id, limit: 1, page: 2 - end - - expect(contributors.collection.count).to eq(1) - expect(contributors.total_results).to eq(2) - expect(contributors.total_pages).to eq(2) - expect(contributors.results_per_page).to eq(1) - expect(contributors.current_page).to eq(2) - - expect(contributors.next_page?).to be(false) - expect(contributors.last_page?).to be(true) - expect(contributors.prev_page?).to be(true) - expect(contributors.first_page?).to be(false) - end - end - - specify '#contributor' do - contributor = VCR.use_cassette('contributor') do - test_client.contributor project_id, '20181' - end - - expect(contributor.user_id).to eq(20_181) - expect(contributor.email).to eq('bodrovis@protonmail.com') - expect(contributor.fullname).to eq('Ilya B') - expect(contributor.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)') - expect(contributor.is_admin).to be(true) - expect(contributor.is_reviewer).to be(true) - expect(contributor.languages.first['lang_id']).to eq(803) - expect(contributor.admin_rights.first).to eq('upload') - expect(contributor.created_at_timestamp).to eq(1_534_865_725) - end - - specify '#reload_data' do - contributor = VCR.use_cassette('contributor') do - test_client.contributor project_id, '20181' - end - - reloaded_contributor = VCR.use_cassette('contributor') do - contributor.reload_data - end - - expect(reloaded_contributor.user_id).to eq(contributor.user_id) - end - - specify '#create_contributors' do - contributor = VCR.use_cassette('create_contributors') do - test_client.create_contributors project_id, - email: 'rspec@test.com', - fullname: 'Rspec test', - languages: [{ - lang_iso: 'en' - }, - { - lang_iso: 'ru' - }] - end.collection.first - - expect(contributor.fullname).to eq('Rspec test') - expect(contributor.email).to eq('rspec@test.com') - expect(contributor.languages[1]['lang_iso']).to eq('ru') - end - - specify '#update_contributor' do - contributor = VCR.use_cassette('update_contributor') do - test_client.update_contributor project_id, contributor_id, - languages: [{lang_iso: 'en'}] - end - - expect(contributor.user_id).to eq(contributor_id) - expect(contributor.languages[0]['lang_iso']).to eq('en') - expect(contributor.languages.length).to eq(1) - end - - specify '#destroy_contributor' do - response = VCR.use_cassette('delete_contributor') do - test_client.destroy_contributor project_id, contributor_id - end - expect(response['project_id']).to eq(project_id) - expect(response['contributor_deleted']).to be(true) - end - - context 'when contributor methods are chained' do - it 'supports update and destroy' do - contributor = VCR.use_cassette('create_another_contributor') do - test_client.create_contributors project_id, - email: 'demo@test.com', - fullname: 'chained', - languages: [{lang_iso: 'en'}] - end.collection.first - - expect(contributor.client.token).to eq(test_client.token) - expect(contributor.fullname).to eq('chained') - - id = contributor.user_id - path = contributor.path - - updated_contributor = VCR.use_cassette('update_contributor_chained') do - contributor.update fullname: 'updated!' - end - - expect(updated_contributor.client.token).to eq(test_client.token) - expect(updated_contributor.fullname).to eq('updated!') - expect(updated_contributor.user_id).to eq(id) - expect(updated_contributor.path).to eq(path) - - delete_response = VCR.use_cassette('delete_contributor_chained') do - updated_contributor.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['contributor_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/custom_translation_statuses_spec.rb b/spec/lib/ruby_lokalise_api/client/custom_translation_statuses_spec.rb deleted file mode 100644 index d5079f6..0000000 --- a/spec/lib/ruby_lokalise_api/client/custom_translation_statuses_spec.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:status_id) { 128 } - let(:new_status_id) { 126 } - - describe '#translation_statuses' do - it 'returns all statuses' do - statuses = VCR.use_cassette('all_translation_statuses') do - test_client.translation_statuses project_id - end.collection - - expect(statuses.count).to eq(3) - expect(statuses.first.status_id).to eq(status_id) - end - - it 'supports pagination' do - statuses = VCR.use_cassette('all_translation_statuses_pagination') do - test_client.translation_statuses project_id, limit: 1, page: 2 - end - - expect(statuses.collection.count).to eq(1) - expect(statuses.total_results).to eq(3) - expect(statuses.total_pages).to eq(3) - expect(statuses.results_per_page).to eq(1) - expect(statuses.current_page).to eq(2) - - expect(statuses.next_page?).to be(true) - expect(statuses.last_page?).to be(false) - expect(statuses.prev_page?).to be(true) - expect(statuses.first_page?).to be(false) - end - end - - specify '#translation_status' do - status = VCR.use_cassette('translation_status') do - test_client.translation_status project_id, status_id - end - - expect(status.status_id).to eq(status_id) - expect(status.title).to eq('random') - expect(status.color).to eq('#0079bf') - end - - specify '#reload_data' do - status = VCR.use_cassette('translation_status') do - test_client.translation_status project_id, status_id - end - - reloaded_status = VCR.use_cassette('translation_status') do - status.reload_data - end - - expect(reloaded_status.status_id).to eq(status.status_id) - end - - specify '#create_translation_status' do - title = 'Reviewed by doctors' - color = '#f2d600' - status = VCR.use_cassette('create_translation_status') do - test_client.create_translation_status project_id, - title: title, - color: color - end - - expect(status.title).to eq(title) - expect(status.color).to eq(color) - end - - specify '#update_translation_status' do - title = 'Reviewed by rubyists' - color = '#c377e0' - status = VCR.use_cassette('update_translation_status') do - test_client.update_translation_status project_id, new_status_id, - title: title, - color: color - end - - expect(status.title).to eq(title) - expect(status.color).to eq(color) - end - - specify '#destroy_translation_status' do - response = VCR.use_cassette('destroy_translation_status') do - test_client.destroy_translation_status project_id, new_status_id - end - - expect(response['project_id']).to eq(project_id) - expect(response['custom_translation_status_deleted']).to be(true) - end - - specify '#translation_status_colors' do - response = VCR.use_cassette('translation_status_colors') do - test_client.translation_status_colors project_id - end - - expect(response).to be_an(Array) - expect(response).to include('#f2d600') - end - - context 'when translation status methods are chained' do - it 'supports update and destroy' do - status = VCR.use_cassette('create_another_translation_status') do - test_client.create_translation_status project_id, - title: 'rspec', - color: '#c377e0' - end - - expect(status.title).to eq('rspec') - expect(status.color).to eq('#c377e0') - - status = VCR.use_cassette('update_another_translation_status') do - status.update( - title: 'updated rspec', - color: '#0079bf' - ) - end - - expect(status.title).to eq('updated rspec') - expect(status.color).to eq('#0079bf') - - response = VCR.use_cassette('delete_another_translation_status') do - status.destroy - end - - expect(response['project_id']).to eq(project_id) - expect(response['custom_translation_status_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/files_spec.rb b/spec/lib/ruby_lokalise_api/client/files_spec.rb deleted file mode 100644 index e290f23..0000000 --- a/spec/lib/ruby_lokalise_api/client/files_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:file_id) { 1_161_428 } - - describe '#files' do - it 'returns all files' do - files = VCR.use_cassette('files') do - test_client.files project_id - end.collection - - file = files.first - - expect(files.count).to eq(5) - expect(file.filename).to eq('%LANG_ISO%.yml') - expect(file.key_count).to eq(66) - end - - it 'supports pagination' do - files = VCR.use_cassette('all_files_pagination') do - test_client.files project_id, limit: 1, page: 1 - end - - expect(files.collection.count).to eq(1) - expect(files.total_results).to eq(1) - expect(files.total_pages).to eq(1) - expect(files.results_per_page).to eq(1) - expect(files.current_page).to eq(1) - - expect(files.next_page).to be_nil - expect(files.prev_page).to be_nil - end - end - - specify '#download_files' do - response = VCR.use_cassette('download_files') do - test_client.download_files project_id, - format: 'po', - original_filenames: true - end - - expect(response['project_id']).to eq(project_id) - expect(response['bundle_url']).to include('amazonaws.com') - end - - specify '#upload_file' do - process = VCR.use_cassette('upload_file') do - test_client.upload_file project_id, - data: 'ZnI6DQogIHRlc3Q6IHRyYW5zbGF0aW9u', - filename: 'rspec_async.yml', - lang_iso: 'ru' - end - - expect(process).to be_an_instance_of(RubyLokaliseApi::Resources::QueuedProcess) - expect(process.process_id).to eq('85c42bf5eff44648ca2f01f9db67b7d306a2f282') - expect(process.status).to eq('queued') - - reloaded_process = VCR.use_cassette('upload_file_queued_reload') do - process.reload_data - end - - expect(reloaded_process.process_id).to eq(process.process_id) - expect(reloaded_process.status).to eq('finished') - expect(reloaded_process.details['files'][0]['status']).to eq('finished') - end - - specify '#destroy_file' do - docs_project_id = '507504186242fccb32f015.15252556' - response = VCR.use_cassette('destroy_file') do - test_client.destroy_file docs_project_id, file_id - end - - expect(response['project_id']).to eq(docs_project_id) - expect(response['file_deleted']).to be(true) - end -end diff --git a/spec/lib/ruby_lokalise_api/client/jwt_spec.rb b/spec/lib/ruby_lokalise_api/client/jwt_spec.rb deleted file mode 100644 index e9ee3ce..0000000 --- a/spec/lib/ruby_lokalise_api/client/jwt_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '2273827860c1e2473eb195.11207948' } - - specify '#jwt' do - resp = VCR.use_cassette('jwt') do - test_client.jwt project_id - end - - expect(resp).to be_an_instance_of(RubyLokaliseApi::Resources::Jwt) - expect(resp.jwt).to include('eyJ0eXAiOiJKV1QiLCJ') - end -end diff --git a/spec/lib/ruby_lokalise_api/client/keys_spec.rb b/spec/lib/ruby_lokalise_api/client/keys_spec.rb deleted file mode 100644 index 130098a..0000000 --- a/spec/lib/ruby_lokalise_api/client/keys_spec.rb +++ /dev/null @@ -1,199 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:key_id) { 15_305_182 } - let(:new_key_id) { 15_519_770 } - - describe '#keys' do - it 'returns all keys' do - keys = VCR.use_cassette('all_keys') do - test_client.keys project_id - end.collection - - expect(keys.count).to eq(8) - end - - it 'supports pagination' do - keys = VCR.use_cassette('all_keys_pagination') do - test_client.keys project_id, limit: 2, page: 3 - end - - expect(keys.collection.count).to eq(2) - expect(keys.total_results).to eq(8) - expect(keys.total_pages).to eq(4) - expect(keys.results_per_page).to eq(2) - expect(keys.current_page).to eq(3) - - expect(keys.next_page?).to be(true) - expect(keys.last_page?).to be(false) - expect(keys.prev_page?).to be(true) - expect(keys.first_page?).to be(false) - end - end - - specify '#key' do - key = VCR.use_cassette('key') do - test_client.key project_id, 44_596_066, disable_references: 0 - end - - expect(key.key_id).to eq(44_596_066) - expect(key.project_id).to eq(project_id) - expect(key.branch).to eq('master') - expect(key.created_at).to eq('2020-05-11 11:20:33 (Etc/UTC)') - expect(key.created_at_timestamp).to eq(1_589_196_033) - expect(key.key_name['ios']).to eq('static_pages:index:welcome') - expect(key.filenames['web']).to eq('%LANG_ISO%.yml') - expect(key.description).to eq('') - expect(key.platforms).to eq(%w[web]) - expect(key.tags).to eq([]) - expect(key.comments).to eq([]) - expect(key.screenshots).to eq([]) - expect(key.translations.first['modified_by_email']).to eq('bodrovis@protonmail.com') - expect(key.is_plural).to be(false) - expect(key.plural_name).to eq('') - expect(key.is_hidden).to be(true) - expect(key.is_archived).to be(false) - expect(key.context).to eq('') - expect(key.base_words).to eq(1) - expect(key.char_limit).to eq(0) - expect(key.custom_attributes).to eq('') - expect(key.modified_at).to eq('2020-05-11 11:20:33 (Etc/UTC)') - expect(key.modified_at_timestamp).to eq(1_589_196_033) - expect(key.translations_modified_at).to eq('2020-05-15 10:44:42 (Etc/UTC)') - expect(key.translations_modified_at_timestamp).to eq(1_589_539_482) - end - - specify '#reload_data' do - key = VCR.use_cassette('key') do - test_client.key project_id, 44_596_066, disable_references: 0 - end - - reloaded_key = VCR.use_cassette('key') do - key.reload_data disable_references: 0 - end - - expect(reloaded_key.key_id).to eq(key.key_id) - end - - specify '#create_keys' do - keys = VCR.use_cassette('create_keys') do - test_client.create_keys project_id, key_name: 'rspec_k', platforms: %w[ios] - end - - key = keys.collection.first - - expect(keys.project_id).to eq(project_id) - expect(key.key_name['ios']).to eq('rspec_k') - expect(key.platforms).to eq(%w[ios]) - end - - specify '#update_key' do - key = VCR.use_cassette('update_key') do - test_client.update_key project_id, new_key_id, key_name: 'updated_rspec_k', description: 'desc here' - end - - expect(key.key_name['ios']).to eq('updated_rspec_k') - expect(key.platforms).to eq(%w[ios]) - expect(key.description).to eq('desc here') - end - - specify '#update_keys' do - keys = VCR.use_cassette('update_keys') do - test_client.update_keys project_id, [ - { - key_id: new_key_id, - description: 'bulk updated' - }, - { - key_id: key_id, - tags: %w[bulk upd] - } - ] - end - - # `update_keys` returns a collection but it should not be paginated - expect(keys.next_page?).to be(false) - expect(keys.prev_page?).to be(false) - - first_key = keys.collection.first - second_key = keys.collection[1] - - expect(first_key.key_id).to eq(key_id) - expect(first_key.key_name['ios']).to eq('test') - expect(first_key.tags).to eq(%w[bulk upd]) - - expect(second_key.key_id).to eq(new_key_id) - expect(second_key.key_name['web']).to eq('updated_rspec_k') - expect(second_key.description).to eq('bulk updated') - end - - specify '#destroy_key' do - response = VCR.use_cassette('delete_key') do - test_client.destroy_key project_id, '15519771' - end - - expect(response['project_id']).to eq(project_id) - expect(response['key_removed']).to be(true) - end - - specify '#destroy_keys' do - response = VCR.use_cassette('delete_keys') do - test_client.destroy_keys project_id, [new_key_id, key_id] - end - - expect(response['project_id']).to eq(project_id) - expect(response['keys_removed']).to be(true) - end - - context 'when key methods are chained' do - it 'supports update and destroy' do - key = VCR.use_cassette('create_another_key') do - test_client.create_keys project_id, key_name: 'chained_k', platforms: %w[ios] - end.collection.first - - expect(key.key_name['ios']).to eq('chained_k') - - path = key.path - - updated_key = VCR.use_cassette('update_key_chained') do - key.update key_name: 'updated!' - end - - expect(updated_key.client.token).to eq(test_client.token) - expect(updated_key.key_name['ios']).to eq('updated!') - expect(updated_key.path).to eq(path) - - delete_response = VCR.use_cassette('delete_key_chained') do - updated_key.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['key_removed']).to be(true) - end - end - - context 'when keys collection methods are chained' do - it 'supports destroy_all' do - keys = VCR.use_cassette('create_keys_collection') do - test_client.create_keys project_id, [ - { - key_name: 'key_collect1', platforms: %w[ios] - }, - { - key_name: 'key_collect2', platforms: %w[ios] - } - ] - end - - expect(keys.collection.length).to eq(2) - - delete_response = VCR.use_cassette('delete_all_keys_chained') do - keys.destroy_all - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['keys_removed']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/languages_spec.rb b/spec/lib/ruby_lokalise_api/client/languages_spec.rb deleted file mode 100644 index 8185f2e..0000000 --- a/spec/lib/ruby_lokalise_api/client/languages_spec.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:language_id) { 640 } - let(:new_language_id) { 894 } - - describe '#system_languages' do - it 'returns all system languages' do - languages = VCR.use_cassette('all_system_languages') do - test_client.system_languages - end.collection - - expect(languages.count).to eq(100) - expect(languages.first.lang_iso).to eq('ab') - end - - it 'supports pagination' do - languages = VCR.use_cassette('all_system_languages_pagination') do - test_client.system_languages limit: 10, page: 3 - end - - expect(languages.collection.count).to eq(10) - expect(languages.total_results).to eq(618) - expect(languages.total_pages).to eq(62) - expect(languages.results_per_page).to eq(10) - expect(languages.current_page).to eq(3) - end - end - - describe '#project_languages' do - it 'returns all project languages' do - languages = VCR.use_cassette('all_project_languages') do - test_client.project_languages project_id - end.collection - - expect(languages.count).to eq(3) - expect(languages.first.lang_iso).to eq('en') - end - - it 'supports pagination' do - languages = VCR.use_cassette('all_project_languages_pagination') do - test_client.project_languages project_id, limit: 1, page: 2 - end - - expect(languages.collection.count).to eq(1) - expect(languages.total_results).to eq(3) - expect(languages.total_pages).to eq(3) - expect(languages.results_per_page).to eq(1) - expect(languages.current_page).to eq(2) - end - end - - specify '#language' do - language = VCR.use_cassette('language') do - test_client.language project_id, language_id - end - - expect(language.lang_id).to eq(language_id) - expect(language.lang_iso).to eq('en') - expect(language.lang_name).to eq('English') - expect(language.is_rtl).to be(false) - expect(language.plural_forms).to eq(%w[one other]) - end - - specify '#reload_data' do - language = VCR.use_cassette('language') do - test_client.language project_id, language_id - end - - reloaded_language = VCR.use_cassette('language') do - language.reload_data - end - - expect(reloaded_language.lang_id).to eq(language.lang_id) - end - - specify '#create_languages' do - language = VCR.use_cassette('create_languages') do - test_client.create_languages project_id, lang_iso: 'ab', custom_name: 'rspec lang' - end.collection.first - - expect(language.lang_name).to eq('rspec lang') - expect(language.lang_iso).to eq('ab') - end - - specify '#update_language' do - language = VCR.use_cassette('update_language') do - test_client.update_language project_id, new_language_id, lang_name: 'updated lang', - plural_forms: %w[one] - end - - expect(language.lang_name).to eq('updated lang') - expect(language.lang_iso).to eq('ab') - expect(language.plural_forms).to eq(%w[one]) - end - - specify '#destroy_language' do - response = VCR.use_cassette('delete_language') do - test_client.destroy_language project_id, new_language_id - end - expect(response['project_id']).to eq(project_id) - expect(response['language_deleted']).to be(true) - end - - context 'when project language methods are chained' do - it 'supports update and destroy' do - language = VCR.use_cassette('create_another_language') do - test_client.create_languages project_id, lang_iso: 'ab', custom_name: 'chained lang' - end.collection.first - - expect(language.client.token).to eq(test_client.token) - expect(language.lang_name).to eq('chained lang') - - path = language.path - - updated_language = VCR.use_cassette('update_language_chained') do - language.update lang_name: 'updated!' - end - - expect(updated_language.client.token).to eq(test_client.token) - expect(updated_language.lang_name).to eq('updated!') - expect(updated_language.lang_id).to eq(language.lang_id) - expect(updated_language.path).to eq(path) - - delete_response = VCR.use_cassette('delete_language_chained') do - updated_language.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['language_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/orders_spec.rb b/spec/lib/ruby_lokalise_api/client/orders_spec.rb deleted file mode 100644 index 4668c44..0000000 --- a/spec/lib/ruby_lokalise_api/client/orders_spec.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:team_id) { 176_692 } - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:key_id) { 15_519_786 } - let(:order_id) { '201903198B2' } - let(:card_id) { 1774 } - - describe '#orders' do - it 'returns all orders' do - orders = VCR.use_cassette('all_orders') do - test_client.orders team_id - end.collection - - expect(orders.count).to eq(1) - expect(orders.first.order_id).to eq(order_id) - end - - it 'supports pagination' do - orders = VCR.use_cassette('all_orders_pagination') do - test_client.orders team_id, limit: 1, page: 1 - end - - expect(orders.collection.count).to eq(1) - expect(orders.total_results).to eq(1) - expect(orders.total_pages).to eq(1) - expect(orders.results_per_page).to eq(1) - expect(orders.current_page).to eq(1) - end - end - - specify '#order' do - order = VCR.use_cassette('order') do - test_client.order team_id, order_id - end - - expect(order.order_id).to eq(order_id) - expect(order.project_id).to eq(project_id) - expect(order.card_id).to eq(card_id) - expect(order.status).to eq('completed') - expect(order.created_at).to eq('2019-03-19 18:18:21 (Etc/UTC)') - expect(order.created_by).to eq(20_181) - expect(order.created_by_email).to eq('bodrovis@protonmail.com') - expect(order.source_language_iso).to eq('en') - expect(order.target_language_isos).to eq(%w[ru]) - expect(order.keys).to eq([key_id]) - expect(order.source_words['ru']).to eq(1) - expect(order.provider_slug).to eq('gengo') - expect(order.translation_style).to eq('friendly') - expect(order.translation_tier).to eq(1) - expect(order.translation_tier_name).to eq('Professional translator') - expect(order.briefing).to eq('Some briefing') - expect(order.total).to eq(0.07) - expect(order.payment_method).to be_nil - end - - specify '#reload_data' do - order = VCR.use_cassette('order') do - test_client.order team_id, order_id - end - - reloaded_order = VCR.use_cassette('order') do - order.reload_data - end - - expect(reloaded_order.order_id).to eq(order.order_id) - end - - specify '#create_order' do - order = VCR.use_cassette('create_order') do - test_client.create_order team_id, - project_id: project_id, - card_id: card_id, - briefing: 'Some briefing', - source_language_iso: 'en', - target_language_isos: [ - 'ru' - ], - keys: [ - key_id - ], - provider_slug: 'gengo', - translation_tier: '1' - end - - expect(order.order_id).to eq(order_id) - expect(order.status).to eq('in progress') - end - - it 'creates an order with dry run' do - order = VCR.use_cassette('create_order_dry_run') do - test_client.create_order team_id, - project_id: project_id, - card_id: card_id, - briefing: 'Some briefing', - source_language_iso: 'en', - target_language_isos: [ - 'ru' - ], - keys: [ - 74_189_435 - ], - provider_slug: 'gengo', - translation_tier: '1', - dry_run: true - end - - expect(order.order_id).to be_nil - expect(order.status).to eq('draft') - expect(order.dry_run).to be true - end -end diff --git a/spec/lib/ruby_lokalise_api/client/payment_cards_spec.rb b/spec/lib/ruby_lokalise_api/client/payment_cards_spec.rb deleted file mode 100644 index 0aa07cb..0000000 --- a/spec/lib/ruby_lokalise_api/client/payment_cards_spec.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:card_id) { 1773 } - - describe '#payment_cards' do - it 'returns all payment cards' do - cards = VCR.use_cassette('all_payment_cards') do - test_client.payment_cards - end - - expect(cards.user_id).to eq(20_181) - card = cards.collection.first - expect(card.card_id).to eq(1774) - expect(card.last4).to eq('0358') - end - - it 'supports pagination' do - cards = VCR.use_cassette('all_payment_cards_pagination') do - test_client.payment_cards limit: 1, page: 1 - end - - expect(cards.collection.count).to eq(1) - expect(cards.total_results).to eq(1) - expect(cards.total_pages).to eq(1) - expect(cards.results_per_page).to eq(1) - expect(cards.current_page).to eq(1) - - expect(cards.next_page?).to be(false) - expect(cards.last_page?).to be(true) - expect(cards.prev_page?).to be(false) - expect(cards.first_page?).to be(true) - end - end - - specify '#create_payment_card' do - card = VCR.use_cassette('new_payment_card') do - test_client.create_payment_card number: '4242424242424242', - cvc: '123', - exp_month: 1, - exp_year: 2030 - end - - expect(card.card_id).to eq(card_id) - expect(card.last4).to eq('4242') - end - - specify '#payment_card' do - card = VCR.use_cassette('payment_card') do - test_client.payment_card card_id - end - - expect(card.user_id).to eq(20_181) - expect(card.card_id).to eq(card_id) - expect(card.brand).to eq('Visa') - expect(card.last4).to eq('4242') - expect(card.created_at).to eq('2019-03-19 17:01:22 (Etc/UTC)') - end - - specify '#reload_data' do - card = VCR.use_cassette('payment_card') do - test_client.payment_card card_id - end - - reloaded_card = VCR.use_cassette('payment_card') do - card.reload_data - end - - expect(reloaded_card.card_id).to eq(card.card_id) - end - - specify '#destroy_payment_card' do - result = VCR.use_cassette('destroy_payment_card') do - test_client.destroy_payment_card card_id - end - - expect(result['card_deleted']).to be(true) - expect(result['card_id']).to eq(card_id) - end - - it 'supports chained destroy' do - card = VCR.use_cassette('payment_card') do - test_client.payment_card card_id - end - result = VCR.use_cassette('destroy_payment_card') do - card.destroy - end - - expect(result['card_deleted']).to be(true) - expect(result['card_id']).to eq(card_id) - end -end diff --git a/spec/lib/ruby_lokalise_api/client/projects_spec.rb b/spec/lib/ruby_lokalise_api/client/projects_spec.rb deleted file mode 100644 index 1c30951..0000000 --- a/spec/lib/ruby_lokalise_api/client/projects_spec.rb +++ /dev/null @@ -1,150 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:new_project_id) { '572222075c0953fd70d492.30502628' } - - describe '#projects' do - it 'returns all projects' do - projects = VCR.use_cassette('all_projects') do - test_client.projects - end.collection - project = projects.first - - expect(projects.count).to eq(5) - expect(project.name).to eq('demo phoenix') - end - - it 'supports pagination' do - projects = VCR.use_cassette('all_projects_pagination') do - test_client.projects limit: 1, page: 2 - end - - expect(projects.collection.count).to eq(1) - expect(projects.total_results).to eq(5) - expect(projects.total_pages).to eq(5) - expect(projects.results_per_page).to eq(1) - expect(projects.current_page).to eq(2) - - expect(projects.next_page?).to be(true) - expect(projects.last_page?).to be(false) - expect(projects.prev_page?).to be(true) - expect(projects.first_page?).to be(false) - end - end - - specify '#project' do - project = VCR.use_cassette('project') do - test_client.project '803826145ba90b42d5d860.46800099' - end - - expect(project.project_id).to eq('803826145ba90b42d5d860.46800099') - expect(project.name).to eq('demo phoenix') - expect(project.team_id).to eq(176_692) - expect(project.description).to eq('') - expect(project.created_at).to eq('2018-09-24 16:05:22 (Etc/UTC)') - expect(project.created_by).to eq(20_181) - expect(project.created_by_email).to eq('bodrovis@protonmail.com') - expect(project.created_at_timestamp).to eq(1_537_805_122) - expect(project.base_language_id).to eq(640) - expect(project.base_language_iso).to eq('en') - expect(project.settings['per_platform_key_names']).to be(false) - expect(project.statistics['progress_total']).to eq(18) - end - - specify '#reload_data' do - project = VCR.use_cassette('project') do - test_client.project '803826145ba90b42d5d860.46800099' - end - - reloaded_project = VCR.use_cassette('project') do - project.reload_data - end - - expect(reloaded_project.project_id).to eq(project.project_id) - end - - specify '#create_project' do - project = VCR.use_cassette('new_project') do - test_client.create_project name: 'rspec proj', description: 'demo project for rspec' - end - - expect(project.name).to eq('rspec proj') - expect(project.description).to eq('demo project for rspec') - expect(project.team_id).to eq(176_692) - end - - context 'with OAuth 2 token' do - it 'creates a project' do - name = 'OAuth 2 project' - description = 'Via OAuth 2' - project = VCR.use_cassette('oauth2/new_project') do - test_oauth2_client.create_project name: name, description: description - end - - expect(project.name).to eq(name) - expect(project.description).to eq(description) - end - end - - specify '#update_project' do - project = VCR.use_cassette('update_project') do - test_client.update_project new_project_id, - name: 'rspec proj updated', description: 'updated project for rspec' - end - - expect(project.name).to eq('rspec proj updated') - expect(project.description).to eq('updated project for rspec') - expect(project.team_id).to eq(176_692) - end - - specify '#empty_project' do - response = VCR.use_cassette('empty_project') do - test_client.empty_project new_project_id - end - - expect(response['project_id']).to eq(new_project_id) - expect(response['keys_deleted']).to be(true) - end - - specify '#destroy_project' do - response = VCR.use_cassette('delete_project') do - test_client.destroy_project new_project_id - end - expect(response['project_id']).to eq(new_project_id) - expect(response['project_deleted']).to be(true) - end - - context 'when project methods are chained' do - it 'supports update, empty, and destroy' do - project = VCR.use_cassette('create_another_project') do - test_client.create_project name: 'chained proj' - end - - expect(project.name).to eq('chained proj') - - path = project.path - - updated_project = VCR.use_cassette('update_project_chained') do - project.update name: 'updated!' - end - - expect(updated_project.client.token).to eq(test_client.token) - expect(updated_project.name).to eq('updated!') - expect(updated_project.path).to eq(path) - - empty_response = VCR.use_cassette('empty_project_chained') do - updated_project.empty - end - - expect(empty_response['project_id']).to eq(updated_project.project_id) - expect(empty_response['keys_deleted']).to be(true) - - delete_response = VCR.use_cassette('delete_project_chained') do - updated_project.destroy - end - - expect(delete_response['project_id']).to eq(updated_project.project_id) - expect(delete_response['project_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/queued_processes_spec.rb b/spec/lib/ruby_lokalise_api/client/queued_processes_spec.rb deleted file mode 100644 index 4dbfddd..0000000 --- a/spec/lib/ruby_lokalise_api/client/queued_processes_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:process_id) { '3b943469e6b3e324b5bdad639b122a623e6e7a1a' } - let(:queued_process_id) { '85c42bf5eff44648ca2f01f9db67b7d306a2f282' } - - describe '#queued_processes' do - it 'returns all queued processes' do - processes = VCR.use_cassette('all_queued_processes') do - test_client.queued_processes project_id - end - - expect(processes.branch).to eq('master') - processes = processes.collection - expect(processes.count).to eq(8) - expect(processes.first.process_id).to eq(process_id) - end - end - - specify '#queued_process' do - process = VCR.use_cassette('queued_process') do - test_client.queued_process project_id, process_id - end - - expect(process.branch).to eq('master') - expect(process.process_id).to eq(process_id) - expect(process.type).to eq('file-import') - expect(process.status).to eq('finished') - expect(process.message).to eq('') - expect(process.created_by).to eq(20_181) - expect(process.created_by_email).to eq('bodrovis@protonmail.com') - expect(process.created_at).to eq('2020-05-13 11:24:37 (Etc/UTC)') - expect(process.created_at_timestamp).to eq(1_589_369_077) - files = process.details['files'] - expect(files.count).to eq(1) - expect(files[0]['status']).to eq('finished') - expect(files[0]['name_original']).to eq('test_async.json') - end - - describe 'process status check' do - specify '#reload_data' do - queued_process = VCR.use_cassette('upload_file_status') do - test_client.queued_process project_id, queued_process_id - end - - expect(queued_process.status).to eq('finished') - - reloaded_process = VCR.use_cassette('upload_file_queued_reload') do - queued_process.reload_data - end - - expect(reloaded_process.process_id).to eq(queued_process.process_id) - expect(reloaded_process.status).to eq('finished') - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/screenshots_spec.rb b/spec/lib/ruby_lokalise_api/client/screenshots_spec.rb deleted file mode 100644 index 491ca08..0000000 --- a/spec/lib/ruby_lokalise_api/client/screenshots_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:screenshot_id) { 115_185 } - - describe '#screenshots' do - it 'returns all screenshots' do - screenshots = VCR.use_cassette('all_screenshots') do - test_client.screenshots project_id - end.collection - - expect(screenshots.count).to eq(1) - end - - it 'supports pagination' do - screenshots = VCR.use_cassette('all_screenshots_pagination') do - test_client.screenshots project_id, limit: 1, page: 1 - end - - expect(screenshots.collection.count).to eq(1) - expect(screenshots.total_results).to eq(1) - expect(screenshots.total_pages).to eq(1) - expect(screenshots.results_per_page).to eq(1) - expect(screenshots.current_page).to eq(1) - end - end - - specify '#screenshot' do - screenshot = VCR.use_cassette('screenshot') do - test_client.screenshot project_id, screenshot_id - end - - expect(screenshot.screenshot_id).to eq(screenshot_id) - expect(screenshot.key_ids).to eq([]) - expect(screenshot.url).to include('amazonaws.com') - expect(screenshot.title).to eq('rspec screen') - expect(screenshot.description).to eq('') - expect(screenshot.screenshot_tags).to eq([]) - expect(screenshot.width).to eq(125) - expect(screenshot.height).to eq(32) - end - - specify '#reload_data' do - screenshot = VCR.use_cassette('screenshot') do - test_client.screenshot project_id, screenshot_id - end - - reloaded_screenshot = VCR.use_cassette('screenshot') do - screenshot.reload_data - end - - expect(reloaded_screenshot.screenshot_id).to eq(screenshot.screenshot_id) - end - - specify '#create_screenshots' do - screenshot_from_file do |file| - screenshot = VCR.use_cassette('create_screenshots') do - test_client.create_screenshots project_id, data: file.read, title: 'rspec screen' - end.collection.first - - expect(screenshot.title).to eq('rspec screen') - expect(screenshot.url).to include('amazonaws.com') - end - end - - specify '#update_screenshot' do - screenshot = VCR.use_cassette('update_screenshot') do - test_client.update_screenshot project_id, screenshot_id, tags: %w[demo rspec], - description: 'demo desc' - end - - expect(screenshot.screenshot_id).to eq(screenshot_id) - expect(screenshot.screenshot_tags).to eq(%w[demo rspec]) - expect(screenshot.description).to eq('demo desc') - end - - specify '#destroy_screenshot' do - response = VCR.use_cassette('delete_screenshot') do - test_client.destroy_screenshot project_id, screenshot_id - end - expect(response['project_id']).to eq(project_id) - expect(response['screenshot_deleted']).to be(true) - end - - context 'when screenshot methods are chained' do - it 'supports update and destroy' do - screenshot = screenshot_from_file do |file| - VCR.use_cassette('create_another_screenshot') do - test_client.create_screenshots project_id, data: file.read, title: 'chained screen' - end.collection.first - end - - expect(screenshot.client.token).to eq(test_client.token) - expect(screenshot.title).to eq('chained screen') - - path = screenshot.path - - updated_screenshot = VCR.use_cassette('update_screenshot_chained') do - screenshot.update title: 'updated!' - end - - expect(updated_screenshot.client.token).to eq(test_client.token) - expect(updated_screenshot.title).to eq('updated!') - expect(updated_screenshot.screenshot_id).to eq(screenshot.screenshot_id) - expect(updated_screenshot.path).to eq(path) - - delete_response = VCR.use_cassette('delete_screenshot_chained') do - updated_screenshot.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['screenshot_deleted']).to be(true) - end - end -end - -def screenshot_from_file - file = File.open File.expand_path('spec/fixtures/screenshot_base64.txt') - begin - yield file - rescue StandardError => e - puts e - ensure - file.close - end -end diff --git a/spec/lib/ruby_lokalise_api/client/segments_spec.rb b/spec/lib/ruby_lokalise_api/client/segments_spec.rb deleted file mode 100644 index a43c264..0000000 --- a/spec/lib/ruby_lokalise_api/client/segments_spec.rb +++ /dev/null @@ -1,106 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '39066161618d4ecb9fdc12.00274309' } - let(:key_id) { 129_358_815 } - - describe '#segments' do - it 'returns all segments for a key under lang_iso' do - segments = VCR.use_cassette('all_key_segments') do - test_client.segments project_id, key_id, 'en' - end.collection - - expect(segments.count).to eq(4) - expect(segments.first.value).to eq('Hello!') - end - end - - describe '#segment' do - it 'returns a single segment' do - lang_iso = 'en' - segment_number = 2 - - segment = VCR.use_cassette('key_segment') do - test_client.segment project_id, key_id, lang_iso, segment_number - end - - expect(segment.key_id).to eq(key_id) - expect(segment.segment_number).to eq(segment_number) - expect(segment.language_iso).to eq(lang_iso) - expect(segment.modified_at).to eq('2021-11-22 16:46:50 (Etc/UTC)') - expect(segment.modified_at_timestamp).to eq(1_637_599_610) - expect(segment.modified_by).to eq(20_181) - expect(segment.modified_by_email).to eq('bodrovis@protonmail.com') - expect(segment.value).to eq('This is just a simple text.') - expect(segment.is_fuzzy).to be(false) - expect(segment.is_reviewed).to be(false) - expect(segment.reviewed_by).to eq(0) - expect(segment.words).to eq(6) - expect(segment.custom_translation_statuses.first['color']).to eq('#61bd4f') - end - - it 'allows to pass params' do - lang_iso = 'en' - segment_number = 2 - - segment = VCR.use_cassette('key_segment_params') do - test_client.segment project_id, key_id, lang_iso, segment_number, disable_references: '1' - end - - expect(segment.segment_number).to eq(segment_number) - expect(segment.value).to eq('This is just a simple text.') - expect(segment.language_iso).to eq(lang_iso) - end - end - - specify '#update_segment' do - lang_iso = 'en' - segment_number = 3 - - segment = VCR.use_cassette('update_key_segment') do - test_client.update_segment project_id, key_id, lang_iso, segment_number, - value: 'Updated via API', - is_reviewed: true - end - - expect(segment.segment_number).to eq(segment_number) - expect(segment.value).to eq('Updated via API') - expect(segment.language_iso).to eq(lang_iso) - end - - context 'when segment methods are chained' do - specify '#reload_data' do - lang_iso = 'en' - segment_number = 2 - - segment = VCR.use_cassette('key_segment') do - test_client.segment project_id, key_id, lang_iso, segment_number - end - - reloaded_segment = VCR.use_cassette('reload_key_segment') do - segment.reload_data - end - - expect(reloaded_segment.segment_number).to eq(segment_number) - expect(reloaded_segment.key_id).to eq(key_id) - end - - specify '#update' do - lang_iso = 'en' - segment_number = 4 - - segment = VCR.use_cassette('another_key_segment') do - test_client.segment project_id, key_id, lang_iso, segment_number - end - - updated_segment = VCR.use_cassette('update_key_segment_chained') do - segment.update value: 'Chain Updated', - is_fuzzy: true - end - - expect(updated_segment.segment_number).to eq(segment_number) - expect(updated_segment.is_fuzzy).to be(true) - expect(updated_segment.value).to eq('Chain Updated') - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/snapshots_spec.rb b/spec/lib/ruby_lokalise_api/client/snapshots_spec.rb deleted file mode 100644 index c2167e4..0000000 --- a/spec/lib/ruby_lokalise_api/client/snapshots_spec.rb +++ /dev/null @@ -1,117 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:snapshot_id) { 27_881 } - - describe '#snapshots' do - it 'returns all snapshots' do - snapshots = VCR.use_cassette('all_snapshots') do - test_client.snapshots project_id - end.collection - - snapshot = snapshots.first - - expect(snapshots.count).to eq(1) - expect(snapshot.title).to eq('test rspec') - expect(snapshot.snapshot_id).to eq(27_882) - expect(snapshot.created_at).to eq('2018-12-10 17:02:04 (Etc/UTC)') - expect(snapshot.created_by).to eq(20_181) - expect(snapshot.created_by_email).to eq('bodrovis@protonmail.com') - expect(snapshot.created_at_timestamp).to eq(1_544_461_324) - end - - it 'supports pagination' do - snapshots = VCR.use_cassette('all_snapshots_pagination') do - test_client.snapshots project_id, limit: 1, page: 2 - end - - expect(snapshots.collection.count).to eq(1) - expect(snapshots.total_results).to eq(2) - expect(snapshots.total_pages).to eq(2) - expect(snapshots.results_per_page).to eq(1) - expect(snapshots.current_page).to eq(2) - - expect(snapshots.next_page?).to be(false) - expect(snapshots.last_page?).to be(true) - expect(snapshots.prev_page?).to be(true) - expect(snapshots.first_page?).to be(false) - end - end - - specify '#create_snapshot' do - snapshot = VCR.use_cassette('create_snapshot') do - test_client.create_snapshot project_id, title: 'test rspec' - end - - expect(snapshot.title).to eq('test rspec') - end - - specify '#restore_snapshot' do - project = VCR.use_cassette('restore_snapshot') do - test_client.restore_snapshot project_id, snapshot_id - end - - expect(project.name).to eq('demo phoenix copy') - expect(project.created_by_email).to eq('bodrovis@protonmail.com') - # Restore creates a new copy of the project! - expect(project.project_id).not_to eq(project_id) - end - - specify '#destroy_snapshot' do - response = VCR.use_cassette('delete_snapshot') do - test_client.destroy_snapshot project_id, snapshot_id - end - - expect(response['project_id']).to eq(project_id) - expect(response['snapshot_deleted']).to be(true) - end - - context 'when snapshot methods are chained' do - it 'allows restored project to receive chained methods' do - snapshot = VCR.use_cassette('create_snapshot_for_chained') do - test_client.create_snapshot project_id, title: 'chained rspec snap' - end - - new_project = VCR.use_cassette('restore_snapshot_for_chained') do - snapshot.restore - end - - updated_project = VCR.use_cassette('restored_updated_project') do - new_project.update name: 'Restored and updated' - end - - expect(updated_project.client.token).to eq(test_client.token) - expect(updated_project.name).to eq('Restored and updated') - expect(updated_project.project_id).to eq(new_project.project_id) - - response = VCR.use_cassette('delete_restored_project') do - updated_project.destroy - end - - expect(response['project_id']).to eq(updated_project.project_id) - expect(response['project_deleted']).to be(true) - end - - it 'supports destroy and restore' do - snapshot = VCR.use_cassette('create_another_snapshot') do - test_client.create_snapshot project_id, title: 'chained' - end - - expect(snapshot.title).to eq('chained') - - restored_project = VCR.use_cassette('restore_snapshot_chained') do - snapshot.restore - end - - expect(restored_project.name).to eq('demo phoenix copy') - - delete_response = VCR.use_cassette('delete_snapshot_chained') do - snapshot.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['snapshot_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/tasks_spec.rb b/spec/lib/ruby_lokalise_api/client/tasks_spec.rb deleted file mode 100644 index 10a98cc..0000000 --- a/spec/lib/ruby_lokalise_api/client/tasks_spec.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:key_id) { 15_571_976 } - let(:task_id) { 4387 } - - describe '#tasks' do - it 'returns all tasks' do - tasks = VCR.use_cassette('all_tasks') do - test_client.tasks project_id - end.collection - - expect(tasks.count).to eq(3) - end - - it 'supports pagination' do - tasks = VCR.use_cassette('all_tasks_pagination') do - test_client.tasks project_id, limit: 2, page: 2 - end - - expect(tasks.collection.count).to eq(1) - expect(tasks.total_results).to eq(3) - expect(tasks.total_pages).to eq(2) - expect(tasks.results_per_page).to eq(2) - expect(tasks.current_page).to eq(2) - end - end - - specify '#task' do - task = VCR.use_cassette('task') do - test_client.task project_id, '11925' - end - - expect(task.task_id).to eq(11_925) - expect(task.title).to eq('node updated') - expect(task.description).to eq('') - expect(task.status).to eq('completed') - expect(task.progress).to eq(0) - expect(task.due_date).to be_nil - expect(task.due_date_timestamp).to be_nil - expect(task.keys_count).to eq(16) - expect(task.words_count).to eq(275) - expect(task.created_at).to eq('2019-05-13 16:15:26 (Etc/UTC)') - expect(task.created_at_timestamp).to eq(1_557_764_126) - expect(task.created_by).to eq(20_181) - expect(task.created_by_email).to eq('bodrovis@protonmail.com') - expect(task.can_be_parent).to be(false) - expect(task.task_type).to eq('review') - expect(task.parent_task_id).to be_nil - expect(task.closing_tags).to eq([]) - expect(task.languages.first['language_iso']).to eq('sq') - expect(task.auto_close_languages).to be(true) - expect(task.auto_close_task).to be(true) - expect(task.auto_close_items).to be(true) - expect(task.completed_by).to eq(20_181) - expect(task.completed_by_email).to eq('bodrovis@protonmail.com') - expect(task.completed_at).to eq('2019-10-01 11:09:12 (Etc/UTC)') - expect(task.completed_at_timestamp).to eq(1_569_928_152) - expect(task.do_lock_translations).to be(false) - expect(task.custom_translation_status_ids).to eq([]) - end - - specify '#reload_data' do - task = VCR.use_cassette('task') do - test_client.task project_id, '11925' - end - - reloaded_task = VCR.use_cassette('task') do - task.reload_data - end - - expect(reloaded_task.task_id).to eq(task.task_id) - end - - specify '#create_task' do - task = VCR.use_cassette('create_task') do - test_client.create_task project_id, title: 'another rspec key', - keys: [key_id], - languages: [ - { - language_iso: 'ru', - users: ['20181'] - } - ] - end - - expect(task.title).to eq('another rspec key') - expect(task.languages.first['language_iso']).to eq('ru') - end - - specify '#update_task' do - task = VCR.use_cassette('update_task') do - test_client.update_task project_id, task_id, description: 'desc here', auto_close_task: true - end - - expect(task.task_id).to eq(task_id) - expect(task.description).to eq('desc here') - expect(task.auto_close_task).to be(true) - end - - specify '#destroy_task' do - response = VCR.use_cassette('delete_task') do - test_client.destroy_task project_id, task_id - end - expect(response['project_id']).to eq(project_id) - expect(response['task_deleted']).to be(true) - end - - context 'when task methods are chained' do - it 'supports update and destroy' do - task = VCR.use_cassette('create_another_task') do - test_client.create_task project_id, title: 'chained', - keys: [key_id], - languages: [ - { - language_iso: 'ru', - users: ['20181'] - } - ] - end - - expect(task.client.token).to eq(test_client.token) - expect(task.title).to eq('chained') - - path = task.path - - updated_task = VCR.use_cassette('update_task_chained') do - task.update title: 'updated!' - end - - expect(updated_task.client.token).to eq(test_client.token) - expect(updated_task.title).to eq('updated!') - expect(updated_task.task_id).to eq(task.task_id) - expect(updated_task.path).to eq(path) - - delete_response = VCR.use_cassette('delete_task_chained') do - updated_task.destroy - end - - expect(delete_response['project_id']).to eq(project_id) - expect(delete_response['task_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/team_user_billing_details_spec.rb b/spec/lib/ruby_lokalise_api/client/team_user_billing_details_spec.rb deleted file mode 100644 index 8747ecd..0000000 --- a/spec/lib/ruby_lokalise_api/client/team_user_billing_details_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:team_id) { 176_692 } - let(:team_id2) { 273_879 } - - specify '#team_user_billing_details' do - details = VCR.use_cassette('team_user_billing_details') do - test_client.team_user_billing_details team_id - end - - expect(details.billing_email).to eq('hello@example.com') - expect(details.country_code).to eq('LV') - expect(details.zip).to eq('LV-6543') - expect(details.state_code).to eq('') - expect(details.address1).to eq('Sample line 1') - expect(details.address2).to eq('Sample line 2') - expect(details.city).to eq('Riga') - expect(details.phone).to eq('+371123456') - expect(details.company).to eq('Self-employed') - expect(details.vatnumber).to eq('123') - end - - specify '#create_team_user_billing_details' do - details = VCR.use_cassette('create_team_user_billing_details') do - test_client.create_team_user_billing_details team_id2, billing_email: 'ruby@example.com', - country_code: 'LV', - zip: 'LV-1111' - end - - expect(details.billing_email).to eq('ruby@example.com') - expect(details.country_code).to eq('LV') - expect(details.address1).to eq('') - end - - specify '#update_team_user_billing_details' do - details = VCR.use_cassette('update_team_user_billing_details') do - test_client.update_team_user_billing_details team_id2, billing_email: 'ruby_rspec@example.com', - country_code: 'LV', - zip: 'LV-1111', - address1: 'Addr line 1' - end - - expect(details.billing_email).to eq('ruby_rspec@example.com') - expect(details.country_code).to eq('LV') - expect(details.address1).to eq('Addr line 1') - end -end diff --git a/spec/lib/ruby_lokalise_api/client/team_user_groups_spec.rb b/spec/lib/ruby_lokalise_api/client/team_user_groups_spec.rb deleted file mode 100644 index 7d14063..0000000 --- a/spec/lib/ruby_lokalise_api/client/team_user_groups_spec.rb +++ /dev/null @@ -1,278 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:team_id) { 176_692 } - let(:group_id) { 515 } - let(:second_group_id) { 690 } - let(:third_group_id) { 689 } - let(:project_id) { '605317925c13e4ecb36a79.94825279' } - let(:another_project_id) { '446952185c01a12b4d0b45.76217122' } - let(:user_id) { 35_554 } - - describe '#team_user_groups' do - it 'returns all team_user_groups' do - team_user_groups = VCR.use_cassette('team_user_groups') do - test_client.team_user_groups team_id - end - - expect(team_user_groups.collection.count).to eq(2) - expect(team_user_groups.team_id).to eq(team_id) - end - - it 'supports pagination' do - team_users = VCR.use_cassette('team_user_groups_pagination') do - test_client.team_user_groups team_id, limit: 1, page: 2 - end - - expect(team_users.collection.count).to eq(1) - expect(team_users.total_results).to eq(2) - expect(team_users.total_pages).to eq(2) - expect(team_users.results_per_page).to eq(1) - expect(team_users.current_page).to eq(2) - end - end - - specify '#team_user_group' do - group = VCR.use_cassette('team_user_group') do - test_client.team_user_group team_id, group_id - end - - expect(group.group_id).to eq(group_id) - expect(group.name).to eq('Demo') - expect(group.permissions['is_admin']).to be(true) - expect(group.created_at).to eq('2019-03-19 19:53:04 (Etc/UTC)') - expect(group.created_at_timestamp).to eq(1_553_025_184) - expect(group.team_id).to eq(team_id) - expect(group.projects.first).to eq('803826145ba90b42d5d860.46800099') - expect(group.members[1]).to eq(25_753) - - reloaded_group = VCR.use_cassette('team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - end - - specify '#create_team_user_group' do - group = VCR.use_cassette('create_team_user_group') do - test_client.create_team_user_group team_id, name: 'RSpec group', - is_reviewer: false, - is_admin: false, - languages: { - reference: [], - contributable: [640] - } - end - - expect(group.name).to eq('RSpec group') - expect(group.team_id).to eq(team_id) - - reloaded_group = VCR.use_cassette('created_team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - end - - specify '#update_team_user_group' do - group = VCR.use_cassette('update_team_user_group') do - test_client.update_team_user_group team_id, second_group_id, - name: 'updated rspec', is_admin: true, - is_reviewer: true - end - - expect(group.name).to eq('updated rspec') - expect(group.team_id).to eq(team_id) - expect(group.permissions['is_admin']).to be(true) - expect(group.permissions['is_reviewer']).to be(true) - end - - specify '#destroy_team_user_group' do - response = VCR.use_cassette('destroy_team_user_group') do - test_client.destroy_team_user_group team_id, second_group_id - end - expect(response['team_id']).to eq(team_id) - expect(response['group_deleted']).to be(true) - end - - specify '#add_projects_to_group' do - group = VCR.use_cassette('add_projects_to_group') do - test_client.add_projects_to_group team_id, third_group_id, project_id - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(third_group_id) - expect(group.projects).to include(project_id) - - reloaded_group = VCR.use_cassette('another_team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('add_projects_to_group') do - group.add_projects projects: [project_id] - end - expect(group.group_id).to eq(third_group_id) - end - - specify '#remove_projects_from_group' do - group = VCR.use_cassette('remove_projects_from_group') do - test_client.remove_projects_from_group team_id, third_group_id, another_project_id - end - - expect(group.group_id).to eq(third_group_id) - expect(group.team_id).to eq(team_id) - expect(group.projects).to be_empty - - reloaded_group = VCR.use_cassette('another_team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('remove_projects_from_group') do - group.remove_projects projects: [project_id] - end - expect(group.group_id).to eq(third_group_id) - end - - specify '#add_users_to_group' do - group = VCR.use_cassette('add_users_to_group') do - test_client.add_users_to_group team_id, third_group_id, user_id - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(third_group_id) - expect(group.members).to include(user_id) - - reloaded_group = VCR.use_cassette('another_team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('add_users_to_group') do - group.add_users users: [user_id] - end - end - - specify '#remove_users_from_group' do - group = VCR.use_cassette('remove_users_from_group') do - test_client.remove_users_from_group team_id, third_group_id, user_id - end - - expect(group.group_id).to eq(third_group_id) - expect(group.team_id).to eq(team_id) - expect(group.members).to be_empty - - reloaded_group = VCR.use_cassette('another_team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('remove_users_from_group') do - group.remove_users users: [user_id] - end - end - - context 'when team user group methods are chained' do - it 'supports update and destroy' do - group = VCR.use_cassette('another_team_user_group') do - test_client.team_user_group team_id, third_group_id - end - - expect(group.group_id).to eq(third_group_id) - - group = VCR.use_cassette('update_another_team_user_group') do - group.update name: 'another group updated', is_admin: true, is_reviewer: true - end - - expect(group.group_id).to eq(third_group_id) - expect(group.permissions['is_admin']).to be(true) - expect(group.name).to eq('another group updated') - - response = VCR.use_cassette('destroy_another_team_user_group') do - group.destroy - end - - expect(response['team_id']).to eq(team_id) - expect(response['group_deleted']).to be(true) - end - - it 'supports project management' do - group = VCR.use_cassette('team_user_group') do - test_client.team_user_group team_id, group_id - end - - group = VCR.use_cassette('add_project_to_group_chained') do - group.add_projects(projects: [another_project_id]) - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(group_id) - expect(group.projects).to include(another_project_id) - - group = VCR.use_cassette('add_project_to_group_chained') do - group.add_projects(projects: [another_project_id]) - end - - reloaded_group = VCR.use_cassette('team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('remove_project_from_group_chained') do - group.remove_projects(projects: [another_project_id]) - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(group_id) - expect(group.projects).not_to include(another_project_id) - - group = VCR.use_cassette('remove_project_from_group_chained') do - group.remove_projects(projects: [another_project_id]) - end - - reloaded_group = VCR.use_cassette('team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - end - - it 'supports users management' do - group = VCR.use_cassette('team_user_group') do - test_client.team_user_group team_id, group_id - end - - group = VCR.use_cassette('add_user_to_group_chained') do - group.add_users(users: [user_id]) - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(group_id) - expect(group.members).to include(user_id) - - group = VCR.use_cassette('add_user_to_group_chained') do - group.add_users(users: [user_id]) - end - - reloaded_group = VCR.use_cassette('team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - - group = VCR.use_cassette('remove_user_from_group_chained') do - group.remove_users(users: [user_id]) - end - - expect(group.team_id).to eq(team_id) - expect(group.group_id).to eq(group_id) - expect(group.members).not_to include(user_id) - - group = VCR.use_cassette('remove_user_from_group_chained') do - group.remove_users(users: [user_id]) - end - - reloaded_group = VCR.use_cassette('team_user_group') do - group.reload_data - end - expect(reloaded_group.group_id).to eq(group.group_id) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/team_users_spec.rb b/spec/lib/ruby_lokalise_api/client/team_users_spec.rb deleted file mode 100644 index 755eb7c..0000000 --- a/spec/lib/ruby_lokalise_api/client/team_users_spec.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:team_id) { 176_692 } - let(:team_user_id) { 25_953 } - let(:another_user_id) { 26_265 } - - describe '#team_users' do - it 'returns all team_users' do - team_users = VCR.use_cassette('team_users') do - test_client.team_users team_id - end - - expect(team_users.collection.count).to eq(4) - expect(team_users.team_id).to eq(team_id) - end - - it 'supports pagination' do - team_users = VCR.use_cassette('all_team_users_pagination') do - test_client.team_users team_id, limit: 1, page: 3 - end - - expect(team_users.collection.count).to eq(1) - expect(team_users.total_results).to eq(4) - expect(team_users.total_pages).to eq(4) - expect(team_users.results_per_page).to eq(1) - expect(team_users.current_page).to eq(3) - end - end - - specify '#team_user' do - team_user = VCR.use_cassette('team_user') do - test_client.team_user team_id, '20181' - end - - expect(team_user.team_id).to eq(team_id) - expect(team_user.user_id).to eq(20_181) - expect(team_user.email).to eq('bodrovis@protonmail.com') - expect(team_user.fullname).to eq('Ilya B') - expect(team_user.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)') - expect(team_user.created_at_timestamp).to eq(1_534_865_725) - expect(team_user.role).to eq('owner') - end - - specify '#reload_data' do - team_user = VCR.use_cassette('team_user') do - test_client.team_user team_id, '20181' - end - - reloaded_team_user = VCR.use_cassette('team_user') do - team_user.reload_data - end - - expect(reloaded_team_user.user_id).to eq(team_user.user_id) - end - - specify '#update_team_user' do - team_user = VCR.use_cassette('update_team_user') do - test_client.update_team_user team_id, team_user_id, role: 'admin' - end - - expect(team_user.user_id).to eq(team_user_id) - expect(team_user.role).to eq('admin') - end - - specify '#destroy_team_user' do - response = VCR.use_cassette('delete_team_user') do - test_client.destroy_team_user team_id, team_user_id - end - expect(response['team_id']).to eq(team_id) - expect(response['team_user_deleted']).to be(true) - end - - context 'when team user methods are chained' do - it 'supports update and destroy' do - team_user = VCR.use_cassette('another_team_user') do - test_client.team_user team_id, another_user_id - end - - updated_team_user = VCR.use_cassette('update_team_user_chained') do - team_user.update role: 'admin' - end - - expect(updated_team_user.client.token).to eq(test_client.token) - expect(updated_team_user.role).to eq('admin') - - delete_response = VCR.use_cassette('delete_team_user_chained') do - updated_team_user.destroy - end - - expect(delete_response['team_id']).to eq(team_id) - expect(delete_response['team_user_deleted']).to be(true) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/teams_spec.rb b/spec/lib/ruby_lokalise_api/client/teams_spec.rb deleted file mode 100644 index f42209c..0000000 --- a/spec/lib/ruby_lokalise_api/client/teams_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - specify '#teams' do - teams = VCR.use_cassette('teams') do - test_client.teams page: 2, limit: 1 - end - - team = teams.collection.first - - expect(teams.collection.length).to eq(1) - expect(teams.total_results).to eq(2) - expect(teams.total_pages).to eq(2) - expect(teams.results_per_page).to eq(1) - expect(teams.current_page).to eq(2) - - expect(team.team_id).to eq(176_692) - expect(team.name).to eq('Ilya\'s Team') - expect(team.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)') - expect(team.created_at_timestamp).to eq(1_534_865_725) - expect(team.plan).to eq('Trial') - expect(team.quota_usage['users']).to eq(9) - expect(team.quota_allowed['keys']).to eq(999_999_999) - end -end diff --git a/spec/lib/ruby_lokalise_api/client/translation_providers_spec.rb b/spec/lib/ruby_lokalise_api/client/translation_providers_spec.rb deleted file mode 100644 index e46b34f..0000000 --- a/spec/lib/ruby_lokalise_api/client/translation_providers_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:team_id) { 176_692 } - - describe '#translation_providers' do - it 'returns all providers' do - providers = VCR.use_cassette('all_translation_providers') do - test_client.translation_providers team_id - end.collection - - expect(providers.count).to eq(2) - expect(providers.first.slug).to eq('gengo') - end - - it 'supports pagination' do - providers = VCR.use_cassette('all_translation_providers_pagination') do - test_client.translation_providers team_id, limit: 1, page: 2 - end - - expect(providers.collection.count).to eq(1) - expect(providers.total_results).to eq(2) - expect(providers.total_pages).to eq(2) - expect(providers.results_per_page).to eq(1) - expect(providers.current_page).to eq(2) - end - end - - specify '#translation_provider' do - provider = VCR.use_cassette('translation_provider') do - test_client.translation_provider team_id, 1 - end - - expect(provider.provider_id).to eq(1) - expect(provider.name).to eq('Gengo') - expect(provider.slug).to eq('gengo') - expect(provider.price_pair_min).to eq('0.00') - expect(provider.website_url).to eq('https://gengo.com') - expect(provider.description.start_with?('At')).to be(true) - expect(provider.tiers.first['title']).to eq('Native speaker') - expect(provider.pairs.first['price_per_word']).to eq('0.05') - - reloaded_provider = VCR.use_cassette('translation_provider') do - provider.reload_data - end - expect(reloaded_provider.provider_id).to eq(provider.provider_id) - end -end diff --git a/spec/lib/ruby_lokalise_api/client/translations_spec.rb b/spec/lib/ruby_lokalise_api/client/translations_spec.rb deleted file mode 100644 index d156727..0000000 --- a/spec/lib/ruby_lokalise_api/client/translations_spec.rb +++ /dev/null @@ -1,118 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:translation_id) { 80_015_147 } - let(:another_translation_id) { 82_070_312 } - - describe '#translations' do - it 'returns all translations' do - translations = VCR.use_cassette('translations') do - test_client.translations project_id - end.collection - - expect(translations.count).to eq(9) - end - - it 'supports pagination' do - translations = VCR.use_cassette('all_translations_pagination') do - test_client.translations project_id, limit: 4, page: 2, disable_references: 0, - filter_is_reviewed: 0 - end - - expect(translations.collection.count).to eq(4) - expect(translations.total_results).to eq(187) - expect(translations.total_pages).to eq(47) - expect(translations.results_per_page).to eq(4) - expect(translations.current_page).to eq(2) - expect(translations.request_params[:page]).to eq(2) - expect(translations.request_params[:disable_references]).to eq(0) - expect(translations.request_params[:filter_is_reviewed]).to eq(0) - - next_page_trans = VCR.use_cassette('translations_next_page') do - translations.next_page - end - - expect(next_page_trans).to be_an_instance_of(RubyLokaliseApi::Collections::Translation) - expect(next_page_trans.client).to be_an_instance_of(described_class) - expect(next_page_trans.request_params[:page]).to eq(3) - expect(next_page_trans.request_params[:disable_references]).to eq(0) - expect(next_page_trans.total_results).to eq(187) - expect(next_page_trans.current_page).to eq(3) - expect(next_page_trans.next_page?).to be(true) - expect(next_page_trans.prev_page?).to be(true) - - prev_page_trans = VCR.use_cassette('translations_prev_page') do - translations.prev_page - end - - expect(prev_page_trans).to be_an_instance_of(RubyLokaliseApi::Collections::Translation) - expect(prev_page_trans.client).to be_an_instance_of(described_class) - expect(prev_page_trans.request_params[:page]).to eq(1) - expect(next_page_trans.request_params[:disable_references]).to eq(0) - expect(prev_page_trans.total_results).to eq(187) - expect(prev_page_trans.current_page).to eq(1) - expect(prev_page_trans.next_page?).to be(true) - expect(prev_page_trans.prev_page?).to be(false) - end - end - - specify '#translation' do - translation = VCR.use_cassette('translation') do - test_client.translation project_id, 304_581_218 - end - - expect(translation.translation_id).to eq(304_581_218) - expect(translation.key_id).to eq(44_596_059) - expect(translation.language_iso).to eq('ru') - expect(translation.modified_at).to eq('2020-05-15 10:44:42 (Etc/UTC)') - expect(translation.modified_at_timestamp).to eq(1_589_539_482) - expect(translation.modified_by).to eq(20_181) - expect(translation.modified_by_email).to eq('bodrovis@protonmail.com') - expect(translation.translation).to eq('Сообщение') - expect(translation.is_fuzzy).to be(false) - expect(translation.is_reviewed).to be(false) - expect(translation.words).to eq(1) - expect(translation.custom_translation_statuses).to eq([]) - expect(translation.task_id).to be_nil - end - - specify '#reload_data' do - translation = VCR.use_cassette('translation') do - test_client.translation project_id, 304_581_218 - end - - reloaded_translation = VCR.use_cassette('translation') do - translation.reload_data - end - - expect(reloaded_translation.translation_id).to eq(translation.translation_id) - end - - specify '#update_translation' do - translation = VCR.use_cassette('update_translation') do - test_client.update_translation project_id, translation_id, translation: 'rspec trans', - is_reviewed: true - end - - expect(translation.translation_id).to eq(translation_id) - expect(translation.translation).to eq('rspec trans') - expect(translation.is_reviewed).to be(true) - end - - context 'when translation chained methods are used' do - it 'supports update' do - translation = VCR.use_cassette('another_translation') do - test_client.translation project_id, another_translation_id - end - - updated_translation = VCR.use_cassette('update_translation_chained') do - translation.update translation: 'chained updated' - end - - expect(updated_translation.client.token).to eq(test_client.token) - expect(updated_translation.translation).to eq('chained updated') - expect(updated_translation.translation_id).to eq(translation.translation_id) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client/webhooks_spec.rb b/spec/lib/ruby_lokalise_api/client/webhooks_spec.rb deleted file mode 100644 index eff45ce..0000000 --- a/spec/lib/ruby_lokalise_api/client/webhooks_spec.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Client do - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:webhook_id) { 'c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d' } - let(:new_webhook_id) { 'b345ccc6499920c490e8f4fe9487b1378dbf1dbf' } - let(:serious_webhook_id) { '795565582e5ab15a59bb68156c7e2e9eaa1e8d1a' } - - describe '#webhooks' do - it 'returns all webhooks' do - webhooks = VCR.use_cassette('webhooks') do - test_client.webhooks project_id - end.collection - - expect(webhooks.count).to eq(3) - expect(webhooks.first.url).to eq('https://serios.webhook') - end - - it 'supports pagination' do - webhooks = VCR.use_cassette('all_webhooks_pagination') do - test_client.webhooks project_id, limit: 1, page: 2 - end - - expect(webhooks.collection.count).to eq(1) - expect(webhooks.total_results).to eq(3) - expect(webhooks.total_pages).to eq(3) - expect(webhooks.results_per_page).to eq(1) - expect(webhooks.current_page).to eq(2) - end - end - - specify '#webhook' do - webhook = VCR.use_cassette('webhook') do - test_client.webhook project_id, webhook_id - end - - expect(webhook.webhook_id).to eq(webhook_id) - expect(webhook.url).to eq('https://canihaz.hook') - expect(webhook.secret).to eq('a62450cd9eeca8dfc84f3c0cf9b7a6a370267d6f') - expect(webhook.events).to include('project.snapshot') - expect(webhook.event_lang_map.first['event']).to eq('project.translation.updated') - end - - specify '#reload_data' do - webhook = VCR.use_cassette('webhook') do - test_client.webhook project_id, webhook_id - end - - reloaded_webhook = VCR.use_cassette('webhook') do - webhook.reload_data - end - - expect(reloaded_webhook.webhook_id).to eq(webhook.webhook_id) - end - - specify '#create_webhook' do - webhook = VCR.use_cassette('create_webhook') do - test_client.create_webhook project_id, - url: 'http://thatz.ahook', - events: ['project.imported', 'project.exported'] - end - - expect(webhook.webhook_id).to eq(new_webhook_id) - expect(webhook.url).to eq('http://thatz.ahook') - expect(webhook.events).to include('project.imported', 'project.exported') - end - - specify '#update_webhook' do - webhook = VCR.use_cassette('update_webhook') do - test_client.update_webhook project_id, - new_webhook_id, - url: 'http://ihaz.cheezburger' - end - - expect(webhook.webhook_id).to eq(new_webhook_id) - expect(webhook.url).to eq('http://ihaz.cheezburger') - expect(webhook.events).to include('project.imported', 'project.exported') - end - - specify '#destroy_webhook' do - response = VCR.use_cassette('destroy_webhook') do - test_client.destroy_webhook project_id, - new_webhook_id - end - - expect(response['project_id']).to eq(project_id) - expect(response['webhook_deleted']).to be(true) - end - - specify '#regenerate_webhook_secret' do - response = VCR.use_cassette('regenerate_webhook_secret') do - test_client.regenerate_webhook_secret project_id, - serious_webhook_id - end - - expect(response['project_id']).to eq(project_id) - expect(response['secret']).not_to be_nil - end - - context 'when webhook chained methods are used' do - it 'supports regenerate_webhook_secret' do - webhook = VCR.use_cassette('webhook_2') do - test_client.webhook project_id, serious_webhook_id - end - - expect(webhook.branch).to eq('master') - expect(webhook.webhook_id).to eq(serious_webhook_id) - - response = VCR.use_cassette('regenerate_webhook_secret_2') do - webhook.regenerate_secret - end - - expect(response['project_id']).to eq(project_id) - expect(response['secret']).not_to be_nil - end - - it 'supports update and destroy' do - webhook = VCR.use_cassette('webhook_2') do - test_client.webhook project_id, serious_webhook_id - end - - expect(webhook).to respond_to(:update) - expect(webhook).to respond_to(:destroy) - end - end -end diff --git a/spec/lib/ruby_lokalise_api/client_spec.rb b/spec/lib/ruby_lokalise_api/client_spec.rb new file mode 100644 index 0000000..c3d2880 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/client_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Client do + context 'with API errors' do + it 'raises BadRequest when API token is invalid' do + token = 'fake token' + + stub( + uri: 'projects', + req: { token: token }, + resp: { + body: fixture('errors/invalid_token'), + code: 400 + } + ) + + expect do + test_client(token).projects + end.to raise_error(RubyLokaliseApi::Error::BadRequest, /Invalid `X-Api-Token` header/) + end + + it 'raises NotFound when the URL is invalid' do + project_id = '88628569645b945648b474.25982965' + fake_contributor_id = '123' + + stub( + uri: "projects/#{project_id}/contributors/#{fake_contributor_id}", + resp: { + body: fixture('errors/not_found'), + code: 404 + } + ) + + expect do + test_client.contributor(project_id, fake_contributor_id) + end.to raise_error(RubyLokaliseApi::Error::NotFound, /Not Found/) + end + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/branches_spec.rb b/spec/lib/ruby_lokalise_api/collections/branches_spec.rb new file mode 100644 index 0000000..b950859 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/branches_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Branches do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/branches", + req: { query: pagination_params }, + resp: { + body: fixture('branches/branches_paginated'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/branches", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('branches/branches_next_page'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + branches = test_client.branches project_id, pagination_params + + expect(branches.collection.length).to eq(2) + expect_to_have_valid_resources(branches) + expect(branches.next_page?).to be true + expect(branches.prev_page?).to be false + + next_page_branches = branches.next_page + + expect(next_page_branches).to be_an_instance_of(described_class) + expect(next_page_branches[0].branch_id).to eq(309_348) + expect(next_page_branches.next_page?).to be false + expect(next_page_branches.prev_page?).to be true + + prev_page_branches = next_page_branches.prev_page + + expect(prev_page_branches).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/contributors_spec.rb b/spec/lib/ruby_lokalise_api/collections/contributors_spec.rb new file mode 100644 index 0000000..af1fe53 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/contributors_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Contributors do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/contributors", + req: { query: pagination_params }, + resp: { + body: fixture('contributors/contributors_paginated'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/contributors", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('contributors/contributors_next_page'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + contributors = test_client.contributors project_id, pagination_params + + expect(contributors.collection.length).to eq(2) + expect_to_have_valid_resources(contributors) + expect(contributors.next_page?).to be true + expect(contributors.prev_page?).to be false + + next_page_contributors = contributors.next_page + + expect(next_page_contributors).to be_an_instance_of(described_class) + expect(next_page_contributors[0].fullname).to eq('Ann') + expect(next_page_contributors.next_page?).to be false + expect(next_page_contributors.prev_page?).to be true + + prev_page_contributors = next_page_contributors.prev_page + + expect(prev_page_contributors).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/files_spec.rb b/spec/lib/ruby_lokalise_api/collections/files_spec.rb new file mode 100644 index 0000000..b6c8183 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/files_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Files do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '4', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/files", + req: { query: pagination_params }, + resp: { + body: fixture('files/files_page1'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/files", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('files/files_page2'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + files = test_client.files project_id, pagination_params + + expect(files.collection.length).to eq(2) + expect_to_have_valid_resources(files) + expect(files[0].file_id).to eq(1_642_774) + expect(files.next_page?).to be true + expect(files.prev_page?).to be false + + next_page_files = files.next_page + + expect(next_page_files).to be_an_instance_of(described_class) + expect(next_page_files[0].project_id).to eq(project_id) + expect(next_page_files.next_page?).to be false + expect(next_page_files.prev_page?).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/key_comments_spec.rb b/spec/lib/ruby_lokalise_api/collections/key_comments_spec.rb new file mode 100644 index 0000000..085c56a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/key_comments_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::KeyComments do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:key_id) { 301_832_195 } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + req: { query: pagination_params }, + resp: { + body: fixture('comments/comments_paginated'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('comments/comments_next_page'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + comments = test_client.comments project_id, key_id, pagination_params + + expect(comments.collection.length).to eq(2) + expect_to_have_valid_resources(comments) + expect(comments.next_page?).to be true + expect(comments.prev_page?).to be false + + next_page_comments = comments.next_page + + expect(next_page_comments).to be_an_instance_of(described_class) + expect(next_page_comments[0].comment).to eq('

How are things?

') + expect(next_page_comments.next_page?).to be false + expect(next_page_comments.prev_page?).to be true + + prev_page_comments = next_page_comments.prev_page + + expect(prev_page_comments).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/keys_spec.rb b/spec/lib/ruby_lokalise_api/collections/keys_spec.rb new file mode 100644 index 0000000..c6ec8a9 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/keys_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Keys do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:params) { { page: 2, limit: 3, include_comments: 0, include_translations: 0 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '5', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '3', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/keys", + req: { query: params }, + resp: { + body: fixture('keys/keys_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/keys", + req: { query: params.merge(page: 1) }, + resp: { + body: fixture('keys/keys_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + keys = test_client.keys project_id, params + + expect(keys.collection.length).to eq(2) + expect(keys[0].key_id).to eq(319_782_375) + expect_to_have_valid_resources(keys) + expect(keys.next_page?).to be false + expect(keys.prev_page?).to be true + + prev_page_keys = keys.prev_page + + expect(prev_page_keys).to be_an_instance_of(described_class) + expect(prev_page_keys[0].key_id).to eq(319_782_369) + expect(prev_page_keys.next_page?).to be true + expect(prev_page_keys.prev_page?).to be false + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/orders_spec.rb b/spec/lib/ruby_lokalise_api/collections/orders_spec.rb new file mode 100644 index 0000000..70b2e90 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/orders_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Orders do + let(:team_id) { 176_692 } + + let(:pagination_params) { { page: 3, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '10', + 'x-pagination-page-count': '5', + 'x-pagination-limit': '2', + 'x-pagination-page': '3' + } + end + + it 'supports pagination' do + stub( + uri: "teams/#{team_id}/orders", + req: { query: pagination_params }, + resp: { + body: fixture('orders/orders_page3'), + headers: pagination_headers + } + ) + + stub( + uri: "teams/#{team_id}/orders", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('orders/orders_page2'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + orders = test_client.orders team_id, pagination_params + + expect(orders.collection.length).to eq(2) + expect_to_have_valid_resources(orders) + expect(orders.next_page?).to be true + expect(orders.prev_page?).to be true + + prev_page_orders = orders.prev_page + + expect(prev_page_orders).to be_an_instance_of(described_class) + expect(prev_page_orders[0].order_id).to eq('20200116FM1') + expect(prev_page_orders.next_page?).to be true + expect(prev_page_orders.prev_page?).to be true + + next_page_orders = prev_page_orders.next_page + + expect(next_page_orders).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/payment_cards_spec.rb b/spec/lib/ruby_lokalise_api/collections/payment_cards_spec.rb new file mode 100644 index 0000000..4cf5f3a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/payment_cards_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::PaymentCards do + let(:pagination_params) { { page: 2, limit: 1 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '4', + 'x-pagination-page-count': '4', + 'x-pagination-limit': '1', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: 'payment_cards', + req: { query: pagination_params }, + resp: { + body: fixture('payment_cards/payment_cards_page2'), + headers: pagination_headers + } + ) + + stub( + uri: 'payment_cards', + req: { query: pagination_params.merge(page: 3) }, + resp: { + body: fixture('payment_cards/payment_cards_page3'), + headers: pagination_headers.merge('x-pagination-page': 3) + } + ) + + cards = test_client.payment_cards pagination_params + + expect(cards.collection.length).to eq(1) + expect_to_have_valid_resources(cards) + expect(cards.next_page?).to be true + expect(cards.prev_page?).to be true + + next_page_cards = cards.next_page + + expect(next_page_cards).to be_an_instance_of(described_class) + expect(next_page_cards[0].card_id).to eq(3574) + expect(next_page_cards.next_page?).to be true + expect(next_page_cards.prev_page?).to be true + + prev_page_cards = next_page_cards.prev_page + + expect(prev_page_cards).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/project_comments_spec.rb b/spec/lib/ruby_lokalise_api/collections/project_comments_spec.rb new file mode 100644 index 0000000..7366581 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/project_comments_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::ProjectComments do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/comments", + req: { query: pagination_params }, + resp: { + body: fixture('comments/project_comments_paginated'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/comments", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('comments/project_comments_next_page'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + comments = test_client.project_comments project_id, pagination_params + + expect(comments.collection.length).to eq(2) + expect_to_have_valid_resources(comments) + expect(comments.next_page?).to be true + expect(comments.prev_page?).to be false + + next_page_comments = comments.next_page + + expect(next_page_comments).to be_an_instance_of(described_class) + expect(next_page_comments[0].comment).to eq('

How are things?

') + expect(next_page_comments.next_page?).to be false + expect(next_page_comments.prev_page?).to be true + + prev_page_comments = next_page_comments.prev_page + + expect(prev_page_comments).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/project_languages_spec.rb b/spec/lib/ruby_lokalise_api/collections/project_languages_spec.rb new file mode 100644 index 0000000..fd77d4d --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/project_languages_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::ProjectLanguages do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:pagination_params) { { page: 1, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '4', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/languages", + req: { query: pagination_params }, + resp: { + body: fixture('languages/project_languages_page1'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/languages", + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('languages/project_languages_page2'), + headers: pagination_headers.merge('x-pagination-page': 2) + } + ) + + langs = test_client.project_languages project_id, pagination_params + + expect(langs.collection.length).to eq(2) + expect_to_have_valid_resources(langs) + expect(langs.next_page?).to be true + expect(langs.prev_page?).to be false + + next_page_langs = langs.next_page + + expect(next_page_langs).to be_an_instance_of(described_class) + + expect(next_page_langs[0].lang_id).to eq(673) + expect(next_page_langs.next_page?).to be false + expect(next_page_langs.prev_page?).to be true + + prev_page_langs = next_page_langs.prev_page + + expect(prev_page_langs).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/projects_spec.rb b/spec/lib/ruby_lokalise_api/collections/projects_spec.rb new file mode 100644 index 0000000..ab3335c --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/projects_spec.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Projects do + let(:projects) do + collection 'Projects', + response(loaded_fixture('projects/projects'), endpoint(name: 'Projects', client: test_client)) + end + + let(:pagination_headers) do + { + 'x-pagination-total-count': '55', + 'x-pagination-page-count': '28', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + end + + let(:pagination_params) do + { page: 1, limit: 2, include_statistics: 1 } + end + + let(:projects_page_one) do + stub( + uri: 'projects', + req: { query: pagination_params }, + resp: { + body: fixture('projects/projects'), + headers: pagination_headers + } + ) + + test_client.projects pagination_params + end + + let(:projects_page_two) do + stub( + uri: 'projects', + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('projects/projects_next_page'), + headers: pagination_headers.merge('x-pagination-page': '2') + } + ) + + test_client.projects pagination_params.merge(page: 2) + end + + it 'allows to perform chaining on projects' do + project = projects.collection.first + project_id = project.project_id + + params = { name: 'Android i18n', description: 'chain updated' } + + stub( + uri: "projects/#{project_id}", + req: { body: params, verb: :put }, + resp: { body: fixture('projects/update_project2') } + ) + + updated_project = project.update params + + expect(updated_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(updated_project.description).to eq('chain updated') + end + + specify '#next_page' do + stub( + uri: 'projects', + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('projects/projects_next_page'), + headers: pagination_headers.merge('x-pagination-page': '2') + } + ) + + next_page_projects = projects_page_one.next_page + + expect(next_page_projects).to be_an_instance_of described_class + expect_to_have_valid_resources(next_page_projects) + expect(next_page_projects[0].name).to eq('API') + + expect(next_page_projects.prev_page?).to be true + expect(next_page_projects.first_page?).to be false + expect(next_page_projects.last_page?).to be false + expect(next_page_projects.current_page).to eq(2) + expect(next_page_projects.results_per_page).to eq(2) + expect(next_page_projects.total_pages).to eq(28) + expect(next_page_projects.total_results).to eq(55) + end + + specify '#prev_page' do + stub( + uri: 'projects', + req: { query: pagination_params }, + resp: { + body: fixture('projects/projects'), + headers: pagination_headers + } + ) + + prev_page_projects = projects_page_two.prev_page + + expect(projects_page_two.prev_page?).to be true + + expect(prev_page_projects).to be_an_instance_of described_class + expect(prev_page_projects[0].name).to eq('Android i18n') + + expect(prev_page_projects.prev_page?).to be false + expect(prev_page_projects.first_page?).to be true + expect(prev_page_projects.last_page?).to be false + expect(prev_page_projects.current_page).to eq(1) + expect(prev_page_projects.results_per_page).to eq(2) + expect(prev_page_projects.total_pages).to eq(28) + expect(prev_page_projects.total_results).to eq(55) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/queued_processes_spec.rb b/spec/lib/ruby_lokalise_api/collections/queued_processes_spec.rb new file mode 100644 index 0000000..f7b4e92 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/queued_processes_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::QueuedProcesses do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:pagination_params) { { page: 2, limit: 1 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '2', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '1', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/processes", + req: { query: pagination_params }, + resp: { + body: fixture('processes/processes_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/processes", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('processes/processes_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + processes = test_client.queued_processes project_id, pagination_params + + expect(processes.collection.length).to eq(1) + expect_to_have_valid_resources(processes) + expect(processes.next_page?).to be false + expect(processes.prev_page?).to be true + + prev_page_processes = processes.prev_page + + expect(prev_page_processes).to be_an_instance_of(described_class) + expect(prev_page_processes[0].process_id).to eq('73ad976cedf00cd8a1b1b978ae3ffaade1323505') + expect(prev_page_processes.next_page?).to be true + expect(prev_page_processes.prev_page?).to be false + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/screenshots_spec.rb b/spec/lib/ruby_lokalise_api/collections/screenshots_spec.rb new file mode 100644 index 0000000..42311ab --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/screenshots_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Screenshots do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/screenshots", + req: { query: pagination_params }, + resp: { + body: fixture('screenshots/screenshots_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/screenshots", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('screenshots/screenshots_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + screenshots = test_client.screenshots project_id, pagination_params + + expect(screenshots.collection.length).to eq(1) + expect_to_have_valid_resources(screenshots) + expect(screenshots.next_page?).to be false + expect(screenshots.prev_page?).to be true + + prev_page_screenshots = screenshots.prev_page + + expect(prev_page_screenshots).to be_an_instance_of(described_class) + expect(prev_page_screenshots[0].screenshot_id).to eq(2_858_588) + expect(prev_page_screenshots.next_page?).to be true + expect(prev_page_screenshots.prev_page?).to be false + + next_page_screenshots = prev_page_screenshots.next_page + + expect(next_page_screenshots).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/snapshots_spec.rb b/spec/lib/ruby_lokalise_api/collections/snapshots_spec.rb new file mode 100644 index 0000000..e1ad453 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/snapshots_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Snapshots do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/snapshots", + req: { query: pagination_params }, + resp: { + body: fixture('snapshots/snapshots_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/snapshots", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('snapshots/snapshots_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + snapshots = test_client.snapshots project_id, pagination_params + + expect(snapshots.collection.length).to eq(1) + expect_to_have_valid_resources(snapshots) + expect(snapshots.next_page?).to be false + expect(snapshots.prev_page?).to be true + + prev_page_snapshots = snapshots.prev_page + + expect(prev_page_snapshots).to be_an_instance_of(described_class) + expect(prev_page_snapshots[0].snapshot_id).to eq(2_130_183) + expect(prev_page_snapshots.next_page?).to be true + expect(prev_page_snapshots.prev_page?).to be false + + next_page_snapshots = prev_page_snapshots.next_page + + expect(next_page_snapshots).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/tasks_spec.rb b/spec/lib/ruby_lokalise_api/collections/tasks_spec.rb new file mode 100644 index 0000000..66ced07 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/tasks_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Tasks do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/tasks", + req: { query: pagination_params }, + resp: { + body: fixture('tasks/tasks_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/tasks", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('tasks/tasks_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + tasks = test_client.tasks project_id, pagination_params + + expect(tasks.collection.length).to eq(1) + expect_to_have_valid_resources(tasks) + expect(tasks.next_page?).to be false + expect(tasks.prev_page?).to be true + + prev_page_tasks = tasks.prev_page + + expect(prev_page_tasks).to be_an_instance_of(described_class) + expect(prev_page_tasks[0].task_id).to eq(1_721_560) + expect(prev_page_tasks.next_page?).to be true + expect(prev_page_tasks.prev_page?).to be false + + next_page_tasks = prev_page_tasks.next_page + + expect(next_page_tasks).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/team_user_groups_spec.rb b/spec/lib/ruby_lokalise_api/collections/team_user_groups_spec.rb new file mode 100644 index 0000000..e8c179e --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/team_user_groups_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::TeamUserGroups do + let(:team_id) { 176_692 } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '4', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "teams/#{team_id}/groups", + req: { query: pagination_params }, + resp: { + body: fixture('team_user_groups/team_user_groups_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "teams/#{team_id}/groups", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('team_user_groups/team_user_groups_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + groups = test_client.team_user_groups team_id, pagination_params + + expect(groups.collection.length).to eq(2) + expect_to_have_valid_resources(groups) + expect(groups.next_page?).to be false + expect(groups.prev_page?).to be true + + prev_page_groups = groups.prev_page + + expect(prev_page_groups).to be_an_instance_of(described_class) + expect(prev_page_groups[0].group_id).to eq(2639) + expect(prev_page_groups.next_page?).to be true + expect(prev_page_groups.prev_page?).to be false + + next_page_groups = prev_page_groups.next_page + + expect(next_page_groups).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/team_users_spec.rb b/spec/lib/ruby_lokalise_api/collections/team_users_spec.rb new file mode 100644 index 0000000..c21bb8a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/team_users_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::TeamUsers do + let(:team_id) { 176_692 } + + let(:pagination_params) { { page: 2, limit: 3 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '24', + 'x-pagination-page-count': '8', + 'x-pagination-limit': '3', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "teams/#{team_id}/users", + req: { query: pagination_params }, + resp: { + body: fixture('team_users/team_users_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "teams/#{team_id}/users", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('team_users/team_users_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + users = test_client.team_users team_id, pagination_params + + expect(users.collection.length).to eq(3) + expect_to_have_valid_resources(users) + expect(users.next_page?).to be true + expect(users.prev_page?).to be true + + prev_page_users = users.prev_page + + expect(prev_page_users).to be_an_instance_of(described_class) + expect(prev_page_users[0].user_id).to eq(147_798) + expect(prev_page_users.next_page?).to be true + expect(prev_page_users.prev_page?).to be false + + next_page_users = prev_page_users.next_page + + expect(next_page_users).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/teams_spec.rb b/spec/lib/ruby_lokalise_api/collections/teams_spec.rb new file mode 100644 index 0000000..a548137 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/teams_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Teams do + let(:pagination_params) { { page: 2, limit: 3 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '6', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '3', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: 'teams', + req: { query: pagination_params }, + resp: { + body: fixture('teams/teams_page2'), + headers: pagination_headers + } + ) + + stub( + uri: 'teams', + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('teams/teams_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + teams = test_client.teams pagination_params + + expect(teams.collection.length).to eq(3) + expect_to_have_valid_resources(teams) + expect(teams.next_page?).to be false + expect(teams.prev_page?).to be true + + prev_page_teams = teams.prev_page + + expect(prev_page_teams).to be_an_instance_of(described_class) + expect(prev_page_teams[0].team_id).to eq(273_879) + expect(prev_page_teams.next_page?).to be true + expect(prev_page_teams.prev_page?).to be false + + next_page_teams = prev_page_teams.next_page + + expect(next_page_teams).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/translation_providers_spec.rb b/spec/lib/ruby_lokalise_api/collections/translation_providers_spec.rb new file mode 100644 index 0000000..4e63519 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/translation_providers_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::TranslationProviders do + let(:team_id) { 176_692 } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '4', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "teams/#{team_id}/translation_providers", + req: { query: pagination_params }, + resp: { + body: fixture('translation_providers/translation_providers_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "teams/#{team_id}/translation_providers", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('translation_providers/translation_providers_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + providers = test_client.translation_providers team_id, pagination_params + + expect(providers.collection.length).to eq(2) + expect_to_have_valid_resources(providers) + expect(providers.next_page?).to be false + expect(providers.prev_page?).to be true + + prev_page_providers = providers.prev_page + + expect(prev_page_providers).to be_an_instance_of(described_class) + expect(prev_page_providers[0].provider_id).to eq(1) + expect(prev_page_providers.next_page?).to be true + expect(prev_page_providers.prev_page?).to be false + + next_page_providers = prev_page_providers.next_page + + expect(next_page_providers).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/translations_spec.rb b/spec/lib/ruby_lokalise_api/collections/translations_spec.rb new file mode 100644 index 0000000..1745a7a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/translations_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Translations do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:pagination_params) { { page: 4, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '35', + 'x-pagination-page-count': '18', + 'x-pagination-limit': '2', + 'x-pagination-page': '4' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/translations", + req: { query: pagination_params }, + resp: { + body: fixture('translations/translations_page4'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/translations", + req: { query: pagination_params.merge(page: 3) }, + resp: { + body: fixture('translations/translations_page3'), + headers: pagination_headers.merge('x-pagination-page': 3) + } + ) + + translations = test_client.translations project_id, pagination_params + + expect(translations.collection.length).to eq(2) + expect_to_have_valid_resources(translations) + expect(translations.next_page?).to be true + expect(translations.prev_page?).to be true + + prev_page_translations = translations.prev_page + + expect(prev_page_translations).to be_an_instance_of(described_class) + expect(prev_page_translations[0].translation_id).to eq(2_574_122_386) + expect(prev_page_translations.next_page?).to be true + expect(prev_page_translations.prev_page?).to be true + + next_page_translations = prev_page_translations.next_page + + expect(next_page_translations).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/collections/webhooks_spec.rb b/spec/lib/ruby_lokalise_api/collections/webhooks_spec.rb new file mode 100644 index 0000000..eb38920 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/collections/webhooks_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Collections::Webhooks do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:pagination_params) { { page: 2, limit: 2 } } + let(:pagination_headers) do + { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '2', + 'x-pagination-limit': '2', + 'x-pagination-page': '2' + } + end + + it 'supports pagination' do + stub( + uri: "projects/#{project_id}/webhooks", + req: { query: pagination_params }, + resp: { + body: fixture('webhooks/webhooks_page2'), + headers: pagination_headers + } + ) + + stub( + uri: "projects/#{project_id}/webhooks", + req: { query: pagination_params.merge(page: 1) }, + resp: { + body: fixture('webhooks/webhooks_page1'), + headers: pagination_headers.merge('x-pagination-page': 1) + } + ) + + webhooks = test_client.webhooks project_id, pagination_params + + expect(webhooks.collection.length).to eq(1) + expect_to_have_valid_resources(webhooks) + expect(webhooks.next_page?).to be false + expect(webhooks.prev_page?).to be true + + prev_page_webhooks = webhooks.prev_page + + expect(prev_page_webhooks).to be_an_instance_of(described_class) + expect(prev_page_webhooks[0].webhook_id).to eq('b47d698677ba426854ceee2982fe304d84c547f4') + expect(prev_page_webhooks.next_page?).to be true + expect(prev_page_webhooks.prev_page?).to be false + + next_page_webhooks = prev_page_webhooks.next_page + + expect(next_page_webhooks).to be_an_instance_of(described_class) + end +end diff --git a/spec/lib/ruby_lokalise_api/connection_spec.rb b/spec/lib/ruby_lokalise_api/connection_spec.rb index 7a0c398..780bfe9 100644 --- a/spec/lib/ruby_lokalise_api/connection_spec.rb +++ b/spec/lib/ruby_lokalise_api/connection_spec.rb @@ -1,23 +1,24 @@ # frozen_string_literal: true RSpec.describe RubyLokaliseApi::Connection do + let(:project_id) { '803826145ba90b42d5d860.46800099' } + let(:dummy) { Class.new { include RubyLokaliseApi::Connection }.new } - let(:project_id) { '803826145ba90b42d5d860.46800099' } - let(:key_id) { 44_596_059 } + let(:project_endpoint) do + endpoint name: 'Projects', client: test_client, params: { query: [project_id] } + end before { RubyLokaliseApi.reset_client! } - after { RubyLokaliseApi.reset_client! } - - it 'Authorization header must be present for OAuth2 client' do - conn = dummy.connection test_oauth2_client - expect(conn.headers['Authorization']).to eq(test_oauth2_client.token) - expect(conn.headers['X-api-token']).to be_nil + after do + RubyLokaliseApi.reset_client! + Faraday.default_adapter = :net_http end it 'timeouts are not be set by default but the token must be present' do - conn = dummy.connection test_client + conn = dummy.connection project_endpoint + expect(conn.options.timeout).to be_nil expect(conn.options.open_timeout).to be_nil expect(conn.headers['X-api-token']).to eq(test_client.token) @@ -26,41 +27,41 @@ it 'allows to customize timeouts' do custom_client = RubyLokaliseApi.client(ENV.fetch('LOKALISE_API_TOKEN', nil), open_timeout: 100, timeout: 500) - conn = dummy.connection custom_client + + custom_endpoint = endpoint name: 'Projects', client: custom_client, params: { query: [project_id] } + + conn = dummy.connection custom_endpoint + expect(conn.options.timeout).to eq(500) expect(conn.options.open_timeout).to eq(100) expect(conn.headers['X-api-token']).to eq(custom_client.token) custom_client.timeout = 300 custom_client.open_timeout = 200 - another_conn = dummy.connection custom_client - expect(another_conn.options.timeout).to eq(300) - expect(another_conn.options.open_timeout).to eq(200) - end - it 'works with gzip compression' do - gzip_client = RubyLokaliseApi.client(ENV.fetch('LOKALISE_API_TOKEN', nil)) - keys = VCR.use_cassette('all_keys_gzip') do - gzip_client.keys project_id, limit: 30 - end.collection + another_conn = dummy.connection custom_endpoint - expect(keys.first.key_id).to eq(key_id) + expect(another_conn.options.timeout).to eq(300) + expect(another_conn.options.open_timeout).to eq(200) end it 'gzip compression is on by default' do custom_client = RubyLokaliseApi.client(ENV.fetch('LOKALISE_API_TOKEN', nil)) - conn = dummy.connection custom_client + + conn = dummy.connection project_endpoint + expect(conn.headers['X-api-token']).to eq(custom_client.token) expect(conn.builder.handlers).to include(Faraday::Gzip::Middleware) end it 'is possible to customize adapter' do - conn = dummy.connection test_client + conn = dummy.connection project_endpoint + expect(conn.builder.adapter).to eq(Faraday::Adapter::NetHttp) Faraday.default_adapter = :test - another_conn = dummy.connection test_client + another_conn = dummy.connection project_endpoint expect(another_conn.builder.adapter).to eq(Faraday::Adapter::Test) expect(conn.builder.adapter).to eq(Faraday::Adapter::NetHttp) diff --git a/spec/lib/ruby_lokalise_api/custom_json_parser_spec.rb b/spec/lib/ruby_lokalise_api/custom_json_parser_spec.rb deleted file mode 100644 index f63aff3..0000000 --- a/spec/lib/ruby_lokalise_api/custom_json_parser_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -require 'oj' - -RSpec.describe RubyLokaliseApi::JsonHandler do - let(:loaded_json) do - {'projects' => [{'project_id' => '547879415c01a0e6e0b855.29978928', - 'name' => 'demo phoenix copy', - 'description' => '', - 'created_at' => '2018-11-30 20:43:18 (Etc/UTC)', - 'created_by' => 20_181, - 'created_by_email' => 'bodrovis@protonmail.com', - 'team_id' => 176_692, - 'statistics' => - {'progress' => 0, - 'keys' => 1, - 'team' => 1, - 'base_words' => 0, - 'qa_issues' => 1, - 'languages' => - [{'language_id' => 640, 'language_iso' => 'en', 'progress' => 0, 'words_to_do' => 0}, - {'language_id' => 597, 'language_iso' => 'ru', 'progress' => 0, 'words_to_do' => 0}, - {'language_id' => 673, 'language_iso' => 'f_over', 'progress' => 0, 'words_to_do' => 0}]}}]} - end - - let(:dumped_json) do - '{":name":"rspec proj",":description":"demo project for rspec"}' - end - - # rubocop:disable RSpec/LeakyConstantDeclaration, Lint/ConstantDefinitionInBlock - before do - module RubyLokaliseApi - module JsonHandler - def custom_dump(obj) - Oj.dump obj - end - - def custom_load(obj) - Oj.load obj - end - end - end - end - - after do - module RubyLokaliseApi - module JsonHandler - def custom_dump(obj) - JSON.dump obj - end - - def custom_load(obj) - JSON.parse obj - end - end - end - end - # rubocop:enable RSpec/LeakyConstantDeclaration, Lint/ConstantDefinitionInBlock - - it 'allows to customize #load' do - allow(Oj).to receive(:load).and_return(loaded_json) - expect(JSON).not_to receive(:parse) - projects = VCR.use_cassette('all_projects_pagination') do - test_client.projects limit: 1, page: 2 - end - - expect(projects.collection.count).to eq(1) - expect(projects.total_results).to eq(5) - expect(projects.collection.first.name).to eq('demo phoenix copy') - end - - it 'allows to customize #dump' do - allow(Oj).to receive(:dump).and_return(dumped_json) - expect(JSON).not_to receive(:dump) - project = VCR.use_cassette('new_project') do - test_client.create_project name: 'rspec proj', description: 'demo project for rspec' - end - - expect(project.name).to eq('rspec proj') - end -end diff --git a/spec/lib/ruby_lokalise_api/endpoints/base_endpoint_spec.rb b/spec/lib/ruby_lokalise_api/endpoints/base_endpoint_spec.rb new file mode 100644 index 0000000..c6c9658 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/endpoints/base_endpoint_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Endpoints::BaseEndpoint do + subject { described_class.new test_client } + + let(:endpoint) { subject } + + it { is_expected.to respond_to(:do_get) } + it { is_expected.to respond_to(:do_post) } + it { is_expected.not_to respond_to(:very_wrong_method) } + + it 'raises an error when calling invalid methods' do + expect { endpoint.very_wrong_method }.to raise_error(NoMethodError) + end +end diff --git a/spec/lib/ruby_lokalise_api/error_spec.rb b/spec/lib/ruby_lokalise_api/error_spec.rb deleted file mode 100644 index cba9809..0000000 --- a/spec/lib/ruby_lokalise_api/error_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe RubyLokaliseApi::Error do - include RubyLokaliseApi::Request - - before { RubyLokaliseApi.reset_client! } - - after { RubyLokaliseApi.reset_client! } - - it 'raises a generic error when the code is unknown' do - expect do - VCR.use_cassette('error_unknown_code') do - get 'projects', RubyLokaliseApi.client('invalid') - end - end.to raise_error(described_class) - end - - it 'raises BadRequest when API token is invalid' do - expect do - VCR.use_cassette('error_invalid_token') do - get 'projects', RubyLokaliseApi.client('invalid') - end - end.to raise_error(RubyLokaliseApi::Error::BadRequest, /Invalid `X-Api-Token` header/) - end - - it 'raises NotFound when the provided path cannot be found' do - expect do - VCR.use_cassette('error_not_found') do - get 'invalid_path', test_client - end - end.to raise_error(RubyLokaliseApi::Error::NotFound) - end -end diff --git a/spec/lib/ruby_lokalise_api/generics_spec.rb b/spec/lib/ruby_lokalise_api/generics_spec.rb new file mode 100644 index 0000000..7251423 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/generics_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Generics do + let(:generic) { described_class.new(answer: 42) } + + it 'responds to the initialized methods' do + expect(generic).to respond_to(:answer) + end + + it 'does not respond to the uninitialized methods' do + expect(generic).not_to respond_to(:wrong_reader) + end + + specify '#[]' do + expect(generic[:answer]).to eq(42) + expect(generic['answer']).to eq(42) + expect(generic['wrong_attr']).to be_nil + expect(generic[:wrong_attr]).to be_nil + end +end diff --git a/spec/lib/ruby_lokalise_api/oauth2/auth_spec.rb b/spec/lib/ruby_lokalise_api/oauth2/auth_spec.rb index 3397ffe..35b34f7 100644 --- a/spec/lib/ruby_lokalise_api/oauth2/auth_spec.rb +++ b/spec/lib/ruby_lokalise_api/oauth2/auth_spec.rb @@ -1,77 +1,104 @@ # frozen_string_literal: true RSpec.describe RubyLokaliseApi::OAuth2::Auth do + let(:base_url) { RubyLokaliseApi::Endpoints::OAuth2::OAuth2Endpoint::BASE_URL } + describe '#auth' do - it 'returns auth code' do + it 'returns auth url' do uri = auth_client.auth scope: 'read_projects' - expect(uri).to include(auth_client.base_url.to_s) - expect(uri).to include('auth?client_id=') + + expect(uri).to include(base_url) + expect(uri).to include('oauth2/auth?client_id=') expect(uri).to include('&scope=read_projects') end it 'allows to pass an array of scopes' do scopes = %w[write_projects write_team_groups write_tasks] uri = auth_client.auth scope: scopes - expect(uri).to include(auth_client.base_url.to_s) - expect(uri).to include('auth?client_id=') - expect(uri).to include("&scope=#{scopes.join('+')}") + + expect(uri).to include(base_url) + expect(uri).to include('oauth2/auth?client_id=') + expect(uri).to include("&scope=#{scopes.join('%20')}") end it 'allows to set redirect_uri' do - uri = auth_client.auth scope: 'read_projects', redirect_uri: 'http://example.com/callback' - expect(uri).to include(auth_client.base_url.to_s) + uri = auth_client.auth scope: %w[write_projects read_contributors], redirect_uri: 'http://example.com/callback' + + expect(uri).to include(base_url) expect(uri).to include('example.com%2Fcallback') end it 'allows to set state' do state = '123abc' uri = auth_client.auth scope: 'read_projects', state: state - expect(uri).to include(auth_client.base_url.to_s) + + expect(uri).to include(base_url) expect(uri).to include(state) end end - describe '#token' do - it 'returns an OAuth2 token' do - resp = VCR.use_cassette('oauth2/token') do - auth_client.token ENV.fetch('OAUTH2_CODE', nil) - end - - expect(resp).to be_an_instance_of(RubyLokaliseApi::OAuth2::Token) - expect(resp.access_token).not_to be_nil - expect(resp.refresh_token).not_to be_nil - expect(resp.expires_in).to eq(3600) - expect(resp.token_type).to eq('Bearer') - end + specify '#token' do + code = ENV.fetch('OAUTH2_CODE', nil) - it 'raises an error when the code is invalid' do - expect do - VCR.use_cassette('oauth2/token_error') do - auth_client.token 'incorrect_code' - end - end.to raise_error(RubyLokaliseApi::Error::BadRequest) - end + params = { + client_id: auth_client.client_id, + client_secret: auth_client.client_secret, + grant_type: 'authorization_code', + code: code + } + + resp_body = { + access_token: ENV.fetch('OAUTH2_TOKEN', nil), + refresh_token: ENV.fetch('OAUTH2_REFRESH_TOKEN', nil), + expires_in: 3600, + token_type: 'Bearer' + } + + stub( + uri: 'token', + req: { body: params, verb: :post, skip_token: true, base_url: base_url }, + resp: { body: resp_body } + ) + + token = auth_client.token(code) + + expect(token).to be_an_instance_of(RubyLokaliseApi::Resources::OAuth2Token) + expect(token.access_token).to eq(ENV.fetch('OAUTH2_TOKEN', nil)) + expect(token.refresh_token).to eq(ENV.fetch('OAUTH2_REFRESH_TOKEN', nil)) + expect(token.expires_in).to eq(3600) + expect(token.token_type).to eq('Bearer') end - describe '#refresh' do - it 'returns a refreshed OAuth2 token' do - resp = VCR.use_cassette('oauth2/refresh') do - auth_client.refresh ENV.fetch('OAUTH2_REFRESH_TOKEN', nil) - end - - expect(resp).to be_an_instance_of(RubyLokaliseApi::OAuth2::Refresh) - expect(resp.access_token).not_to be_nil - expect(resp.scope).to eq('write_projects write_team_groups write_tasks') - expect(resp.expires_in).to eq(3600) - expect(resp.token_type).to eq('Bearer') - end + specify '#refresh' do + refresh_token = ENV.fetch('OAUTH2_REFRESH_TOKEN', nil) - it 'raises an error when the token is invalid' do - expect do - VCR.use_cassette('oauth2/refresh_error') do - auth_client.refresh 'incorrect_token' - end - end.to raise_error(RubyLokaliseApi::Error::BadRequest) - end + params = { + client_id: auth_client.client_id, + client_secret: auth_client.client_secret, + grant_type: 'refresh_token', + refresh_token: refresh_token + } + + resp_body = { + access_token: ENV.fetch('OAUTH2_TOKEN_REFRESHED', nil), + scope: 'write_projects read_contributors', + expires_in: 3600, + token_type: 'Bearer' + } + + stub( + uri: 'token', + req: { body: params, verb: :post, skip_token: true, base_url: base_url }, + resp: { body: resp_body } + ) + + token = auth_client.refresh(refresh_token) + + expect(token).to be_an_instance_of(RubyLokaliseApi::Resources::OAuth2RefreshedToken) + + expect(token.access_token).to eq(ENV.fetch('OAUTH2_TOKEN_REFRESHED', nil)) + expect(token.expires_in).to eq(3600) + expect(token.token_type).to eq('Bearer') + expect(token.scope).to eq('write_projects read_contributors') end end diff --git a/spec/lib/ruby_lokalise_api/oauth2_client_spec.rb b/spec/lib/ruby_lokalise_api/oauth2_client_spec.rb new file mode 100644 index 0000000..d8bdeed --- /dev/null +++ b/spec/lib/ruby_lokalise_api/oauth2_client_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::OAuth2Client do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:user_id) { 20_181 } + + it 'allows to perform requests with OAuth 2 token' do + stub( + uri: "projects/#{project_id}/contributors/#{user_id}", + req: { token_header: 'Authorization', token: test_oauth2_client.token }, + resp: { body: fixture('contributors/contributor') } + ) + + contributor = test_oauth2_client.contributor(project_id, user_id) + + expect(contributor).to be_an_instance_of(RubyLokaliseApi::Resources::Contributor) + expect(contributor.user_id).to eq(user_id) + + reloaded_contributor = contributor.reload_data + + expect(reloaded_contributor).to be_an_instance_of(RubyLokaliseApi::Resources::Contributor) + expect(reloaded_contributor.user_id).to eq(user_id) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/base_spec.rb b/spec/lib/ruby_lokalise_api/resources/base_spec.rb new file mode 100644 index 0000000..882e9b8 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/base_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Base do + let(:base_resource) do + resource 'Base', response(nil, base_endpoint) + end + + let(:base_endpoint) do + endpoint name: 'Base', client: test_client, params: { query: [] } + end + + specify '#[]' do + allow(base_resource).to receive(:self_endpoint).and_return(base_endpoint) + + expect(base_resource[:self_endpoint]).to eq(base_endpoint) + expect(base_resource['self_endpoint']).to eq(base_endpoint) + expect(base_resource['wrong_attr']).to be_nil + expect(base_resource[:wrong_attr]).to be_nil + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/branch_spec.rb b/spec/lib/ruby_lokalise_api/resources/branch_spec.rb new file mode 100644 index 0000000..3c949b1 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/branch_spec.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Branch do + let(:branch_fixture) { loaded_fixture('branches/branch') } + let(:project_id) { branch_fixture['project_id'] } + let(:branch_id) { branch_fixture['branch']['branch_id'] } + let(:ep) { endpoint name: 'Branches', client: test_client, params: { query: [project_id, branch_id] } } + let(:branch) { resource 'Branch', response(branch_fixture, ep) } + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + resp: { body: fixture('branches/branch') } + ) + + reloaded_branch = branch.reload_data + + expect(reloaded_branch.branch_id).to eq(branch_id) + expect(reloaded_branch.project_id).to eq(project_id) + end + + specify '#update' do + branch_data = { + name: 'Ruby_updated' + } + + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + req: { body: branch_data, verb: :put }, + resp: { body: fixture('branches/update_branch') } + ) + + updated_branch = branch.update branch_data + + expect(updated_branch).to be_an_instance_of(described_class) + expect(updated_branch.name).to eq(branch_data[:name]) + expect(updated_branch.branch_id).to eq(branch_id) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + req: { verb: :delete }, + resp: { body: fixture('branches/destroy_branch') } + ) + + resp = branch.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.branch_deleted).to be true + end + + specify '#merge' do + second_branch_fixture = loaded_fixture('branches/branch2') + branch_id2 = second_branch_fixture['branch']['branch_id'] + + merge_endpoint = endpoint name: 'Branches', client: test_client, params: { query: [project_id, branch_id2] } + branch_source = resource 'Branch', response(second_branch_fixture, merge_endpoint) + + merge_target = 324_738 + + data = { + force_conflict_resolve_using: 'source', + target_branch_id: merge_target + } + + stub( + uri: "projects/#{project_id}/branches/#{branch_id2}/merge", + req: { body: data, verb: :post }, + resp: { body: fixture('branches/merge_branch') } + ) + + resp = branch_source.merge data + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::MergedBranches) + expect(resp.project_id).to eq(project_id) + expect(resp.branch['branch_id']).to eq(branch_id2) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/comment_spec.rb b/spec/lib/ruby_lokalise_api/resources/comment_spec.rb new file mode 100644 index 0000000..00b1394 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/comment_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Comment do + subject do + described_class.new response(nil, nil) + end + + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:key_id) { 301_832_195 } + let(:comment_id) { 16_588_650 } + + it { is_expected.not_to respond_to(:update) } + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_id}", + resp: { body: fixture('comments/comment') } + ) + + comment = test_client.comment(project_id, key_id, comment_id) + + reloaded_comment = comment.reload_data + + expect(reloaded_comment.key_id).to eq(key_id) + end + + specify '#destroy' do + comment_to_delete = 16_784_634 + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_to_delete}", + resp: { body: fixture('comments/comment2') } + ) + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_to_delete}", + req: { verb: :delete }, + resp: { body: fixture('comments/destroy_comment') } + ) + + comment = test_client.comment project_id, key_id, comment_to_delete + + resp = comment.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.comment_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/contributor_spec.rb b/spec/lib/ruby_lokalise_api/resources/contributor_spec.rb new file mode 100644 index 0000000..5959e79 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/contributor_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Contributor do + let(:loaded_contributor_fixture) { loaded_fixture('contributors/contributor2') } + + let(:project_id) { loaded_contributor_fixture['project_id'] } + + let(:contributor_endpoint) do + params = { query: [project_id, loaded_contributor_fixture['contributor']['user_id']] } + endpoint name: 'Contributors', client: test_client, params: params + end + + let(:contributor) do + resource 'Contributor', response(loaded_contributor_fixture, contributor_endpoint) + end + + let(:contributor_id) { contributor.user_id } + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/contributors/#{contributor_id}", + resp: { body: fixture('contributors/contributor2') } + ) + + reloaded_contributor = contributor.reload_data + + expect(reloaded_contributor.user_id).to eq(contributor_id) + expect(reloaded_contributor.project_id).to eq(project_id) + end + + specify '#update' do + contributor_data = { + is_reviewer: true + } + + stub( + uri: "projects/#{project_id}/contributors/#{contributor_id}", + req: { body: contributor_data, verb: :put }, + resp: { body: fixture('contributors/update_contributor') } + ) + + updated_contributor = contributor.update contributor_data + + expect(updated_contributor).to be_an_instance_of(described_class) + expect(updated_contributor.user_id).to eq(contributor_id) + expect(updated_contributor.is_reviewer).to be true + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/contributors/#{contributor_id}", + req: { verb: :delete }, + resp: { body: fixture('contributors/destroy_contributor') } + ) + + resp = contributor.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.contributor_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/custom_translation_status_spec.rb b/spec/lib/ruby_lokalise_api/resources/custom_translation_status_spec.rb new file mode 100644 index 0000000..ab62369 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/custom_translation_status_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::CustomTranslationStatus do + let(:status_fixture) { loaded_fixture('cts/status') } + + let(:project_id) { status_fixture['project_id'] } + + let(:status_endpoint) do + params = { query: [project_id, status_fixture['custom_translation_status']['status_id']] } + endpoint name: 'CustomTranslationStatuses', client: test_client, params: params + end + + let(:status) do + resource 'CustomTranslationStatus', response(status_fixture, status_endpoint) + end + + let(:status_id) { status.status_id } + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{status_id}", + resp: { body: fixture('cts/status') } + ) + + reloaded_status = status.reload_data + + expect(reloaded_status.status_id).to eq(status_id) + expect(reloaded_status.project_id).to eq(project_id) + end + + specify '#update' do + data = { + title: 'ruby3' + } + + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{status_id}", + req: { body: data, verb: :put }, + resp: { body: fixture('cts/update_status2') } + ) + + updated_status = status.update data + + expect(updated_status).to be_an_instance_of(described_class) + expect(updated_status.status_id).to eq(status_id) + expect(updated_status.title).to eq(data[:title]) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{status_id}", + req: { verb: :delete }, + resp: { body: fixture('cts/destroy_status2') } + ) + + res = test_client.destroy_custom_translation_status project_id, status_id + + expect(res.project_id).to eq(project_id) + expect(res.branch).to eq('master') + expect(res.custom_translation_status_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/file_spec.rb b/spec/lib/ruby_lokalise_api/resources/file_spec.rb new file mode 100644 index 0000000..ffaf7db --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/file_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::File do + let(:loaded_files_fixture) { loaded_fixture('files/doc_files') } + + let(:project_id) { loaded_files_fixture['project_id'] } + + let(:files_endpoint) do + endpoint name: 'Files', client: test_client, params: { query: [project_id] } + end + + let(:files) do + collection 'Files', response(loaded_files_fixture, files_endpoint) + end + + let(:file) do + files[1] + end + + it 'does not support update' do + expect(file).not_to respond_to(:update) + end + + it 'does not support reload_data' do + expect(file).not_to respond_to(:reload_data) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/files/#{file.file_id}", + req: { verb: :delete }, + resp: { body: fixture('files/destroy_file') } + ) + + resp = file.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.file_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/jwt_spec.rb b/spec/lib/ruby_lokalise_api/resources/jwt_spec.rb new file mode 100644 index 0000000..4ceee30 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/jwt_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Jwt do + subject do + described_class.new response(nil, nil) + end + + it { is_expected.not_to respond_to(:update) } + it { is_expected.not_to respond_to(:destroy) } + it { is_expected.not_to respond_to(:reload_data) } +end diff --git a/spec/lib/ruby_lokalise_api/resources/key_spec.rb b/spec/lib/ruby_lokalise_api/resources/key_spec.rb new file mode 100644 index 0000000..a145638 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/key_spec.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Key do + let(:loaded_key_fixture) { loaded_fixture('keys/key2') } + + let(:project_id) { loaded_key_fixture['project_id'] } + + let(:key_endpoint) do + params = { query: [project_id, loaded_key_fixture['key']['key_id']] } + endpoint name: 'Keys', client: test_client, params: params + end + + let(:key) do + resource 'Key', response(loaded_key_fixture, key_endpoint) + end + + let(:key_id) { key.key_id } + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}", + resp: { body: fixture('keys/key2') } + ) + + reloaded_key = key.reload_data + + expect(reloaded_key.key_id).to eq(key_id) + expect(reloaded_key.project_id).to eq(project_id) + end + + specify '#update' do + desc = 'to delete' + + body = { description: desc } + + stub( + uri: "projects/#{project_id}/keys/#{key_id}", + req: { body: body, verb: :put }, + resp: { body: fixture('keys/update_key2') } + ) + + updated_key = key.update body + + expect(updated_key).to be_an_instance_of(described_class) + expect(updated_key.key_id).to eq(key_id) + expect(updated_key.description).to eq(desc) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}", + req: { verb: :delete }, + resp: { body: fixture('keys/destroy_key') } + ) + + resp = key.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.key_removed).to be true + expect(resp.keys_locked).to eq(0) + end + + context 'with delegators' do + it 'delegates key_comment to comment' do + expect_to_delegate(key, :comment, project_id, key_id, 12_345) do |obj| + obj.key_comment(12_345) + end + end + + it 'delegates key_comments to comments' do + pagination_params = { page: 1, limit: 2 } + + expect_to_delegate(key, :comments, project_id, key_id, pagination_params) do |obj| + obj.key_comments(pagination_params) + end + end + + it 'delegates create_comments' do + params = [{ comment: 'Comment1' }, { comment: 'Comment2' }] + + expect_to_delegate(key, :create_comments, project_id, key_id, params) do |obj| + obj.create_comments(params) + end + end + + it 'delegates destroy_comment' do + expect_to_delegate(key, :destroy_comment, project_id, key_id, 12_345) do |obj| + obj.destroy_comment(12_345) + end + end + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/oauth2_refreshed_token_spec.rb b/spec/lib/ruby_lokalise_api/resources/oauth2_refreshed_token_spec.rb new file mode 100644 index 0000000..a044504 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/oauth2_refreshed_token_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::OAuth2RefreshedToken do + subject do + described_class.new response(nil, nil) + end + + it { is_expected.not_to respond_to(:update) } + it { is_expected.not_to respond_to(:destroy) } + it { is_expected.not_to respond_to(:reload_data) } +end diff --git a/spec/lib/ruby_lokalise_api/resources/oauth2_token_spec.rb b/spec/lib/ruby_lokalise_api/resources/oauth2_token_spec.rb new file mode 100644 index 0000000..3ea9f36 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/oauth2_token_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::OAuth2Token do + subject do + described_class.new response(nil, nil) + end + + it { is_expected.not_to respond_to(:update) } + it { is_expected.not_to respond_to(:destroy) } + it { is_expected.not_to respond_to(:reload_data) } +end diff --git a/spec/lib/ruby_lokalise_api/resources/order_spec.rb b/spec/lib/ruby_lokalise_api/resources/order_spec.rb new file mode 100644 index 0000000..3df9d08 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/order_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Order do + let(:team_id) { 176_692 } + let(:order_id) { '201903198B2' } + + specify '#reload_data' do + stub( + uri: "teams/#{team_id}/orders/#{order_id}", + resp: { body: fixture('orders/order') } + ) + + order = test_client.order team_id, order_id + + reloaded_order = order.reload_data + + expect(reloaded_order.order_id).to eq(order_id) + end + + it 'does not support update' do + stub( + uri: "teams/#{team_id}/orders/#{order_id}", + resp: { body: fixture('orders/order') } + ) + + order = test_client.order team_id, order_id + + expect(order).not_to respond_to(:update) + end + + it 'does not support destroy' do + stub( + uri: "teams/#{team_id}/orders/#{order_id}", + resp: { body: fixture('orders/order') } + ) + + order = test_client.order team_id, order_id + + expect(order).not_to respond_to(:destroy) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/payment_cards_spec.rb b/spec/lib/ruby_lokalise_api/resources/payment_cards_spec.rb new file mode 100644 index 0000000..c1ac9d7 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/payment_cards_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::PaymentCard do + let(:loaded_card_fixture) { loaded_fixture('payment_cards/payment_card') } + + let(:card_id) { loaded_card_fixture['payment_card']['card_id'] } + + let(:card_endpoint) do + endpoint name: 'PaymentCards', client: test_client, params: { query: [card_id] } + end + + let(:card) do + resource 'PaymentCard', response(loaded_card_fixture, card_endpoint) + end + + specify '#destroy' do + stub( + uri: "payment_cards/#{card_id}", + req: { verb: :delete }, + resp: { body: fixture('payment_cards/destroy_payment_card') } + ) + + resp = card.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + + expect(resp.card_id).to eq(card_id) + expect(resp.card_deleted).to be true + end + + it 'does not support update' do + expect(card).not_to respond_to(:update) + end + + specify '#reload_data' do + stub( + uri: "payment_cards/#{card_id}", + resp: { body: fixture('payment_cards/payment_card') } + ) + + reloaded_card = card.reload_data + + expect(reloaded_card.card_id).to eq(card_id) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/project_language_spec.rb b/spec/lib/ruby_lokalise_api/resources/project_language_spec.rb new file mode 100644 index 0000000..3b6ad62 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/project_language_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::ProjectLanguage do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_langs_fixture) { loaded_fixture('languages/project_languages') } + + let(:languages) do + collection 'ProjectLanguages', response(loaded_langs_fixture, lang_endpoint) + end + + let(:lang_endpoint) do + params = { query: project_id } + endpoint name: 'ProjectLanguages', client: test_client, params: params + end + + specify '#reload_data' do + language = languages[2] + + stub( + uri: "projects/#{project_id}/languages/#{language.lang_id}", + resp: { body: fixture('languages/project_language') } + ) + + reloaded_lang = language.reload_data + + expect(reloaded_lang).to be_an_instance_of(described_class) + expect(reloaded_lang.lang_id).to eq(language.lang_id) + end + + specify '#update' do + language = languages[2] + + lang_data = { + lang_name: 'French (updated)' + } + + stub( + uri: "projects/#{project_id}/languages/#{language.lang_id}", + req: { body: lang_data, verb: :put }, + resp: { body: fixture('languages/update_project_language') } + ) + + updated_lang = language.update lang_data + + expect(updated_lang).to be_an_instance_of(described_class) + expect(updated_lang.lang_name).to eq(lang_data[:lang_name]) + expect(updated_lang.lang_id).to eq(language.lang_id) + end + + specify '#destroy' do + language = languages[0] + + stub( + uri: "projects/#{project_id}/languages/#{language.lang_id}", + req: { verb: :delete }, + resp: { body: fixture('languages/destroy_language') } + ) + + resp = language.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.language_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/project_spec.rb b/spec/lib/ruby_lokalise_api/resources/project_spec.rb new file mode 100644 index 0000000..311ffb8 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/project_spec.rb @@ -0,0 +1,730 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Project do + let(:loaded_project_fixture) { loaded_fixture('projects/project') } + + let(:project_id) { loaded_project_fixture['project_id'] } + + let(:project_endpoint) do + endpoint name: 'Projects', client: test_client, params: { query: [project_id] } + end + + let(:project) do + resource 'Project', response(loaded_project_fixture, project_endpoint) + end + + let(:pagination_params) { { page: 1, limit: 2 } } + + specify '#update' do + params = { name: 'OnBoarding-2023', description: 'Updated description' } + + stub( + uri: "projects/#{project_id}", + req: { body: params, verb: :put }, + resp: { body: fixture('projects/update_project') } + ) + + updated_project = project.update params + + expect(updated_project).to be_an_instance_of(described_class) + end + + specify '#destroy' do + created_project_fixture = loaded_fixture('projects/create_project') + created_project_id = created_project_fixture['project_id'] + created_project_endpoint = endpoint(name: 'Projects', client: test_client, params: { query: [created_project_id] }) + created_project = resource 'Project', response(created_project_fixture, created_project_endpoint) + + stub( + uri: "projects/#{created_project_id}", + req: { verb: :delete }, + resp: { body: fixture('projects/destroy_project') } + ) + + resp = created_project.destroy + expect(resp.project_id).to eq(created_project_id) + expect(resp['project_id']).to eq(created_project_id) + expect(resp.project_deleted).to be true + end + + specify '#empty' do + stub( + uri: "projects/#{project_id}/empty", + req: { verb: :put }, + resp: { body: fixture('projects/empty_project2') } + ) + + resp = project.empty + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::EmptiedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.keys_deleted).to be true + end + + it 'allows to reload data and perform subsequent requests' do + params = { name: 'OnBoarding-2023', description: 'Updated description' } + + stub( + uri: "projects/#{project_id}", + resp: { body: fixture('projects/project') } + ) + + stub( + uri: "projects/#{project_id}", + req: { body: params, verb: :put }, + resp: { body: fixture('projects/update_project') } + ) + + reloaded_project = project.reload_data + + updated_project = reloaded_project.update params + + expect(updated_project).to be_an_instance_of(described_class) + + key_id = 301_832_195 + comment_id = 16_588_650 + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_id}", + resp: { body: fixture('comments/comment') } + ) + + reloaded_project = updated_project.reload_data + + expect(updated_project).to be_an_instance_of(described_class) + + comment = reloaded_project.key_comment(key_id, comment_id) + + expect(comment).to be_an_instance_of(RubyLokaliseApi::Resources::Comment) + end + + context 'with branches' do + let(:branch_id) { 1234 } + + it 'delegates branches' do + expect_to_delegate(project, :branches, project_id, pagination_params) { |obj| obj.branches(pagination_params) } + end + + it 'delegates branch' do + expect_to_delegate(project, :branch, project_id, branch_id) { |obj| obj.branch(branch_id) } + end + + it 'delegates create_branch' do + params = { + name: 'Ruby_SDK' + } + expect_to_delegate(project, :create_branch, project_id, params) { |obj| obj.create_branch(params) } + end + + it 'delegates update_branch' do + params = { + name: 'Ruby_SDK' + } + expect_to_delegate(project, :update_branch, project_id, params) { |obj| obj.update_branch(params) } + end + + it 'delegates destroy_branch' do + expect_to_delegate(project, :destroy_branch, project_id, branch_id) { |obj| obj.destroy_branch(branch_id) } + end + + it 'delegates merge_branch' do + params = { + force_conflict_resolve_using: 'source', + target_branch_id: 5678 + } + expect_to_delegate(project, :merge_branch, project_id, branch_id, params) do |obj| + obj.merge_branch(branch_id, params) + end + end + end + + context 'with comments' do + let(:key_id) { 301_832_195 } + let(:comment_id) { 16_588_650 } + + specify '#key_comment' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_id}", + resp: { body: fixture('comments/comment') } + ) + + comment = project.key_comment(key_id, comment_id) + + expect(comment).to be_an_instance_of(RubyLokaliseApi::Resources::Comment) + end + + it 'delegates key_comment to comment' do + expect_to_delegate(project, :comment, project_id, key_id, comment_id) do |obj| + obj.key_comment(key_id, comment_id) + end + end + + it 'delegates key_comments to comments' do + expect_to_delegate(project, :comments, project_id, key_id, pagination_params) do |obj| + obj.key_comments(key_id, pagination_params) + end + end + + it 'delegates project_comments' do + expect_to_delegate(project, :project_comments, project_id, pagination_params) do |obj| + obj.project_comments(pagination_params) + end + end + + it 'delegates create_comments' do + params = [{ comment: 'Comment1' }, { comment: 'Comment2' }] + + expect_to_delegate(project, :create_comments, project_id, key_id, params) do |obj| + obj.create_comments(key_id, params) + end + end + + specify '#create_comments' do + comment_data = { comment: 'A single Ruby comment' } + params = { comments: [comment_data] } + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + req: { body: params, verb: :post }, + resp: { body: fixture('comments/single_created_comment') } + ) + + comments = project.create_comments key_id, comment_data + + expect(comments).to be_an_instance_of(RubyLokaliseApi::Collections::KeyComments) + expect(comments.collection.length).to eq(1) + expect_to_have_valid_resources(comments) + + comment = comments[0] + + expect(comment.project_id).to eq(project_id) + expect(comment.comment).to eq(comment_data[:comment]) + end + + it 'delegates destroy_comment' do + expect_to_delegate(project, :destroy_comment, project_id, key_id, comment_id) do |obj| + obj.destroy_comment(key_id, comment_id) + end + end + end + + context 'with contributors' do + let(:contributor_id) { 123 } + + it 'delegates contributors' do + expect_to_delegate(project, :contributors, project_id, pagination_params) do |obj| + obj.contributors(pagination_params) + end + end + + it 'delegates contributor' do + expect_to_delegate(project, :contributor, project_id, contributor_id) { |obj| obj.contributor(contributor_id) } + end + + it 'delegates create_contributors' do + params = { + email: 'ruby@contributor.sample', + fullname: 'Ruby Contributor', + is_admin: true + } + + expect_to_delegate(project, :create_contributors, project_id, params) { |obj| obj.create_contributors(params) } + end + + it 'delegates update_contributor' do + params = { + is_reviewer: true + } + + expect_to_delegate(project, :update_contributor, project_id, contributor_id, params) do |obj| + obj.update_contributor(contributor_id, params) + end + end + + it 'delegates destroy_contributor' do + expect_to_delegate(project, :destroy_contributor, project_id, contributor_id) do |obj| + obj.destroy_contributor(contributor_id) + end + end + end + + context 'with cts' do + let(:status_id) { 567 } + + it 'delegates custom_translation_statuses' do + expect_to_delegate(project, :custom_translation_statuses, project_id, pagination_params) do |obj| + obj.custom_translation_statuses(pagination_params) + end + end + + it 'delegates custom_translation_status' do + expect_to_delegate(project, :custom_translation_status, project_id, status_id) do |obj| + obj.custom_translation_status(status_id) + end + end + + it 'delegates create_custom_translation_status' do + params = { + title: 'ruby', + color: '#ff9f1a' + } + + expect_to_delegate(project, :create_custom_translation_status, project_id, params) do |obj| + obj.create_custom_translation_status(params) + end + end + + it 'delegates update_custom_translation_status' do + params = { + title: 'ruby' + } + + expect_to_delegate(project, :update_custom_translation_status, project_id, status_id, params) do |obj| + obj.update_custom_translation_status(status_id, params) + end + end + + it 'delegates destroy_custom_translation_status' do + expect_to_delegate(project, :destroy_custom_translation_status, project_id, status_id) do |obj| + obj.destroy_custom_translation_status(status_id) + end + end + + it 'delegates custom_translation_status_colors' do + expect_to_delegate(project, :custom_translation_status_colors, project_id, &:custom_translation_status_colors) + end + end + + context 'with files' do + it 'delegates files' do + expect_to_delegate(project, :files, project_id, pagination_params) do |obj| + obj.files(pagination_params) + end + end + + it 'delegates upload_file' do + data = Base64.strict_encode64('{"key1": "Ruby", "key2": "RSpec"}') + + params = { + data: data, + filename: 'rspec.json', + lang_iso: 'en' + } + + expect_to_delegate(project, :upload_file, project_id, params) do |obj| + obj.upload_file(params) + end + end + + it 'delegates download_files' do + params = { + format: :json, + original_filenames: false + } + + expect_to_delegate(project, :download_files, project_id, params) do |obj| + obj.download_files(params) + end + end + + it 'delegates destroy_file' do + file_id = 145 + expect_to_delegate(project, :destroy_file, project_id, file_id) do |obj| + obj.destroy_file(file_id) + end + end + end + + context 'with jwt' do + it 'delegates create_jwt' do + params = { + service: :ota + } + + expect_to_delegate(project, :create_jwt, project_id, params) do |obj| + obj.create_jwt(params) + end + end + end + + context 'with keys' do + let(:key_id) { 876 } + + it 'delegates keys' do + expect_to_delegate(project, :keys, project_id, pagination_params) do |obj| + obj.keys(pagination_params) + end + end + + it 'delegates key' do + expect_to_delegate(project, :key, project_id, key_id) do |obj| + obj.key(key_id) + end + end + + it 'delegates create_keys' do + params = [ + { + key_name: 'ruby_k', + platforms: %w[web ios], + translations: [ + { + language_iso: 'en', + translation: 'Ruby key' + } + ] + }, + { + key_name: 'welcome', + platforms: %w[web], + filenames: { + web: 'secondary-%LANG_ISO%.json' + } + } + ] + + expect_to_delegate(project, :create_keys, project_id, params) do |obj| + obj.create_keys(params) + end + end + + it 'delegates update_key' do + params = { description: 'desc' } + + expect_to_delegate(project, :update_key, project_id, key_id, params) do |obj| + obj.update_key(key_id, params) + end + end + + it 'delegates update_keys' do + params = { + use_automations: false, + keys: [{ + key_id: 1 + }, { + key_id: key_id, + filenames: { web: '%LANG_ISO%.yml' } + }] + } + + expect_to_delegate(project, :update_keys, project_id, params) do |obj| + obj.update_keys(params) + end + end + + it 'delegates destroy_key' do + expect_to_delegate(project, :destroy_key, project_id, key_id) do |obj| + obj.destroy_key(key_id) + end + end + + it 'delegates destroy_keys' do + ids = [1, 2, 3] + + expect_to_delegate(project, :destroy_keys, project_id, ids) do |obj| + obj.destroy_keys(ids) + end + end + end + + context 'with languages' do + let(:language_id) { 543 } + + it 'delegates languages to project_languages' do + expect_to_delegate(project, :project_languages, project_id, pagination_params) do |obj| + obj.languages(pagination_params) + end + end + + it 'delegates language to project_language' do + expect_to_delegate(project, :project_language, project_id, language_id) do |obj| + obj.language(language_id) + end + end + + it 'delegates create_languages to create_project_languages' do + params = [{ + lang_iso: 'de' + }, { + lang_iso: 'nl' + }] + + expect_to_delegate(project, :create_project_languages, project_id, params) do |obj| + obj.create_languages(params) + end + end + + it 'delegates update_language to update_project_language' do + params = { + lang_name: 'French (updated)' + } + + expect_to_delegate(project, :update_project_language, project_id, language_id, params) do |obj| + obj.update_language(language_id, params) + end + end + + it 'delegates destroy_language to destroy_project_language' do + expect_to_delegate(project, :destroy_project_language, project_id, language_id) do |obj| + obj.destroy_language(language_id) + end + end + end + + context 'with processes' do + let(:process_id) { 156 } + + it 'delegates queued_processes' do + expect_to_delegate(project, :queued_processes, project_id, pagination_params) do |obj| + obj.queued_processes(pagination_params) + end + end + + it 'delegates queued_process' do + expect_to_delegate(project, :queued_process, project_id, process_id) do |obj| + obj.queued_process(process_id) + end + end + end + + context 'with segments' do + let(:key_id) { 353_507_573 } + let(:lang_iso) { 'en' } + let(:segment_number) { 1 } + + it 'delegates segments' do + params = { + disable_references: 1 + } + expect_to_delegate(project, :segments, project_id, key_id, lang_iso, segment_number, params) do |obj| + obj.segments(key_id, lang_iso, segment_number, params) + end + end + + it 'delegates segment' do + params = { disable_references: 1 } + + expect_to_delegate(project, :segment, project_id, key_id, lang_iso, segment_number, params) do |obj| + obj.segment(key_id, lang_iso, segment_number, params) + end + end + + it 'delegates update_segment' do + params = { + value: 'Updated.', + is_fuzzy: false + } + + expect_to_delegate(project, :update_segment, project_id, key_id, lang_iso, segment_number, params) do |obj| + obj.update_segment(key_id, lang_iso, segment_number, params) + end + end + end + + context 'with screenshots' do + let(:screenshot_id) { 145 } + + it 'delegates screenshots' do + expect_to_delegate(project, :screenshots, project_id, pagination_params) do |obj| + obj.screenshots(pagination_params) + end + end + + it 'delegates screenshot' do + expect_to_delegate(project, :screenshot, project_id, screenshot_id) do |obj| + obj.screenshot(screenshot_id) + end + end + + it 'delegates create_screenshots' do + params = [{ + data: 'fake', + title: 'Ruby', + description: 'SDK' + }] + + expect_to_delegate(project, :create_screenshots, project_id, params) do |obj| + obj.create_screenshots(params) + end + end + + it 'delegates update_screenshot' do + params = { + title: 'Ruby updated', + tags: %w[one two] + } + + expect_to_delegate(project, :update_screenshot, project_id, screenshot_id, params) do |obj| + obj.update_screenshot(screenshot_id, params) + end + end + + it 'delegates destroy_screenshot' do + expect_to_delegate(project, :destroy_screenshot, project_id, screenshot_id) do |obj| + obj.destroy_screenshot(screenshot_id) + end + end + end + + context 'with snapshots' do + let(:snapshot_id) { 156 } + + it 'delegates snapshots' do + expect_to_delegate(project, :snapshots, project_id, pagination_params) do |obj| + obj.snapshots(pagination_params) + end + end + + it 'delegates create_snapshot' do + params = { + title: 'Ruby SDK' + } + + expect_to_delegate(project, :create_snapshot, project_id, params) do |obj| + obj.create_snapshot(params) + end + end + + it 'delegates restore_snapshot' do + expect_to_delegate(project, :restore_snapshot, project_id, snapshot_id) do |obj| + obj.restore_snapshot(snapshot_id) + end + end + + it 'delegates destroy_snapshot' do + expect_to_delegate(project, :destroy_snapshot, project_id, snapshot_id) do |obj| + obj.destroy_snapshot(snapshot_id) + end + end + end + + context 'with tasks' do + let(:task_id) { 145 } + + it 'delegates tasks' do + expect_to_delegate(project, :tasks, project_id, pagination_params) do |obj| + obj.tasks(pagination_params) + end + end + + it 'delegates task' do + expect_to_delegate(project, :task, project_id, task_id) do |obj| + obj.task(task_id) + end + end + + it 'delegates create_task' do + params = { + title: 'Ruby SDK', + keys: %w[331018374 324729217], + languages: [ + { + language_iso: 'de', + users: %w[20181] + } + ], + source_language_iso: 'en', + task_type: 'translation' + } + + expect_to_delegate(project, :create_task, project_id, params) do |obj| + obj.create_task(params) + end + end + + it 'delegates update_task' do + params = { + title: 'Ruby updated', + description: 'updated via sdk' + } + + expect_to_delegate(project, :update_task, project_id, task_id, params) do |obj| + obj.update_task(task_id, params) + end + end + + it 'delegates destroy_task' do + expect_to_delegate(project, :destroy_task, project_id, task_id) do |obj| + obj.destroy_task(task_id) + end + end + end + + context 'with translations' do + let(:translation_id) { 156 } + + it 'delegates translations' do + expect_to_delegate(project, :translations, project_id, pagination_params) do |obj| + obj.translations(pagination_params) + end + end + + it 'delegates translation' do + params = { disable_references: 1 } + + expect_to_delegate(project, :translation, project_id, translation_id, params) do |obj| + obj.translation(translation_id, params) + end + end + + it 'delegates update_translation' do + params = { + translation: 'Updated from Ruby', + is_reviewed: true + } + + expect_to_delegate(project, :update_translation, project_id, translation_id, params) do |obj| + obj.update_translation(translation_id, params) + end + end + end + + context 'with webhooks' do + let(:webhook_id) { 964 } + + it 'delegates webhooks' do + expect_to_delegate(project, :webhooks, project_id, pagination_params) do |obj| + obj.webhooks(pagination_params) + end + end + + it 'delegates webhook' do + expect_to_delegate(project, :webhook, project_id, webhook_id) do |obj| + obj.webhook(webhook_id) + end + end + + it 'delegates create_webhook' do + params = { + url: 'https://bodrovis.tech/lokalise', + events: %w[project.snapshot project.branch.merged] + } + + expect_to_delegate(project, :create_webhook, project_id, params) do |obj| + obj.create_webhook(params) + end + end + + it 'delegates update_webhook' do + params = { + events: %w[project.exported] + } + + expect_to_delegate(project, :update_webhook, project_id, params) do |obj| + obj.update_webhook(params) + end + end + + it 'delegates regenerate_webhook_secret' do + expect_to_delegate(project, :regenerate_webhook_secret, project_id, webhook_id) do |obj| + obj.regenerate_webhook_secret(webhook_id) + end + end + + it 'delegates destroy_webhook' do + expect_to_delegate(project, :destroy_webhook, project_id, webhook_id) do |obj| + obj.destroy_webhook(webhook_id) + end + end + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/queued_process_spec.rb b/spec/lib/ruby_lokalise_api/resources/queued_process_spec.rb new file mode 100644 index 0000000..1b63b03 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/queued_process_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::QueuedProcess do + let(:process_fixture) { loaded_fixture('processes/process') } + + let(:project_id) { process_fixture['project_id'] } + + let(:process_endpoint) do + params = { query: [project_id, process_fixture['process']['process_id']] } + endpoint name: 'QueuedProcesses', client: test_client, params: params + end + + let(:process) do + resource 'QueuedProcess', response(process_fixture, process_endpoint) + end + + it 'does not support update' do + expect(process).not_to respond_to(:update) + end + + it 'does not support destroy' do + expect(process).not_to respond_to(:destroy) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/processes/#{process.process_id}", + resp: { body: fixture('processes/process') } + ) + + reloaded_process = process.reload_data + + expect(reloaded_process.process_id).to eq(process.process_id) + expect(reloaded_process.project_id).to eq(project_id) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/screenshot_spec.rb b/spec/lib/ruby_lokalise_api/resources/screenshot_spec.rb new file mode 100644 index 0000000..f4f2d47 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/screenshot_spec.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Screenshot do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_screen_fixture) { loaded_fixture('screenshots/screenshot') } + + let(:screen_id) { loaded_screen_fixture['screenshot']['screenshot_id'] } + + let(:screen_endpoint) do + endpoint name: 'Screenshots', client: test_client, params: { query: [project_id, screen_id] } + end + + let(:screen) do + resource 'Screenshot', response(loaded_screen_fixture, screen_endpoint) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/screenshots/#{screen_id}", + resp: { body: fixture('screenshots/screenshot') } + ) + + reloaded_screen = screen.reload_data + + expect(reloaded_screen.screenshot_id).to eq(screen_id) + end + + specify '#update' do + screenshot_data = { + title: 'Ruby updated', + tags: %w[one two] + } + + stub( + uri: "projects/#{project_id}/screenshots/#{screen_id}", + req: { body: screenshot_data, verb: :put }, + resp: { body: fixture('screenshots/update_screenshot') } + ) + + updated_screen = screen.update screenshot_data + + expect(updated_screen).to be_an_instance_of(described_class) + expect(updated_screen.title).to eq(screenshot_data[:title]) + expect(updated_screen.screenshot_tags).to include(*screenshot_data[:tags]) + expect(updated_screen.screenshot_id).to eq(screen_id) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/screenshots/#{screen_id}", + req: { verb: :delete }, + resp: { body: fixture('screenshots/destroy_screenshot') } + ) + + resp = screen.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.screenshot_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/segment_spec.rb b/spec/lib/ruby_lokalise_api/resources/segment_spec.rb new file mode 100644 index 0000000..58edce9 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/segment_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Segment do + let(:project_id) { '7451498664b95d6111c812.34468173' } + + let(:segment_f) { loaded_fixture('segments/segment') } + let(:segment_number) { segment_f['segment']['segment_number'] } + let(:segment_endpoint) do + endpoint name: 'Segments', client: test_client, params: { + query: [project_id, segment_f['key_id'], segment_f['language_iso'], segment_number] + } + end + + let(:segment) do + resource 'Segment', response(segment_f, segment_endpoint) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/keys/#{segment_f['key_id']}/segments/#{segment_f['language_iso']}/#{segment_number}", + resp: { body: fixture('segments/segment') } + ) + + reloaded_segment = segment.reload_data + + expect(reloaded_segment.segment_number).to eq(segment_number) + end + + specify '#update' do + segment_data = { + value: 'Updated.', + is_fuzzy: false + } + + stub( + uri: "projects/#{project_id}/keys/#{segment_f['key_id']}/segments/#{segment_f['language_iso']}/#{segment_number}", + req: { body: segment_data, verb: :put }, + resp: { body: fixture('segments/update_segment') } + ) + + updated_segment = segment.update segment_data + + expect(updated_segment).to be_an_instance_of(described_class) + expect(updated_segment.value).to eq(segment_data[:value]) + expect(updated_segment.is_fuzzy).to eq(segment_data[:is_fuzzy]) + end + + it 'does not support' do + expect(segment).not_to respond_to(:destroy) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/snapshot_spec.rb b/spec/lib/ruby_lokalise_api/resources/snapshot_spec.rb new file mode 100644 index 0000000..e10dbce --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/snapshot_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Snapshot do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_snapshots_fixture) { loaded_fixture('snapshots/snapshots') } + + let(:snapshots) do + collection 'Snapshots', response(loaded_snapshots_fixture, snapshots_endpoint) + end + + let(:snapshots_endpoint) do + params = { query: project_id } + endpoint name: 'Snapshots', client: test_client, params: params + end + + it 'does not support update' do + expect(snapshots[0]).not_to respond_to(:update) + end + + it 'does not support reload_data' do + expect(snapshots[0]).not_to respond_to(:reload_data) + end + + specify '#restore' do + stub( + uri: "projects/#{project_id}/snapshots/#{snapshots[0].snapshot_id}", + req: { verb: :post }, + resp: { body: fixture('snapshots/restore_snapshot2') } + ) + + restored_project = snapshots[0].restore + + expect(restored_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(restored_project.name).to eq('OnBoarding-2023 copy') + expect(restored_project.project_id).not_to eq(project_id) + + endpoint = restored_project.instance_variable_get(:@self_endpoint) + expect(endpoint).to be_an_instance_of(RubyLokaliseApi::Endpoints::ProjectsEndpoint) + expect(endpoint.uri).to include('projects', project_id) + expect(endpoint.uri).not_to include('snapshots') + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/snapshots/#{snapshots[0].snapshot_id}", + req: { verb: :delete }, + resp: { body: fixture('snapshots/destroy_snapshot') } + ) + + resp = snapshots[0].destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.snapshot_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/system_language_spec.rb b/spec/lib/ruby_lokalise_api/resources/system_language_spec.rb new file mode 100644 index 0000000..4986832 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/system_language_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::SystemLanguage do + subject do + described_class.new response(nil, nil) + end + + it { is_expected.not_to respond_to(:update) } + it { is_expected.not_to respond_to(:destroy) } + it { is_expected.not_to respond_to(:reload_data) } +end diff --git a/spec/lib/ruby_lokalise_api/resources/task_spec.rb b/spec/lib/ruby_lokalise_api/resources/task_spec.rb new file mode 100644 index 0000000..33e07d5 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/task_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Task do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_task_fixture) { loaded_fixture('tasks/task') } + + let(:task_id) { loaded_task_fixture['task']['task_id'] } + + let(:task_endpoint) do + endpoint name: 'Tasks', client: test_client, params: { query: [project_id, task_id] } + end + + let(:task) do + resource 'Task', response(loaded_task_fixture, task_endpoint) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/tasks/#{task_id}", + resp: { body: fixture('tasks/task') } + ) + + reloaded_task = task.reload_data + + expect(reloaded_task.task_id).to eq(task_id) + end + + specify '#update' do + task_data = { + title: 'Ruby updated', + description: 'updated via sdk' + } + + stub( + uri: "projects/#{project_id}/tasks/#{task_id}", + req: { body: task_data, verb: :put }, + resp: { body: fixture('tasks/update_task2') } + ) + + updated_task = task.update task_data + + expect(updated_task).to be_an_instance_of(described_class) + expect(updated_task.title).to eq(task_data[:title]) + expect(updated_task.description).to eq(task_data[:description]) + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/tasks/#{task_id}", + req: { verb: :delete }, + resp: { body: fixture('tasks/destroy_task') } + ) + + resp = task.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.task_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/team_spec.rb b/spec/lib/ruby_lokalise_api/resources/team_spec.rb new file mode 100644 index 0000000..683a86a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/team_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Team do + subject do + described_class.new response(nil, nil) + end + + it { is_expected.not_to respond_to(:update) } + it { is_expected.not_to respond_to(:destroy) } + it { is_expected.not_to respond_to(:reload_data) } +end diff --git a/spec/lib/ruby_lokalise_api/resources/team_user_billing_details_spec.rb b/spec/lib/ruby_lokalise_api/resources/team_user_billing_details_spec.rb new file mode 100644 index 0000000..14246ee --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/team_user_billing_details_spec.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::TeamUserBillingDetails do + let(:team_id) { 176_692 } + + specify '#reload_data' do + stub( + uri: "teams/#{team_id}/billing_details", + resp: { body: fixture('team_user_billing_details/team_user_billing_details') } + ) + + details = test_client.team_user_billing_details team_id + + reloaded_details = details.reload_data + + expect(reloaded_details).to be_an_instance_of(described_class) + end + + specify '#update' do + stub( + uri: "teams/#{team_id}/billing_details", + resp: { body: fixture('team_user_billing_details/team_user_billing_details') } + ) + + details = test_client.team_user_billing_details team_id + + details_data = { + billing_email: 'hi2@lokalise.com', + country_code: 'LV', + zip: 'LV-1234' + } + + stub( + uri: "teams/#{team_id}/billing_details", + req: { body: details_data, verb: :put }, + resp: { body: fixture('team_user_billing_details/update_billing_details') } + ) + + updated_details = details.update details_data + + expect(updated_details.billing_email).to eq(details_data[:billing_email]) + expect(updated_details.team_id).to eq(team_id) + end + + it 'does not support destroy' do + stub( + uri: "teams/#{team_id}/billing_details", + resp: { body: fixture('team_user_billing_details/team_user_billing_details') } + ) + + details = test_client.team_user_billing_details team_id + + expect(details).not_to respond_to(:destroy) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/team_user_group_spec.rb b/spec/lib/ruby_lokalise_api/resources/team_user_group_spec.rb new file mode 100644 index 0000000..d8d6a0c --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/team_user_group_spec.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::TeamUserGroup do + let(:team_id) { 176_692 } + + let(:loaded_group_fixture) { loaded_fixture('team_user_groups/team_user_group') } + + let(:group_id) { loaded_group_fixture['group_id'] } + + let(:group_endpoint) do + endpoint name: 'TeamUserGroups', client: test_client, params: { query: [team_id, group_id] } + end + + let(:group) do + resource 'TeamUserGroup', response(loaded_group_fixture, group_endpoint) + end + + specify '#reload_data' do + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + resp: { body: fixture('team_user_groups/team_user_group') } + ) + + reloaded_group = group.reload_data + + expect(reloaded_group).to be_an_instance_of(described_class) + expect(reloaded_group.group_id).to eq(group_id) + end + + specify '#update' do + group_data = { + name: 'Updated SDK', + is_reviewer: true, + is_admin: false, + languages: { + reference: [], + contributable: [640] + } + } + + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + req: { body: group_data, verb: :put }, + resp: { body: fixture('team_user_groups/update_team_user_group') } + ) + + updated_group = group.update group_data + + expect(updated_group.team_id).to eq(team_id) + expect(updated_group.group_id).to eq(group_id) + expect(updated_group.name).to eq(group_data[:name]) + expect(updated_group.permissions['is_admin']).to eq(group_data[:is_admin]) + end + + specify '#add_projects' do + project_ids = %w[963054665b7c313dd9b323.35886655 2273827860c1e2473eb195.11207948] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/projects/add", + req: { body: { projects: project_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/add_projects_to_group') } + ) + + updated_group = group.add_projects project_ids + + expect(updated_group.team_id).to eq(team_id) + expect(updated_group.group_id).to eq(group_id) + expect(updated_group.projects).to include(*project_ids) + end + + specify '#remove_projects' do + project_ids = %w[963054665b7c313dd9b323.35886655] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/projects/remove", + req: { body: { projects: project_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/remove_projects_from_group') } + ) + + updated_group = group.remove_projects project_ids + + expect(updated_group.team_id).to eq(team_id) + expect(updated_group.group_id).to eq(group_id) + expect(updated_group.projects).not_to include(*project_ids) + end + + specify '#add_members' do + user_ids = [140_889, 132_650] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/members/add", + req: { body: { users: user_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/add_members_to_group') } + ) + + updated_group = group.add_members user_ids + + expect(updated_group.team_id).to eq(team_id) + expect(updated_group.group_id).to eq(group_id) + expect(updated_group.members).to include(*user_ids) + end + + specify '#remove_members' do + user_ids = 140_889 + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/members/remove", + req: { body: { users: [user_ids] }, verb: :put }, + resp: { body: fixture('team_user_groups/remove_members_from_group') } + ) + + updated_group = group.remove_members user_ids + + expect(updated_group.team_id).to eq(team_id) + expect(updated_group.group_id).to eq(group_id) + expect(updated_group.members).not_to include(user_ids) + end + + specify '#destroy' do + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + req: { verb: :delete }, + resp: { body: fixture('team_user_groups/destroy_team_user_group') } + ) + + resp = group.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.team_id).to eq(team_id) + expect(resp.group_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/team_user_spec.rb b/spec/lib/ruby_lokalise_api/resources/team_user_spec.rb new file mode 100644 index 0000000..be365eb --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/team_user_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::TeamUser do + let(:team_id) { 176_692 } + + let(:loaded_user_fixture) { loaded_fixture('team_users/team_user') } + + let(:user_id) { loaded_user_fixture['team_user']['user_id'] } + + let(:user_endpoint) do + endpoint name: 'TeamUsers', client: test_client, params: { query: [team_id, user_id] } + end + + let(:user) do + resource 'TeamUser', response(loaded_user_fixture, user_endpoint) + end + + specify '#reload_data' do + stub( + uri: "teams/#{team_id}/users/#{user_id}", + resp: { body: fixture('team_users/team_user') } + ) + + reloaded_user = user.reload_data + + expect(reloaded_user).to be_an_instance_of(described_class) + expect(reloaded_user.user_id).to eq(user_id) + end + + specify '#update' do + user_data = { + role: 'admin' + } + + stub( + uri: "teams/#{team_id}/users/#{user_id}", + req: { body: user_data, verb: :put }, + resp: { body: fixture('team_users/update_team_user') } + ) + + updated_user = user.update user_data + + expect(updated_user).to be_an_instance_of(described_class) + expect(updated_user.user_id).to eq(user_id) + expect(updated_user.role).to eq(user_data[:role]) + end + + specify '#destroy' do + stub( + uri: "teams/#{team_id}/users/#{user_id}", + req: { verb: :delete }, + resp: { body: fixture('team_users/destroy_team_user') } + ) + + resp = user.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.team_id).to eq(team_id) + expect(resp.team_user_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/translation_provider_spec.rb b/spec/lib/ruby_lokalise_api/resources/translation_provider_spec.rb new file mode 100644 index 0000000..4c3c4af --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/translation_provider_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::TranslationProvider do + let(:team_id) { 176_692 } + let(:provider_id) { 1 } + + specify '#reload_data' do + stub( + uri: "teams/#{team_id}/translation_providers/#{provider_id}", + resp: { body: fixture('translation_providers/translation_provider') } + ) + + provider = test_client.translation_provider team_id, provider_id + + reloaded_provider = provider.reload_data + + expect(reloaded_provider.provider_id).to eq(provider_id) + end + + it 'does not support update' do + stub( + uri: "teams/#{team_id}/translation_providers/#{provider_id}", + resp: { body: fixture('translation_providers/translation_provider') } + ) + + provider = test_client.translation_provider team_id, provider_id + + expect(provider).not_to respond_to(:update) + end + + it 'does not support destroy' do + stub( + uri: "teams/#{team_id}/translation_providers/#{provider_id}", + resp: { body: fixture('translation_providers/translation_provider') } + ) + + provider = test_client.translation_provider team_id, provider_id + + expect(provider).not_to respond_to(:destroy) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/translation_spec.rb b/spec/lib/ruby_lokalise_api/resources/translation_spec.rb new file mode 100644 index 0000000..30b6e20 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/translation_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Translation do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_translation_fixture) { loaded_fixture('translations/translation') } + + let(:translation_id) { loaded_translation_fixture['translation']['translation_id'] } + + let(:translation_endpoint) do + endpoint name: 'Translations', client: test_client, params: { query: [project_id, translation_id] } + end + + let(:translation) do + resource 'Translation', response(loaded_translation_fixture, translation_endpoint) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/translations/#{translation_id}", + resp: { body: fixture('translations/translation') } + ) + + reloaded_translation = translation.reload_data + + expect(reloaded_translation.translation_id).to eq(translation_id) + end + + specify '#update' do + translation_data = { + translation: 'Updated from Ruby', + is_reviewed: true + } + + stub( + uri: "projects/#{project_id}/translations/#{translation_id}", + req: { body: translation_data, verb: :put }, + resp: { body: fixture('translations/update_translation') } + ) + + updated_translation = translation.update translation_data + + expect(updated_translation).to be_an_instance_of(described_class) + expect(updated_translation.translation).to eq(translation_data[:translation]) + expect(updated_translation.is_reviewed).to eq(translation_data[:is_reviewed]) + end + + it 'does not support destroy' do + expect(translation).not_to respond_to(:destroy) + end +end diff --git a/spec/lib/ruby_lokalise_api/resources/webhook_spec.rb b/spec/lib/ruby_lokalise_api/resources/webhook_spec.rb new file mode 100644 index 0000000..33f4580 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/resources/webhook_spec.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Resources::Webhook do + let(:project_id) { '88628569645b945648b474.25982965' } + + let(:loaded_webhook_fixture) { loaded_fixture('webhooks/webhook') } + + let(:webhook_id) { loaded_webhook_fixture['webhook']['webhook_id'] } + + let(:webhook_endpoint) do + endpoint name: 'Webhooks', client: test_client, params: { query: [project_id, webhook_id] } + end + + let(:webhook) do + resource 'Webhook', response(loaded_webhook_fixture, webhook_endpoint) + end + + specify '#reload_data' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + resp: { body: fixture('webhooks/webhook') } + ) + + reloaded_webhook = webhook.reload_data + + expect(reloaded_webhook.webhook_id).to eq(webhook_id) + end + + specify '#update' do + webhook_data = { + events: %w[project.exported] + } + + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + req: { body: webhook_data, verb: :put }, + resp: { body: fixture('webhooks/update_webhook') } + ) + + updated_webhook = webhook.update webhook_data + + expect(updated_webhook).to be_an_instance_of(described_class) + expect(updated_webhook.webhook_id).to eq(webhook_id) + expect(updated_webhook.events).to eq(webhook_data[:events]) + end + + specify '#regenerate_secret' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}/secret/regenerate", + req: { verb: :patch }, + resp: { body: fixture('webhooks/regenerate_webhook_secret') } + ) + + response = webhook.regenerate_secret + + expect(response).to be_an_instance_of(RubyLokaliseApi::Generics::RegeneratedWebhookSecret) + expect(response.project_id).to eq(project_id) + expect(response.secret).to include('70fb') + end + + specify '#destroy' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + req: { verb: :delete }, + resp: { body: fixture('webhooks/destroy_webhook') } + ) + + resp = webhook.destroy + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.webhook_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/branches_spec.rb b/spec/lib/ruby_lokalise_api/rest/branches_spec.rb new file mode 100644 index 0000000..36696ca --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/branches_spec.rb @@ -0,0 +1,114 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Branches do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:branch_id) { 324_739 } + + specify '#branches' do + stub( + uri: "projects/#{project_id}/branches", + resp: { body: fixture('branches/branches') } + ) + + branches = test_client.branches project_id + + expect(branches.collection.length).to eq(3) + expect_to_have_valid_resources(branches) + expect(branches.project_id).to eq(project_id) + expect(branches.branch).to eq('master') + + branch = branches.first + + expect(branch.branch_id).to eq(324_739) + end + + specify '#branch' do + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + resp: { body: fixture('branches/branch') } + ) + + branch = test_client.branch project_id, branch_id + + expect(branch.branch_id).to eq(branch_id) + expect(branch.project_id).to eq(project_id) + expect(branch.name).to eq('demo') + expect(branch[:name]).to eq('demo') + expect(branch.created_at).to eq('2023-07-11 16:48:04 (Etc/UTC)') + expect(branch.created_at_timestamp).to eq(1_689_094_084) + expect(branch.created_by).to eq(20_181) + expect(branch.created_by_email).to eq('bodrovis@protonmail.com') + end + + specify '#create_branch' do + branch_data = { + name: 'Ruby_SDK' + } + + stub( + uri: "projects/#{project_id}/branches", + req: { body: branch_data, verb: :post }, + resp: { body: fixture('branches/create_branch') } + ) + + branch = test_client.create_branch project_id, branch_data + + expect(branch).to be_an_instance_of(RubyLokaliseApi::Resources::Branch) + expect(branch.name).to eq(branch_data[:name]) + expect(branch.project_id).to eq(project_id) + end + + specify '#update_branch' do + branch_data = { + name: 'Ruby_updated' + } + + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + req: { body: branch_data, verb: :put }, + resp: { body: fixture('branches/update_branch') } + ) + + branch = test_client.update_branch project_id, branch_id, branch_data + + expect(branch).to be_an_instance_of(RubyLokaliseApi::Resources::Branch) + expect(branch.name).to eq(branch_data[:name]) + expect(branch.branch_id).to eq(branch_id) + end + + specify '#destroy_branch' do + stub( + uri: "projects/#{project_id}/branches/#{branch_id}", + req: { verb: :delete }, + resp: { body: fixture('branches/destroy_branch') } + ) + + resp = test_client.destroy_branch project_id, branch_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.branch_deleted).to be true + end + + specify '#merge_branch' do + merge_source = 324_747 + merge_target = 324_738 + data = { + force_conflict_resolve_using: 'source', + target_branch_id: merge_target + } + + stub( + uri: "projects/#{project_id}/branches/#{merge_source}/merge", + req: { body: data, verb: :post }, + resp: { body: fixture('branches/merge_branch') } + ) + + resp = test_client.merge_branch project_id, merge_source, data + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::MergedBranches) + expect(resp.project_id).to eq(project_id) + expect(resp.branch['branch_id']).to eq(merge_source) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/comments_spec.rb b/spec/lib/ruby_lokalise_api/rest/comments_spec.rb new file mode 100644 index 0000000..5d42288 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/comments_spec.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Comments do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:key_id) { 301_832_195 } + let(:comment_id) { 16_588_650 } + + specify '#comment' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_id}", + resp: { body: fixture('comments/comment') } + ) + + comment = test_client.comment(project_id, key_id, comment_id) + + expect(comment.project_id).to eq(project_id) + expect(comment.comment_id).to eq(comment_id) + expect(comment.key_id).to eq(key_id) + expect(comment.comment).to eq('

Hi!

') + expect(comment.added_by).to eq(20_181) + expect(comment.added_by_email).to eq('bodrovis@protonmail.com') + expect(comment.added_at).to eq('2023-04-21 14:11:11 (Etc/UTC)') + expect(comment.added_at_timestamp).to eq(1_682_086_271) + end + + specify '#comments' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + resp: { body: fixture('comments/comments') } + ) + + comments = test_client.comments project_id, key_id + expect(comments.collection.length).to eq(3) + expect_to_have_valid_resources(comments) + expect(comments.project_id).to eq(project_id) + expect(comments.branch).to be_nil + + comment = comments[0] + + expect(comment.comment_id).to eq(16_588_650) + expect(comment.project_id).to eq(project_id) + end + + specify '#project_comments' do + stub( + uri: "projects/#{project_id}/comments", + resp: { body: fixture('comments/project_comments') } + ) + + comments = test_client.project_comments project_id + expect_to_have_valid_resources(comments) + expect(comments.project_id).to eq(project_id) + expect(comments.branch).to be_nil + + comment = comments[0] + + expect(comment.comment_id).to eq(16_588_650) + expect(comment.project_id).to eq(project_id) + end + + describe '#create_comments' do + it 'creates one comment' do + comment_data = { comment: 'A single Ruby comment' } + params = { comments: [comment_data] } + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + req: { body: params, verb: :post }, + resp: { body: fixture('comments/single_created_comment') } + ) + + comments = test_client.create_comments project_id, key_id, comment_data + + expect(comments).to be_an_instance_of(RubyLokaliseApi::Collections::KeyComments) + expect(comments.collection.length).to eq(1) + expect_to_have_valid_resources(comments) + + comment = comments[0] + + expect(comment.project_id).to eq(project_id) + expect(comment.comment).to eq(comment_data[:comment]) + end + + it 'creates multiple comments' do + comment_data = [{ comment: 'Comment1' }, { comment: 'Comment2' }] + + params = { comments: comment_data } + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments", + req: { body: params, verb: :post }, + resp: { body: fixture('comments/multiple_created_comments') } + ) + + comments = test_client.create_comments project_id, key_id, comment_data + + expect(comments).to be_an_instance_of(RubyLokaliseApi::Collections::KeyComments) + expect(comments.collection.length).to eq(2) + expect_to_have_valid_resources(comments) + + comment = comments[0] + + expect(comment.project_id).to eq(project_id) + expect(comment.comment).to eq(comment_data[0][:comment]) + end + end + + specify '#destroy_comment' do + comment_to_delete = 16_784_635 + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/comments/#{comment_to_delete}", + req: { verb: :delete }, + resp: { body: fixture('comments/destroy_comment') } + ) + + resp = test_client.destroy_comment(project_id, key_id, comment_to_delete) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.comment_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/contributors_spec.rb b/spec/lib/ruby_lokalise_api/rest/contributors_spec.rb new file mode 100644 index 0000000..2fe9f4f --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/contributors_spec.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Contributors do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:user_id) { 20_181 } + + specify '#contributor' do + stub( + uri: "projects/#{project_id}/contributors/#{user_id}", + resp: { body: fixture('contributors/contributor') } + ) + + contributor = test_client.contributor project_id, user_id + + expect(contributor.project_id).to eq(project_id) + expect(contributor.user_id).to eq(user_id) + expect(contributor.email).to eq('bodrovis@protonmail.com') + expect(contributor.fullname).to eq('Ilya B') + expect(contributor.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)') + expect(contributor.created_at_timestamp).to eq(1_534_865_725) + expect(contributor.is_admin).to be true + expect(contributor.is_reviewer).to be true + expect(contributor.languages).to include( + 'lang_id' => 10_001, + 'lang_iso' => 'custom_1', + 'lang_name' => 'Quenya', + 'is_writable' => true + ) + expect(contributor.admin_rights).to include('upload') + end + + specify '#contributors' do + stub( + uri: "projects/#{project_id}/contributors", + resp: { body: fixture('contributors/contributors') } + ) + + contributors = test_client.contributors project_id + + expect(contributors.collection.length).to eq(3) + expect_to_have_valid_resources(contributors) + expect(contributors.project_id).to eq(project_id) + expect(contributors.branch).to eq('master') + + contributor = contributors[0] + + expect(contributor.user_id).to eq(20_181) + expect(contributor.project_id).to eq(project_id) + end + + specify '#create_contributors' do + contributor_data = { + email: 'ruby@contributor.sample', + fullname: 'Ruby Contributor', + is_admin: true + } + + stub( + uri: "projects/#{project_id}/contributors", + req: { body: { contributors: [contributor_data] }, verb: :post }, + resp: { body: fixture('contributors/create_contributor') } + ) + + contributors = test_client.create_contributors project_id, contributor_data + + expect(contributors).to be_an_instance_of(RubyLokaliseApi::Collections::Contributors) + expect_to_have_valid_resources(contributors) + + contributor = contributors[0] + + expect(contributor.project_id).to eq(project_id) + expect(contributor.fullname).to eq(contributor_data[:fullname]) + end + + specify '#update_contributor' do + update_contributor_id = 269_338 + + contributor_data = { + is_reviewer: true + } + + stub( + uri: "projects/#{project_id}/contributors/#{update_contributor_id}", + req: { body: contributor_data, verb: :put }, + resp: { body: fixture('contributors/update_contributor') } + ) + + contributor = test_client.update_contributor project_id, update_contributor_id, contributor_data + + expect(contributor).to be_an_instance_of(RubyLokaliseApi::Resources::Contributor) + expect(contributor.user_id).to eq(update_contributor_id) + expect(contributor.is_reviewer).to be true + end + + specify '#destroy_contributor' do + contributor_to_delete = 269_338 + + stub( + uri: "projects/#{project_id}/contributors/#{contributor_to_delete}", + req: { verb: :delete }, + resp: { body: fixture('contributors/destroy_contributor') } + ) + + resp = test_client.destroy_contributor(project_id, contributor_to_delete) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.contributor_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/custom_translation_statuses_spec.rb b/spec/lib/ruby_lokalise_api/rest/custom_translation_statuses_spec.rb new file mode 100644 index 0000000..2f89f54 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/custom_translation_statuses_spec.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::CustomTranslationStatuses do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:status_id) { 14_462 } + + specify '#custom_translation_status' do + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{status_id}", + resp: { body: fixture('cts/status') } + ) + + status = test_client.custom_translation_status project_id, status_id + + expect(status.project_id).to eq(project_id) + expect(status.branch).to eq('master') + expect(status.status_id).to eq(status_id) + expect(status.title).to eq('approved') + expect(status.color).to eq('#0079bf') + end + + specify '#custom_translation_statuses' do + stub( + uri: "projects/#{project_id}/custom_translation_statuses", + resp: { + body: fixture('cts/statuses'), + headers: { + 'x-pagination-total-count': '3', + 'x-pagination-page-count': '1', + 'x-pagination-limit': '100', + 'x-pagination-page': '1' + } + } + ) + + statuses = test_client.custom_translation_statuses project_id + + expect(statuses.project_id).to eq(project_id) + expect(statuses.branch).to eq('master') + expect(statuses).to be_an_instance_of(RubyLokaliseApi::Collections::CustomTranslationStatuses) + expect(statuses.total_results).to eq(3) + expect_to_have_valid_resources(statuses) + end + + specify '#create_custom_translation_status' do + data = { + title: 'ruby', + color: '#ff9f1a' + } + + stub( + uri: "projects/#{project_id}/custom_translation_statuses", + req: { body: data, verb: :post }, + resp: { body: fixture('cts/create_status') } + ) + + status = test_client.create_custom_translation_status project_id, data + + expect(status.project_id).to eq(project_id) + expect(status.title).to eq(data[:title]) + end + + specify '#update_custom_translation_status' do + data = { + title: 'ruby2' + } + update_status_id = 14_465 + + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{update_status_id}", + req: { body: data, verb: :put }, + resp: { body: fixture('cts/update_status') } + ) + + status = test_client.update_custom_translation_status project_id, update_status_id, data + + expect(status.status_id).to eq(update_status_id) + expect(status.title).to eq(data[:title]) + end + + specify '#destroy_custom_translation_status' do + destroy_status_id = 14_465 + + stub( + uri: "projects/#{project_id}/custom_translation_statuses/#{destroy_status_id}", + req: { verb: :delete }, + resp: { body: fixture('cts/destroy_status') } + ) + + res = test_client.destroy_custom_translation_status project_id, destroy_status_id + + expect(res.project_id).to eq(project_id) + expect(res.branch).to eq('master') + expect(res.custom_translation_status_deleted).to be true + end + + specify '#custom_translation_status_colors' do + stub( + uri: "projects/#{project_id}/custom_translation_statuses/colors", + resp: { body: fixture('cts/colors') } + ) + + res = test_client.custom_translation_status_colors project_id + + expect(res).to be_an_instance_of(RubyLokaliseApi::Generics::CustomStatusAvailableColors) + expect(res.colors).to include('#61bd4f') + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/files_spec.rb b/spec/lib/ruby_lokalise_api/rest/files_spec.rb new file mode 100644 index 0000000..752fa37 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/files_spec.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +require 'base64' + +RSpec.describe RubyLokaliseApi::Rest::Files do + let(:project_id) { '88628569645b945648b474.25982965' } + + specify '#files' do + stub( + uri: "projects/#{project_id}/files", + resp: { body: fixture('files/files') } + ) + + files = test_client.files project_id + + expect(files.collection.length).to eq(4) + expect_to_have_valid_resources(files) + expect(files.project_id).to eq(project_id) + expect(files.branch).to eq('master') + + file = files[0] + + expect(file.file_id).to eq(1_642_774) + expect(file.project_id).to eq(project_id) + expect(file.branch).to eq('master') + expect(file.filename).to eq('main-%LANG_ISO%.json') + expect(file.key_count).to eq(2) + end + + specify '#download_files' do + stub( + uri: "projects/#{project_id}/files/download", + req: { verb: :post }, + resp: { body: fixture('files/download_files') } + ) + + resp = test_client.download_files project_id, format: :json, original_filenames: false + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DownloadBundle) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.bundle_url).to include("files/export/#{project_id}") + end + + specify '#upload_file' do + data = Base64.strict_encode64('{"key1": "Ruby", "key2": "RSpec"}') + + params = { + data: data, + filename: 'rspec.json', + lang_iso: 'en' + } + + stub( + uri: "projects/#{project_id}/files/upload", + req: { body: params, verb: :post }, + resp: { body: fixture('files/upload_file') } + ) + + process = test_client.upload_file project_id, params + + expect(process).to be_an_instance_of(RubyLokaliseApi::Resources::QueuedProcess) + expect(process.project_id).to eq(project_id) + expect(process.status).to eq('queued') + + stub( + uri: "projects/#{project_id}/processes/#{process.process_id}", + resp: { body: fixture('files/upload_file_reloaded') } + ) + + reloaded_process = process.reload_data + + expect(reloaded_process.project_id).to eq(project_id) + expect(reloaded_process.status).to eq('finished') + end + + specify '#destroy_file' do + file_to_delete = 1_652_771 + doc_project_id = '92226400645e7e02104994.93406932' + + stub( + uri: "projects/#{doc_project_id}/files/#{file_to_delete}", + req: { verb: :delete }, + resp: { body: fixture('files/destroy_file') } + ) + + resp = test_client.destroy_file(doc_project_id, file_to_delete) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(doc_project_id) + expect(resp.file_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/jwts_spec.rb b/spec/lib/ruby_lokalise_api/rest/jwts_spec.rb new file mode 100644 index 0000000..f5143f9 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/jwts_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Jwts do + let(:project_id) { '88628569645b945648b474.25982965' } + + specify '#create_jwt' do + stub( + uri: "projects/#{project_id}/tokens", + req: { verb: :post }, + resp: { body: fixture('jwts/create_jwt') } + ) + + token = test_client.create_jwt project_id, service: :ota + + expect(token).to be_an_instance_of(RubyLokaliseApi::Resources::Jwt) + expect(token.jwt).to eq('123abc') + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/keys_spec.rb b/spec/lib/ruby_lokalise_api/rest/keys_spec.rb new file mode 100644 index 0000000..c07c67a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/keys_spec.rb @@ -0,0 +1,210 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Keys do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:key_id) { 319_782_376 } + let(:another_key_id) { 331_082_176 } + let(:update_key_id) { 331_018_374 } + + describe '#key' do + it 'requests a key' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}", + resp: { body: fixture('keys/key') } + ) + + key = test_client.key project_id, key_id + + expect(key).to be_an_instance_of(RubyLokaliseApi::Resources::Key) + expect(key.branch).to eq('master') + expect(key.project_id).to eq(project_id) + expect(key.key_id).to eq(key_id) + expect(key.created_at).to eq('2023-04-24 11:24:38 (Etc/UTC)') + expect(key.created_at_timestamp).to eq(1_682_335_478) + expect(key.key_name['ios']).to eq('login') + expect(key.filenames['web']).to eq('main-%LANG_ISO%.json') + expect(key.description).to eq('') + expect(key.platforms).to include('ios') + expect(key.tags).to eq([]) + expect(key.comments).to eq([]) + expect(key.screenshots).to eq([]) + expect(key.translations[0]['language_iso']).to eq('en') + expect(key.is_plural).to be false + expect(key.plural_name).to eq('') + expect(key.is_hidden).to be false + expect(key.is_archived).to be false + expect(key.context).to eq('') + expect(key.base_words).to eq(2) + expect(key.char_limit).to eq(0) + expect(key.custom_attributes).to eq('') + expect(key.modified_at).to eq('2023-05-10 13:10:57 (Etc/UTC)') + expect(key.modified_at_timestamp).to eq(1_683_724_257) + expect(key.translations_modified_at).to eq('2023-05-18 12:55:16 (Etc/UTC)') + expect(key.translations_modified_at_timestamp).to eq(1_684_414_516) + end + + it 'requests a key with a GET query param' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}?disable_references=1", + resp: { body: fixture('keys/key') } + ) + + key = test_client.key project_id, key_id, disable_references: 1 + + expect(key).to be_an_instance_of(RubyLokaliseApi::Resources::Key) + expect(key.project_id).to eq(project_id) + expect(key.key_id).to eq(key_id) + end + end + + specify '#keys' do + stub( + uri: "projects/#{project_id}/keys", + resp: { body: fixture('keys/keys') } + ) + + keys = test_client.keys project_id + expect(keys.collection.length).to eq(5) + expect(keys).to be_an_instance_of(RubyLokaliseApi::Collections::Keys) + expect_to_have_valid_resources(keys) + expect(keys.project_id).to eq(project_id) + expect(keys.branch).to eq('master') + + key = keys[0] + + expect(key.key_id).to eq(319_782_369) + expect(key.project_id).to eq(project_id) + end + + specify '#create_keys' do + keys_data = [ + { + key_name: 'ruby_k', + platforms: %w[web ios], + translations: [ + { + language_iso: 'en', + translation: 'Ruby key' + } + ] + }, + { + key_name: 'welcome', + platforms: %w[web], + filenames: { + web: 'secondary-%LANG_ISO%.json' + } + } + ] + + stub( + uri: "projects/#{project_id}/keys", + req: { body: { keys: keys_data }, verb: :post }, + resp: { body: fixture('keys/create_keys') } + ) + + keys = test_client.create_keys project_id, keys_data + + expect(keys).to be_an_instance_of(RubyLokaliseApi::Collections::Keys) + expect_to_have_valid_resources(keys) + + expect(keys.project_id).to eq(project_id) + expect(keys.branch).to eq('master') + expect(keys.errors[0]['message']).to eq('This key name is already taken') + + key = keys[0] + + expect(key.project_id).to eq(project_id) + expect(key.key_name['web']).to eq('ruby_k') + end + + specify '#update_keys' do + keys_data = { + use_automations: false, + keys: [{ + key_id: 1 + }, { + key_id: update_key_id, + filenames: { web: '%LANG_ISO%.yml' } + }] + } + + stub( + uri: "projects/#{project_id}/keys", + req: { body: keys_data, verb: :put }, + resp: { body: fixture('keys/update_keys') } + ) + + keys = test_client.update_keys project_id, keys_data + + error = keys.errors[0] + + expect(error['message']).to eq('Key not found in the project') + expect(error['key_id']).to eq(1) + + key = keys[0] + + expect(key.key_id).to eq(update_key_id) + expect(key.filenames['web']).to eq('%LANG_ISO%.yml') + end + + specify '#update_key' do + desc = 'Ruby updated' + + body = { description: desc } + + stub( + uri: "projects/#{project_id}/keys/#{update_key_id}", + req: { body: body, verb: :put }, + resp: { body: fixture('keys/update_key') } + ) + + key = test_client.update_key project_id, update_key_id, body + + expect(key.key_id).to eq(update_key_id) + expect(key.project_id).to eq(project_id) + expect(key.description).to eq(desc) + end + + specify '#destroy_key' do + stub( + uri: "projects/#{project_id}/keys/#{another_key_id}", + resp: { body: fixture('keys/key2') } + ) + + test_client.key project_id, another_key_id + + stub( + uri: "projects/#{project_id}/keys/#{another_key_id}", + req: { verb: :delete }, + resp: { body: fixture('keys/destroy_key') } + ) + + resp = test_client.destroy_key(project_id, another_key_id) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.key_removed).to be true + expect(resp.keys_locked).to eq(0) + end + + specify '#destroy_keys' do + key_ids = %w[331130927 331130924 331130922] + + stub( + uri: "projects/#{project_id}/keys", + req: { body: { keys: key_ids }, verb: :delete }, + resp: { body: fixture('keys/destroy_keys') } + ) + + resp = test_client.destroy_keys project_id, key_ids + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.keys_removed).to be true + expect(resp.keys_locked).to eq(0) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/languages_spec.rb b/spec/lib/ruby_lokalise_api/rest/languages_spec.rb new file mode 100644 index 0000000..94b1968 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/languages_spec.rb @@ -0,0 +1,144 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Languages do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:language_id) { 673 } + + let(:pagination_headers) do + { + 'x-pagination-total-count': '687', + 'x-pagination-page-count': '229', + 'x-pagination-limit': '3', + 'x-pagination-page': '1' + } + end + + specify '#system_languages' do + pagination_params = { page: 1, limit: 3 } + + stub( + uri: 'system/languages', + req: { query: pagination_params }, + resp: { + body: fixture('languages/system_languages_page1'), + headers: pagination_headers + } + ) + + sys_langs = test_client.system_languages pagination_params + + expect(sys_langs.current_page).to eq(1) + expect(sys_langs.prev_page?).to be false + expect_to_have_valid_resources(sys_langs) + + lang = sys_langs[0] + + expect(lang.lang_name).to eq('Abkhaz') + expect(lang.lang_iso).to eq('ab') + + stub( + uri: 'system/languages', + req: { query: pagination_params.merge(page: 2) }, + resp: { + body: fixture('languages/system_languages_page2'), + headers: pagination_headers.merge({ 'x-pagination-page': '2' }) + } + ) + + sys_langs_next = sys_langs.next_page + + expect(sys_langs_next.current_page).to eq(2) + expect_to_have_valid_resources(sys_langs_next) + expect(sys_langs_next[0].lang_name).to eq('Afrikaans (Namibia)') + end + + specify '#project_languages' do + stub( + uri: "projects/#{project_id}/languages", + resp: { body: fixture('languages/project_languages') } + ) + + project_langs = test_client.project_languages project_id + + expect_to_have_valid_resources(project_langs) + + expect(project_langs.project_id).to eq(project_id) + expect(project_langs.branch).to eq('master') + + project_lang = project_langs[0] + + expect(project_lang.lang_id).to eq(10_001) + expect(project_lang.project_id).to eq(project_id) + end + + specify '#project_language' do + stub( + uri: "projects/#{project_id}/languages/#{language_id}", + resp: { body: fixture('languages/project_language') } + ) + + language = test_client.project_language project_id, language_id + + expect(language.project_id).to eq(project_id) + expect(language.branch).to eq('master') + expect(language.lang_id).to eq(language_id) + expect(language.lang_iso).to eq('fr') + expect(language.lang_name).to eq('French') + expect(language.is_rtl).to be false + expect(language.plural_forms).to include('other') + end + + specify '#create_project_languages' do + body = [{ + lang_iso: 'de' + }, { + lang_iso: 'nl' + }] + + stub( + uri: "projects/#{project_id}/languages", + req: { body: { languages: body }, verb: :post }, + resp: { body: fixture('languages/create_project_languages') } + ) + + languages = test_client.create_project_languages project_id, body + + expect(languages).to be_an_instance_of(RubyLokaliseApi::Collections::ProjectLanguages) + expect_to_have_valid_resources(languages) + expect(languages.project_id).to eq(project_id) + expect(languages[0].lang_iso).to eq('de') + end + + specify '#update_project_language' do + lang_data = { + lang_name: 'French (updated)' + } + + stub( + uri: "projects/#{project_id}/languages/#{language_id}", + req: { body: lang_data, verb: :put }, + resp: { body: fixture('languages/update_project_language') } + ) + + lang = test_client.update_project_language project_id, language_id, lang_data + + expect(lang).to be_an_instance_of(RubyLokaliseApi::Resources::ProjectLanguage) + expect(lang.lang_name).to eq(lang_data[:lang_name]) + expect(lang.lang_id).to eq(language_id) + end + + specify '#destroy_project_language' do + stub( + uri: "projects/#{project_id}/languages/#{language_id}", + req: { verb: :delete }, + resp: { body: fixture('languages/destroy_language') } + ) + + resp = test_client.destroy_project_language project_id, language_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.language_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/orders_spec.rb b/spec/lib/ruby_lokalise_api/rest/orders_spec.rb new file mode 100644 index 0000000..edf9742 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/orders_spec.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Orders do + let(:team_id) { 176_692 } + let(:order_id) { '201903198B2' } + let(:project_id) { '803826145ba90b42d5d860.46800099' } + + specify '#orders' do + stub( + uri: "teams/#{team_id}/orders", + resp: { body: fixture('orders/orders') } + ) + + orders = test_client.orders team_id + + expect(orders).to be_an_instance_of(RubyLokaliseApi::Collections::Orders) + expect_to_have_valid_resources(orders) + + order = orders[0] + + expect(order.order_id).to eq('201903198B2') + end + + specify '#order' do + stub( + uri: "teams/#{team_id}/orders/#{order_id}", + resp: { body: fixture('orders/order') } + ) + + order = test_client.order team_id, order_id + + expect(order.team_id).to eq(team_id) + expect(order.order_id).to eq(order_id) + expect(order.project_id).to eq(project_id) + expect(order.branch).to be_nil + expect(order.card_id).to eq(1774) + expect(order.status).to eq('completed') + expect(order.created_at).to eq('2019-03-19 18:18:21 (Etc/UTC)') + expect(order.created_at_timestamp).to eq(1_553_019_501) + expect(order.created_by).to eq(20_181) + expect(order.created_by_email).to eq('bodrovis@protonmail.com') + expect(order.source_language_iso).to eq('en') + expect(order.target_language_isos).to include('ru') + expect(order.keys).to include(15_519_786) + expect(order.source_words['ru']).to eq(1) + expect(order.provider_slug).to eq('gengo') + expect(order.translation_style).to eq('friendly') + expect(order.translation_tier).to eq(1) + expect(order.translation_tier_name).to eq('Professional translator') + expect(order.briefing).to eq('Some briefing') + expect(order.total).to eq(0.07) + expect(order.payment_method).to be_nil + expect(order.dry_run).to be_nil + end + + specify '#create_order' do + order_data = { + project_id: '963054665b7c313dd9b323.35886655', + card_id: 1774, + briefing: 'demo', + source_language_iso: 'en', + target_language_isos: %w[ru], + keys: [332_517_634, 62_341_144], + provider_slug: 'gengo', + translation_tier: 1, + dry_run: true, + translation_style: 'friendly' + } + + stub( + uri: "teams/#{team_id}/orders", + req: { body: order_data, verb: :post }, + resp: { body: fixture('orders/create_order') } + ) + + order = test_client.create_order team_id, order_data + + expect(order.dry_run).to be true + expect(order.team_id).to eq(team_id) + expect(order.provider_slug).to eq('gengo') + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/payment_cards_spec.rb b/spec/lib/ruby_lokalise_api/rest/payment_cards_spec.rb new file mode 100644 index 0000000..6193c2e --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/payment_cards_spec.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::PaymentCards do + let(:user_id) { 20_181 } + let(:card_id) { 1774 } + + specify '#payment_cards' do + stub( + uri: 'payment_cards', + resp: { body: fixture('payment_cards/payment_cards') } + ) + + cards = test_client.payment_cards + + expect(cards.collection.length).to eq(4) + expect(cards).to be_an_instance_of(RubyLokaliseApi::Collections::PaymentCards) + expect_to_have_valid_resources(cards) + expect(cards.user_id).to eq(user_id) + + card = cards[0] + + expect(card.card_id).to eq(card_id) + expect(card.user_id).to eq(user_id) + end + + specify '#payment_card' do + stub( + uri: "payment_cards/#{card_id}", + resp: { body: fixture('payment_cards/payment_card') } + ) + + card = test_client.payment_card card_id + + expect(card.card_id).to eq(card_id) + expect(card.user_id).to eq(user_id) + expect(card.last4).to eq('0358') + expect(card.brand).to eq('Visa') + expect(card.created_at).to eq('2019-03-19 17:49:07 (Etc/UTC)') + expect(card.created_at_timestamp).to eq(1_553_017_747) + end + + specify '#create_payment_card' do + card_data = { + number: '4242424242424242', + cvc: '123', + exp_month: '12', + exp_year: '2020' + } + + stub( + uri: 'payment_cards', + req: { body: card_data, verb: :post }, + resp: { body: fixture('payment_cards/create_payment_card') } + ) + + card = test_client.create_payment_card card_data + + expect(card.last4).to eq('4242') + end + + specify '#destroy_payment_card' do + stub( + uri: "payment_cards/#{card_id}", + req: { verb: :delete }, + resp: { body: fixture('payment_cards/destroy_payment_card') } + ) + + resp = test_client.destroy_payment_card(card_id) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + + expect(resp.card_id).to eq(card_id) + expect(resp.card_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/projects_spec.rb b/spec/lib/ruby_lokalise_api/rest/projects_spec.rb new file mode 100644 index 0000000..54f37f0 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/projects_spec.rb @@ -0,0 +1,134 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Projects do + let(:project_id) { '20603843642073fe124fb8.14291681' } + let(:new_project_id) { '526928826442cf2f60f643.34369791' } + + specify '#project' do + stub( + uri: "projects/#{project_id}", + resp: { body: fixture('projects/project') } + ) + + project = test_client.project project_id + + expect(project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(project.project_id).to eq('20603843642073fe124fb8.14291681') + expect(project.project_type).to eq('localization_files') + expect(project.name).to eq('OnBoarding-2023') + expect(project.description).to eq('') + expect(project.created_at).to eq('2023-03-26 16:34:06 (Etc/UTC)') + expect(project.created_at_timestamp).to eq(1_679_848_446) + expect(project.created_by).to eq(20_181) + expect(project.created_by_email).to eq('bodrovis@protonmail.com') + expect(project.team_id).to eq(176_692) + expect(project.base_language_id).to eq(640) + expect(project.base_language_iso).to eq('en') + expect(project.project_type).to eq('localization_files') + expect(project.settings['per_platform_key_names']).to be false + expect(project.statistics['progress_total']).to eq(50) + end + + specify '#projects' do + req_params = { page: 1, limit: 2, include_statistics: 1 } + + stub( + uri: 'projects', + req: { query: req_params }, + resp: { + body: fixture('projects/projects'), + headers: { + 'x-pagination-total-count': '55', + 'x-pagination-page-count': '28', + 'x-pagination-limit': '2', + 'x-pagination-page': '1' + } + } + ) + + projects = test_client.projects req_params + expect_to_have_valid_resources(projects) + + expect(projects.collection.length).to eq(2) + expect(projects[0].project_id).to eq('44749534644685cf3410d0.03071739') + end + + specify '#create_project' do + new_name = 'RubyNew' + params = { name: new_name } + + stub( + uri: 'projects', + req: { body: params, verb: :post }, + resp: { body: fixture('projects/create_project') } + ) + + stub( + uri: "projects/#{new_project_id}", + resp: { body: fixture('projects/create_project') } + ) + + new_project = test_client.create_project(params) + + expect(new_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(new_project.name).to eq(new_name) + + reloaded_project = new_project.reload_data + + expect(reloaded_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + end + + specify '#update_project' do + params = { name: 'OnBoarding-2023', description: 'Updated description' } + + stub( + uri: "projects/#{project_id}", + req: { body: params, verb: :put }, + resp: { body: fixture('projects/update_project') } + ) + + stub( + uri: "projects/#{project_id}", + resp: { body: fixture('projects/project') } + ) + + updated_project = test_client.update_project project_id, params + + expect(updated_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(updated_project.description).to eq(params[:description]) + + reloaded_project = updated_project.reload_data + + expect(reloaded_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + end + + specify '#destroy_project' do + stub( + uri: "projects/#{new_project_id}", + req: { verb: :delete }, + resp: { body: fixture('projects/destroy_project') } + ) + + resp = test_client.destroy_project(new_project_id) + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(new_project_id) + expect(resp.project_deleted).to be true + end + + specify '#empty_project' do + project_to_empty = '7078965360db431d026791.96621226' + + stub( + uri: "projects/#{project_to_empty}/empty", + req: { verb: :put }, + resp: { body: fixture('projects/empty_project') } + ) + + resp = test_client.empty_project project_to_empty + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::EmptiedResource) + expect(resp.project_id).to eq(project_to_empty) + expect(resp.keys_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/queued_processes_spec.rb b/spec/lib/ruby_lokalise_api/rest/queued_processes_spec.rb new file mode 100644 index 0000000..cd3e1a0 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/queued_processes_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::QueuedProcesses do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:process_id) { '73ad976cedf00cd8a1b1b978ae3ffaade1323505' } + + specify '#queued_process' do + stub( + uri: "projects/#{project_id}/processes/#{process_id}", + resp: { body: fixture('processes/process') } + ) + + process = test_client.queued_process project_id, process_id + + expect(process.project_id).to eq(project_id) + expect(process.branch).to eq('master') + expect(process.process_id).to eq(process_id) + expect(process.type).to eq('file-import') + expect(process.status).to eq('finished') + expect(process.message).to eq('') + expect(process.created_by).to eq(20_181) + expect(process.created_by_email).to eq('bodrovis@protonmail.com') + expect(process.created_at).to eq('2023-05-12 10:59:43 (Etc/UTC)') + expect(process.created_at_timestamp).to eq(1_683_889_183) + expect(process.details['files'][0]['name_original']).to eq('pasted.json') + end + + specify '#queued_processes' do + stub( + uri: "projects/#{project_id}/processes", + resp: { body: fixture('processes/processes') } + ) + + processes = test_client.queued_processes project_id + + expect(processes.collection.length).to eq(2) + expect_to_have_valid_resources(processes) + expect(processes.project_id).to eq(project_id) + expect(processes.branch).to eq('master') + + process = processes[0] + + expect(process.process_id).to eq(process_id) + expect(process.project_id).to eq(project_id) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/screenshots_spec.rb b/spec/lib/ruby_lokalise_api/rest/screenshots_spec.rb new file mode 100644 index 0000000..4fb7d55 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/screenshots_spec.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Screenshots do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:screenshot_id) { 2_858_588 } + + specify '#screenshots' do + stub( + uri: "projects/#{project_id}/screenshots", + resp: { body: fixture('screenshots/screenshots') } + ) + + screenshots = test_client.screenshots project_id + + expect(screenshots.collection.length).to eq(3) + expect_to_have_valid_resources(screenshots) + expect(screenshots.project_id).to eq(project_id) + expect(screenshots.branch).to eq('master') + + screenshot = screenshots[0] + + expect(screenshot.screenshot_id).to eq(2_858_588) + end + + specify '#screenshot' do + stub( + uri: "projects/#{project_id}/screenshots/#{screenshot_id}", + resp: { body: fixture('screenshots/screenshot') } + ) + + screenshot = test_client.screenshot project_id, screenshot_id + + expect(screenshot.project_id).to eq(project_id) + expect(screenshot.branch).to eq('master') + expect(screenshot.screenshot_id).to eq(screenshot_id) + expect(screenshot.key_ids).to include(319_782_369) + expect(screenshot.keys[0]['key_id']).to eq(319_782_369) + expect(screenshot.url).to include('lokalise-live-lok-app-main-assets') + expect(screenshot.title).to eq('Registration') + expect(screenshot.description).to eq('') + expect(screenshot.screenshot_tags).to eq([]) + expect(screenshot.width).to eq(572) + expect(screenshot.height).to eq(438) + expect(screenshot.created_at).to eq('2023-04-18 16:52:10 (Etc/UTC)') + expect(screenshot.created_at_timestamp).to eq(1_681_836_730) + end + + specify '#create_screenshots' do + screenshots_data = screenshot_from_file do |file| + [ + data: file.read, + title: 'Ruby', + description: 'SDK' + ] + end + + stub( + uri: "projects/#{project_id}/screenshots", + req: { body: { screenshots: screenshots_data }, verb: :post }, + resp: { body: fixture('screenshots/create_screenshots') } + ) + + screenshots = test_client.create_screenshots project_id, screenshots_data + + expect(screenshots).to be_an_instance_of(RubyLokaliseApi::Collections::Screenshots) + expect_to_have_valid_resources(screenshots) + + expect(screenshots.project_id).to eq(project_id) + expect(screenshots.branch).to eq('master') + expect(screenshots.errors).to eq([]) + expect(screenshots[0].screenshot_id).to eq(3_195_031) + expect(screenshots[0].project_id).to eq(project_id) + end + + specify '#update_screenshot' do + screenshot_data = { + title: 'Ruby updated', + tags: %w[one two] + } + + stub( + uri: "projects/#{project_id}/screenshots/#{screenshot_id}", + req: { body: screenshot_data, verb: :put }, + resp: { body: fixture('screenshots/update_screenshot') } + ) + + screenshot = test_client.update_screenshot project_id, screenshot_id, screenshot_data + + expect(screenshot).to be_an_instance_of(RubyLokaliseApi::Resources::Screenshot) + expect(screenshot.title).to eq(screenshot_data[:title]) + expect(screenshot.screenshot_tags).to include(*screenshot_data[:tags]) + expect(screenshot.screenshot_id).to eq(screenshot_id) + end + + specify '#destroy_screenshot' do + delete_screen_id = 3_195_031 + stub( + uri: "projects/#{project_id}/screenshots/#{delete_screen_id}", + req: { verb: :delete }, + resp: { body: fixture('screenshots/destroy_screenshot') } + ) + + resp = test_client.destroy_screenshot project_id, delete_screen_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.screenshot_deleted).to be true + end +end + +def screenshot_from_file + file = File.open File.expand_path('spec/fixtures/screenshots/screenshot_base64.txt') + begin + yield file + rescue StandardError => e + puts e + ensure + file.close + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/segments_spec.rb b/spec/lib/ruby_lokalise_api/rest/segments_spec.rb new file mode 100644 index 0000000..c8c3189 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/segments_spec.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Segments do + let(:project_id) { '7451498664b95d6111c812.34468173' } + let(:key_id) { 353_507_573 } + let(:lang_iso) { 'en' } + let(:segment_number) { 1 } + + specify '#segments' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/segments/#{lang_iso}", + resp: { body: fixture('segments/segments') } + ) + + segments = test_client.segments project_id, key_id, lang_iso + + expect(segments.collection.length).to eq(5) + expect_to_have_valid_resources(segments) + expect(segments.project_id).to eq(project_id) + expect(segments.key_id).to eq(key_id) + expect(segments.language_iso).to eq(lang_iso) + + segment = segments[0] + + expect(segment.segment_number).to eq(segment_number) + end + + specify '#segment' do + stub( + uri: "projects/#{project_id}/keys/#{key_id}/segments/#{lang_iso}/#{segment_number}?disable_references=1", + resp: { body: fixture('segments/segment') } + ) + + segment = test_client.segment project_id, key_id, lang_iso, segment_number, disable_references: 1 + + expect(segment.project_id).to eq(project_id) + expect(segment.key_id).to eq(key_id) + expect(segment.language_iso).to eq(lang_iso) + expect(segment.segment_number).to eq(segment_number) + expect(segment.value).to eq('This is a text.') + expect(segment.modified_by).to eq(20_181) + expect(segment.modified_by_email).to eq('bodrovis@protonmail.com') + expect(segment.modified_at).to eq('2023-07-20 16:14:48 (Etc/UTC)') + expect(segment.modified_at_timestamp).to eq(1_689_869_688) + expect(segment.is_reviewed).to be false + expect(segment.reviewed_by).to eq(0) + expect(segment.is_fuzzy).to be false + expect(segment.words).to eq(4) + expect(segment.custom_translation_statuses).to eq([]) + end + + specify '#update_segment' do + segment_data = { + value: 'Updated.', + is_fuzzy: false + } + + stub( + uri: "projects/#{project_id}/keys/#{key_id}/segments/#{lang_iso}/#{segment_number}", + req: { body: segment_data, verb: :put }, + resp: { body: fixture('segments/update_segment') } + ) + + segment = test_client.update_segment project_id, key_id, lang_iso, segment_number, segment_data + + expect(segment.project_id).to eq(project_id) + expect(segment.key_id).to eq(key_id) + expect(segment.value).to eq(segment_data[:value]) + expect(segment.is_fuzzy).to eq(segment_data[:is_fuzzy]) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/snapshots_spec.rb b/spec/lib/ruby_lokalise_api/rest/snapshots_spec.rb new file mode 100644 index 0000000..6b51bcd --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/snapshots_spec.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Snapshots do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:snapshot_id) { 2_296_294 } + + specify '#snapshots' do + stub( + uri: "projects/#{project_id}/snapshots", + resp: { body: fixture('snapshots/snapshots') } + ) + + snapshots = test_client.snapshots project_id + + expect(snapshots.collection.length).to eq(3) + expect_to_have_valid_resources(snapshots) + expect(snapshots.project_id).to eq(project_id) + expect(snapshots.branch).to eq('master') + + snapshot = snapshots[0] + + expect(snapshot.snapshot_id).to eq(2_130_183) + end + + specify '#create_snapshot' do + snapshot_data = { + title: 'Ruby SDK' + } + + stub( + uri: "projects/#{project_id}/snapshots", + req: { body: snapshot_data, verb: :post }, + resp: { body: fixture('snapshots/create_snapshot') } + ) + + snapshot = test_client.create_snapshot project_id, snapshot_data + + expect(snapshot).to be_an_instance_of(RubyLokaliseApi::Resources::Snapshot) + expect(snapshot.title).to eq(snapshot_data[:title]) + expect(snapshot.branch).to eq('master') + end + + specify '#restore_snapshot' do + stub( + uri: "projects/#{project_id}/snapshots/#{snapshot_id}", + req: { verb: :post }, + resp: { body: fixture('snapshots/restore_snapshot') } + ) + + restored_project = test_client.restore_snapshot project_id, snapshot_id + + expect(restored_project).to be_an_instance_of(RubyLokaliseApi::Resources::Project) + expect(restored_project.name).to eq('OnBoarding-2023 copy') + expect(restored_project.project_id).not_to eq(project_id) + + endpoint = restored_project.instance_variable_get(:@self_endpoint) + expect(endpoint).to be_an_instance_of(RubyLokaliseApi::Endpoints::ProjectsEndpoint) + expect(endpoint.uri).to include('projects', project_id) + expect(endpoint.uri).not_to include('snapshots') + end + + specify '#destroy_snapshot' do + stub( + uri: "projects/#{project_id}/snapshots/#{snapshot_id}", + req: { verb: :delete }, + resp: { body: fixture('snapshots/destroy_snapshot') } + ) + + resp = test_client.destroy_snapshot project_id, snapshot_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.snapshot_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/tasks_spec.rb b/spec/lib/ruby_lokalise_api/rest/tasks_spec.rb new file mode 100644 index 0000000..e39b2c6 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/tasks_spec.rb @@ -0,0 +1,125 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Tasks do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:task_id) { 1_721_560 } + let(:another_task_id) { 1_721_633 } + + specify '#tasks' do + stub( + uri: "projects/#{project_id}/tasks", + resp: { body: fixture('tasks/tasks') } + ) + + tasks = test_client.tasks project_id + + expect(tasks.collection.length).to eq(3) + expect_to_have_valid_resources(tasks) + expect(tasks.project_id).to eq(project_id) + expect(tasks.branch).to eq('master') + + task = tasks[0] + + expect(task.task_id).to eq(task_id) + end + + specify '#task' do + stub( + uri: "projects/#{project_id}/tasks/#{task_id}", + resp: { body: fixture('tasks/task') } + ) + + task = test_client.task project_id, task_id + + expect(task.project_id).to eq(project_id) + expect(task.branch).to eq('master') + expect(task.task_id).to eq(task_id) + expect(task.title).to eq('Demo2') + expect(task.can_be_parent).to be true + expect(task.parent_task_id).to be_nil + expect(task.closing_tags).to eq([]) + expect(task.description).to eq('') + expect(task.status).to eq('created') + expect(task.progress).to eq(0) + expect(task.due_date).to be_nil + expect(task.due_date_timestamp).to be_nil + expect(task.keys_count).to eq(7) + expect(task.words_count).to eq(19) + expect(task.created_at).to eq('2023-07-14 11:59:04 (Etc/UTC)') + expect(task.created_at_timestamp).to eq(1_689_335_944) + expect(task.created_by).to eq(20_181) + expect(task.created_by_email).to eq('bodrovis@protonmail.com') + expect(task.source_language_iso).to eq('en') + expect(task.languages[0]['language_iso']).to eq('de') + expect(task.auto_close_items).to be true + expect(task.auto_close_languages).to be true + expect(task.auto_close_task).to be true + expect(task.completed_at).to be_nil + expect(task.completed_at_timestamp).to be_nil + expect(task.completed_by).to be_nil + expect(task.completed_by_email).to be_nil + expect(task.do_lock_translations).to be true + expect(task.custom_translation_status_ids).to eq([]) + end + + specify '#create_task' do + task_data = { + title: 'Ruby SDK', + keys: %w[331018374 324729217], + languages: [ + { + language_iso: 'de', + users: %w[20181] + } + ], + source_language_iso: 'en', + task_type: 'translation' + } + + stub( + uri: "projects/#{project_id}/tasks", + req: { body: task_data, verb: :post }, + resp: { body: fixture('tasks/create_task') } + ) + + task = test_client.create_task project_id, task_data + + expect(task.project_id).to eq(project_id) + expect(task.title).to eq(task_data[:title]) + expect(task.status).to eq('created') + end + + specify '#update_task' do + task_data = { + title: 'Ruby updated', + description: 'updated via sdk' + } + + stub( + uri: "projects/#{project_id}/tasks/#{another_task_id}", + req: { body: task_data, verb: :put }, + resp: { body: fixture('tasks/update_task') } + ) + + task = test_client.update_task project_id, another_task_id, task_data + + expect(task).to be_an_instance_of(RubyLokaliseApi::Resources::Task) + expect(task.title).to eq(task_data[:title]) + expect(task.description).to eq(task_data[:description]) + end + + specify '#destroy_task' do + stub( + uri: "projects/#{project_id}/tasks/#{another_task_id}", + req: { verb: :delete }, + resp: { body: fixture('tasks/destroy_task') } + ) + + resp = test_client.destroy_task project_id, another_task_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.branch).to eq('master') + expect(resp.task_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/team_user_billing_details_spec.rb b/spec/lib/ruby_lokalise_api/rest/team_user_billing_details_spec.rb new file mode 100644 index 0000000..935ac73 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/team_user_billing_details_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::TeamUserBillingDetails do + let(:team_id) { 176_692 } + + specify '#team_user_billing_details' do + stub( + uri: "teams/#{team_id}/billing_details", + resp: { body: fixture('team_user_billing_details/team_user_billing_details') } + ) + + details = test_client.team_user_billing_details team_id + + expect(details).to be_an_instance_of(RubyLokaliseApi::Resources::TeamUserBillingDetails) + expect(details.team_id).to eq(team_id) + expect(details.company).to eq('') + expect(details.address1).to eq('Sample line 1') + expect(details.address2).to eq('') + expect(details.city).to eq('Riga') + expect(details.zip).to eq('LV-6543') + expect(details.phone).to eq('+371123456') + expect(details.vatnumber).to eq('') + expect(details.country_code).to eq('LV') + expect(details.billing_email).to eq('hello@example.com') + expect(details.state_code).to eq('') + end + + specify '#create_team_user_billing_details' do + another_team_id = 387_836 + + details_data = { + billing_email: 'hello@lokalise.com', + country_code: 'LV', + zip: 'LV-1234' + } + + stub( + uri: "teams/#{another_team_id}/billing_details", + req: { body: details_data, verb: :post }, + resp: { body: fixture('team_user_billing_details/create_billing_details') } + ) + + details = test_client.create_team_user_billing_details another_team_id, details_data + + expect(details.zip).to eq(details_data[:zip]) + expect(details.team_id).to eq(another_team_id) + end + + specify '#update_team_user_billing_details' do + details_data = { + billing_email: 'hi2@lokalise.com', + country_code: 'LV', + zip: 'LV-1234' + } + + stub( + uri: "teams/#{team_id}/billing_details", + req: { body: details_data, verb: :put }, + resp: { body: fixture('team_user_billing_details/update_billing_details') } + ) + + details = test_client.update_team_user_billing_details team_id, details_data + + expect(details.billing_email).to eq(details_data[:billing_email]) + expect(details.team_id).to eq(team_id) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/team_user_groups_spec.rb b/spec/lib/ruby_lokalise_api/rest/team_user_groups_spec.rb new file mode 100644 index 0000000..358209b --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/team_user_groups_spec.rb @@ -0,0 +1,167 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::TeamUserGroups do + let(:team_id) { 176_692 } + let(:group_id) { 2639 } + + specify '#team_user_groups' do + stub( + uri: "teams/#{team_id}/groups", + resp: { body: fixture('team_user_groups/team_user_groups') } + ) + + team_user_groups = test_client.team_user_groups team_id + + expect(team_user_groups).to be_an_instance_of(RubyLokaliseApi::Collections::TeamUserGroups) + expect_to_have_valid_resources(team_user_groups) + + group = team_user_groups[0] + + expect(group.group_id).to eq(group_id) + end + + specify '#team_user_group' do + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + resp: { body: fixture('team_user_groups/team_user_group') } + ) + + group = test_client.team_user_group team_id, group_id + + expect(group.group_id).to eq(group_id) + expect(group.team_id).to eq(team_id) + expect(group.name).to eq('Demo') + expect(group.permissions['is_admin']).to be false + expect(group.created_at).to eq('2020-07-23 11:21:04 (Etc/UTC)') + expect(group.created_at_timestamp).to eq(1_595_503_264) + expect(group.projects).to eq([]) + expect(group.members).to include(49_436) + end + + specify '#create_team_user_group' do + group_data = { + name: 'SDK', + is_reviewer: true, + is_admin: false, + languages: { + reference: [], + contributable: [640] + } + } + + stub( + uri: "teams/#{team_id}/groups", + req: { body: group_data, verb: :post }, + resp: { body: fixture('team_user_groups/create_team_user_group') } + ) + + group = test_client.create_team_user_group team_id, group_data + + expect(group.team_id).to eq(team_id) + expect(group.name).to eq(group_data[:name]) + expect(group.permissions['is_admin']).to eq(group_data[:is_admin]) + end + + specify '#update_team_user_group' do + group_data = { + name: 'Updated SDK', + is_reviewer: true, + is_admin: false, + languages: { + reference: [], + contributable: [640] + } + } + + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + req: { body: group_data, verb: :put }, + resp: { body: fixture('team_user_groups/update_team_user_group') } + ) + + group = test_client.update_team_user_group team_id, group_id, group_data + + expect(group.team_id).to eq(team_id) + expect(group.group_id).to eq(group_id) + expect(group.name).to eq(group_data[:name]) + expect(group.permissions['is_admin']).to eq(group_data[:is_admin]) + end + + specify '#add_projects_to_group' do + project_ids = %w[963054665b7c313dd9b323.35886655 2273827860c1e2473eb195.11207948] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/projects/add", + req: { body: { projects: project_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/add_projects_to_group') } + ) + + group = test_client.add_projects_to_group team_id, group_id, project_ids + + expect(group.team_id).to eq(team_id) + expect(group.group_id).to eq(group_id) + expect(group.projects).to include(*project_ids) + end + + specify '#remove_projects_from_group' do + project_ids = %w[963054665b7c313dd9b323.35886655] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/projects/remove", + req: { body: { projects: project_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/remove_projects_from_group') } + ) + + group = test_client.remove_projects_from_group team_id, group_id, project_ids + + expect(group.team_id).to eq(team_id) + expect(group.group_id).to eq(group_id) + expect(group.projects).not_to include(*project_ids) + end + + specify '#add_members_to_group' do + user_ids = [140_889, 132_650] + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/members/add", + req: { body: { users: user_ids }, verb: :put }, + resp: { body: fixture('team_user_groups/add_members_to_group') } + ) + + group = test_client.add_members_to_group team_id, group_id, user_ids + + expect(group.team_id).to eq(team_id) + expect(group.group_id).to eq(group_id) + expect(group.members).to include(*user_ids) + end + + specify '#remove_members_from_group' do + user_ids = 140_889 + + stub( + uri: "teams/#{team_id}/groups/#{group_id}/members/remove", + req: { body: { users: [user_ids] }, verb: :put }, + resp: { body: fixture('team_user_groups/remove_members_from_group') } + ) + + group = test_client.remove_members_from_group team_id, group_id, user_ids + + expect(group.team_id).to eq(team_id) + expect(group.group_id).to eq(group_id) + expect(group.members).not_to include(user_ids) + end + + specify '#destroy_team_user_group' do + stub( + uri: "teams/#{team_id}/groups/#{group_id}", + req: { verb: :delete }, + resp: { body: fixture('team_user_groups/destroy_team_user_group') } + ) + + resp = test_client.destroy_team_user_group team_id, group_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.team_id).to eq(team_id) + expect(resp.group_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/team_users_spec.rb b/spec/lib/ruby_lokalise_api/rest/team_users_spec.rb new file mode 100644 index 0000000..5b8c61a --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/team_users_spec.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::TeamUsers do + let(:team_id) { 176_692 } + let(:user_id) { 147_798 } + + specify '#team_users' do + stub( + uri: "teams/#{team_id}/users", + resp: { body: fixture('team_users/team_users') } + ) + + team_users = test_client.team_users team_id + + expect(team_users).to be_an_instance_of(RubyLokaliseApi::Collections::TeamUsers) + expect_to_have_valid_resources(team_users) + + user = team_users[0] + + expect(user.user_id).to eq(user_id) + end + + specify '#team_user' do + stub( + uri: "teams/#{team_id}/users/#{user_id}", + resp: { body: fixture('team_users/team_user') } + ) + + user = test_client.team_user team_id, user_id + + expect(user.team_id).to eq(team_id) + expect(user.user_id).to eq(user_id) + expect(user.email).to eq('ilya+demo2@lokalise.com') + expect(user.fullname).to eq('Ilya Demo') + expect(user.created_at).to eq('2022-01-19 16:16:03 (Etc/UTC)') + expect(user.created_at_timestamp).to eq(1_642_608_963) + expect(user.role).to eq('member') + end + + specify '#update_team_user' do + user_data = { + role: 'admin' + } + + stub( + uri: "teams/#{team_id}/users/#{user_id}", + req: { body: user_data, verb: :put }, + resp: { body: fixture('team_users/update_team_user') } + ) + + user = test_client.update_team_user team_id, user_id, user_data + + expect(user).to be_an_instance_of(RubyLokaliseApi::Resources::TeamUser) + expect(user.user_id).to eq(user_id) + expect(user.role).to eq(user_data[:role]) + end + + specify '#destroy_team_user' do + stub( + uri: "teams/#{team_id}/users/#{user_id}", + req: { verb: :delete }, + resp: { body: fixture('team_users/destroy_team_user') } + ) + + resp = test_client.destroy_team_user team_id, user_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.team_id).to eq(team_id) + expect(resp.team_user_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/teams_spec.rb b/spec/lib/ruby_lokalise_api/rest/teams_spec.rb new file mode 100644 index 0000000..06826b0 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/teams_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Teams do + specify '#teams' do + stub( + uri: 'teams', + resp: { body: fixture('teams/teams') } + ) + + teams = test_client.teams + + expect(teams).to be_an_instance_of(RubyLokaliseApi::Collections::Teams) + expect_to_have_valid_resources(teams) + + team = teams[0] + + expect(team.team_id).to eq(273_879) + expect(team.name).to eq('Ruby Team') + expect(team.created_at).to eq('2021-12-15 17:37:23 (Etc/UTC)') + expect(team.created_at_timestamp).to eq(1_639_589_843) + expect(team.plan).to eq('Trial') + expect(team.quota_usage['users']).to eq(1) + expect(team.quota_allowed['users']).to eq(999_999_999) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/translation_providers_spec.rb b/spec/lib/ruby_lokalise_api/rest/translation_providers_spec.rb new file mode 100644 index 0000000..9acd788 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/translation_providers_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::TranslationProviders do + let(:team_id) { 176_692 } + let(:provider_id) { 1 } + + specify '#translation_providers' do + stub( + uri: "teams/#{team_id}/translation_providers", + resp: { body: fixture('translation_providers/translation_providers') } + ) + + providers = test_client.translation_providers team_id + + expect(providers.collection.length).to eq(4) + expect_to_have_valid_resources(providers) + expect(providers[0].provider_id).to eq(1) + end + + specify '#translation_provider' do + stub( + uri: "teams/#{team_id}/translation_providers/#{provider_id}", + resp: { body: fixture('translation_providers/translation_provider') } + ) + + provider = test_client.translation_provider team_id, provider_id + + expect(provider.team_id).to eq(team_id) + expect(provider.provider_id).to eq(provider_id) + expect(provider.name).to eq('Gengo') + expect(provider.slug).to eq('gengo') + expect(provider.price_pair_min).to eq('0.00') + expect(provider.website_url).to eq('https://gengo.com') + expect(provider.description).to include('At Gengo,') + expect(provider.tiers[0]['tier_id']).to eq(1) + expect(provider.pairs[0]['price_per_word']).to eq(0.069) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/translations_spec.rb b/spec/lib/ruby_lokalise_api/rest/translations_spec.rb new file mode 100644 index 0000000..8d1e7b7 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/translations_spec.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Translations do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:translation_id) { 2_574_122_388 } + + specify '#translations' do + stub( + uri: "projects/#{project_id}/translations", + resp: { body: fixture('translations/translations') } + ) + + translations = test_client.translations project_id + + expect(translations.collection.length).to eq(3) + expect_to_have_valid_resources(translations) + expect(translations.project_id).to eq(project_id) + + translation = translations[0] + + expect(translation.translation_id).to eq(translation_id) + end + + specify '#translation' do + stub( + uri: "projects/#{project_id}/translations/#{translation_id}?disable_references=1", + resp: { body: fixture('translations/translation') } + ) + + translation = test_client.translation project_id, translation_id, disable_references: 1 + + expect(translation.translation_id).to eq(translation_id) + expect(translation.project_id).to eq(project_id) + expect(translation.branch).to eq('master') + expect(translation.segment_number).to eq(1) + expect(translation.key_id).to eq(319_782_369) + expect(translation.language_iso).to eq('en') + expect(translation.translation).to include('Lokalise') + expect(translation.modified_by).to eq(20_181) + expect(translation.modified_by_email).to eq('bodrovis@protonmail.com') + expect(translation.modified_at).to eq('2023-05-19 15:52:12 (Etc/UTC)') + expect(translation.modified_at_timestamp).to eq(1_684_511_532) + expect(translation.is_reviewed).to be false + expect(translation.reviewed_by).to eq(0) + expect(translation.is_unverified).to be false + expect(translation.is_fuzzy).to be false + expect(translation.words).to eq(3) + expect(translation.custom_translation_statuses).to eq([]) + expect(translation.task_id).to be_nil + end + + specify '#update_translation' do + translation_data = { + translation: 'Updated from Ruby', + is_reviewed: true + } + + stub( + uri: "projects/#{project_id}/translations/#{translation_id}", + req: { body: translation_data, verb: :put }, + resp: { body: fixture('translations/update_translation') } + ) + + translation = test_client.update_translation project_id, translation_id, translation_data + + expect(translation).to be_an_instance_of(RubyLokaliseApi::Resources::Translation) + expect(translation.translation).to eq(translation_data[:translation]) + expect(translation.is_reviewed).to eq(translation_data[:is_reviewed]) + end +end diff --git a/spec/lib/ruby_lokalise_api/rest/webhooks_spec.rb b/spec/lib/ruby_lokalise_api/rest/webhooks_spec.rb new file mode 100644 index 0000000..36612a4 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/rest/webhooks_spec.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Rest::Webhooks do + let(:project_id) { '88628569645b945648b474.25982965' } + let(:webhook_id) { 'b47d698677ba426854ceee2982fe304d84c547f4' } + + specify '#webhooks' do + stub( + uri: "projects/#{project_id}/webhooks", + resp: { body: fixture('webhooks/webhooks') } + ) + + webhooks = test_client.webhooks project_id + + expect(webhooks.collection.length).to eq(3) + expect_to_have_valid_resources(webhooks) + expect(webhooks.project_id).to eq(project_id) + + webhook = webhooks[0] + + expect(webhook.webhook_id).to eq(webhook_id) + end + + specify '#webhook' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + resp: { body: fixture('webhooks/webhook') } + ) + + webhook = test_client.webhook project_id, webhook_id + + expect(webhook.webhook_id).to eq(webhook_id) + expect(webhook.project_id).to eq(project_id) + expect(webhook.url).to include('https://bodrovis') + expect(webhook.branch).to be_nil + expect(webhook.secret).to include('baa11') + expect(webhook.events).to include('project.translation.proofread') + expect(webhook.event_lang_map[0]['event']).to eq('project.translation.proofread') + end + + specify '#create_webhook' do + webhook_data = { + url: 'https://bodrovis.tech/lokalise', + events: %w[project.snapshot project.branch.merged] + } + + stub( + uri: "projects/#{project_id}/webhooks", + req: { body: webhook_data, verb: :post }, + resp: { body: fixture('webhooks/create_webhook') } + ) + + webhook = test_client.create_webhook project_id, webhook_data + + expect(webhook).to be_an_instance_of(RubyLokaliseApi::Resources::Webhook) + expect(webhook.url).to eq(webhook_data[:url]) + expect(webhook.events).to include(*webhook_data[:events]) + end + + specify '#update_webhook' do + webhook_data = { + events: %w[project.exported] + } + + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + req: { body: webhook_data, verb: :put }, + resp: { body: fixture('webhooks/update_webhook') } + ) + + webhook = test_client.update_webhook project_id, webhook_id, webhook_data + + expect(webhook).to be_an_instance_of(RubyLokaliseApi::Resources::Webhook) + expect(webhook.webhook_id).to eq(webhook_id) + expect(webhook.events).to eq(webhook_data[:events]) + end + + specify '#regenerate_webhook_secret' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}/secret/regenerate", + req: { verb: :patch }, + resp: { body: fixture('webhooks/regenerate_webhook_secret') } + ) + + response = test_client.regenerate_webhook_secret project_id, webhook_id + + expect(response).to be_an_instance_of(RubyLokaliseApi::Generics::RegeneratedWebhookSecret) + expect(response.project_id).to eq(project_id) + expect(response.secret).to include('70fb') + end + + specify '#destroy_webhook' do + stub( + uri: "projects/#{project_id}/webhooks/#{webhook_id}", + req: { verb: :delete }, + resp: { body: fixture('webhooks/destroy_webhook') } + ) + + resp = test_client.destroy_webhook project_id, webhook_id + + expect(resp).to be_an_instance_of(RubyLokaliseApi::Generics::DeletedResource) + expect(resp.project_id).to eq(project_id) + expect(resp.webhook_deleted).to be true + end +end diff --git a/spec/lib/ruby_lokalise_api/utils/classes_spec.rb b/spec/lib/ruby_lokalise_api/utils/classes_spec.rb new file mode 100644 index 0000000..72a2cc0 --- /dev/null +++ b/spec/lib/ruby_lokalise_api/utils/classes_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +RSpec.describe RubyLokaliseApi::Utils::Classes do + using described_class + + describe '#to_array_obj' do + it 'returns an array with key' do + obj1 = { name: 'test' } + + expect(obj1.to_array_obj(:parent)).to eq({ parent: [obj1] }) + end + + it 'keeps array intact' do + obj1 = [{ name: 'test' }] + + expect(obj1.to_array_obj(:parent)).to eq({ parent: obj1 }) + end + + it 'hash with array intact' do + obj1 = { parent: [{ name: 'test' }] } + + expect(obj1.to_array_obj(:parent)).to eq(obj1) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 32eacae..de0467a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,30 +3,36 @@ require 'dotenv/load' require 'simplecov' require 'webmock/rspec' +require 'oj' SimpleCov.start do + if ENV['CI'] + require 'simplecov-lcov' + + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' + end + + formatter SimpleCov::Formatter::LcovFormatter + end + add_filter 'spec/' add_filter '.github/' end -require 'ruby_lokalise_api' +require_relative '../lib/ruby_lokalise_api' -# Support files Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } RSpec.configure do |config| config.include TestClient + config.include Stubs + config.include Expectations + config.include RubyLokaliseApi::Utils::Loaders - WebMock.allow_net_connect! - WebMock::API.prepend(Module.new do - extend self - # disable VCR when a WebMock stub is created - # for clearer spec failure messaging - def stub_request(*args) - VCR.turn_off! - super - end - end) - - config.before { VCR.turn_on! } + config.before(:suite) do + Fixtures.eager_load + WebMock.allow_net_connect! + end end diff --git a/spec/support/expectations.rb b/spec/support/expectations.rb new file mode 100644 index 0000000..f36c31c --- /dev/null +++ b/spec/support/expectations.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +module Expectations + using RubyLokaliseApi::Utils::Classes + + def expect_to_delegate(object, method, *args) + return unless block_given? + + ep = object.instance_variable_get(:@self_endpoint) + + allow(ep.client).to receive(method) + + yield(object) + + expect(ep.client).to have_received(method).with(*args).exactly(1).times + end + + def expect_to_have_valid_resources(collection_obj) + proper_collection(collection_obj, collection_from(collection_obj)) + + proper_endpoint(collection_obj) + end + + private + + def proper_collection(collection_obj, collection) + expect(collection).to all(be_an_instance_of(resource_klass(collection_obj))) + + expect(endpoints(collection)).to all(be_an_instance_of(endpoint_klass_for(collection_obj))) + + expect(clients(collection)).to all(be_an_instance_of(RubyLokaliseApi::Client)) + end + + def proper_endpoint(collection_obj) + res, ep = first_collection_endpoint(collection_from(collection_obj)) + + params = res.class.const_get(:MAIN_PARAMS).to_array.map do |p| + res.send(p).to_s + end + + expect(ep.uri.split('/')).to include(*params) + end + + def collection_from(obj) + obj.collection + end + + def first_collection_endpoint(collection) + res = collection[0] + ep = res.instance_variable_get(:@self_endpoint) + + [res, ep] + end + + def resource_klass(collection_obj) + collection_obj.class.const_get(:RESOURCE) + end + + def clients(collection) + collection.map do |c| + c.instance_variable_get(:@self_endpoint).client + end + end + + def endpoints(collection) + collection.map do |c| + c.instance_variable_get(:@self_endpoint) + end + end + + def endpoint_klass_for(collection_obj) + klass = collection_obj.class + + klass.const_defined?(:RESOURCES_ENDPOINT) ? klass.const_get(:RESOURCES_ENDPOINT) : klass.const_get(:ENDPOINT) + end +end diff --git a/spec/support/fixtures.rb b/spec/support/fixtures.rb new file mode 100644 index 0000000..c8e2fc3 --- /dev/null +++ b/spec/support/fixtures.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'pathname' + +module Fixtures + class << self + def eager_load + cached_stubs = Pathname.glob("#{fixture_path}/**/*.json").each_with_object({}) do |full_path, result| + result[ + full_path.relative_path_from(fixture_path).sub_ext('').to_s + ] = File.read(full_path).freeze + end + + const_set :STUBS, cached_stubs + end + + private + + def fixture_path + File.expand_path('../fixtures', __dir__) + end + end +end diff --git a/spec/support/stubs.rb b/spec/support/stubs.rb new file mode 100644 index 0000000..e576340 --- /dev/null +++ b/spec/support/stubs.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module Stubs + def response(content, endpoint) + RubyLokaliseApi::Response.new content, endpoint + end + + def stub(uri:, req: {}, resp: {}) + base_url = req.fetch(:base_url, RubyLokaliseApi::Endpoints::MainEndpoint::BASE_URL) + + stub_request( + req.fetch(:verb, :get), + "#{base_url}/#{uri}" + ).with( + request_params(req) + ).to_return( + response_params(resp) + ) + end + + def loaded_fixture(filename) + Oj.load fixture(filename) + end + + def fixture(filename) + Fixtures::STUBS[filename] + end + + private + + def response_params(resp) + params = { + status: resp.fetch(:code, 200) + } + + if resp[:body] + params[:body] = resp[:body].is_a?(Hash) ? Oj.dump(resp[:body], mode: :strict) : resp[:body] + end + + params[:headers] = resp[:headers] if resp[:headers] + + params + end + + def request_params(req) + params = { headers: { + 'Accept' => 'application/json', + 'Accept-Encoding' => 'gzip,deflate,br', + 'User-Agent' => "ruby-lokalise-api gem/#{RubyLokaliseApi::VERSION}" + } } + + params = add_auth_header(params, req) + + # The default :object mode encode hashes in a way that's not properly + # recognized by Webmock + params[:body] = Oj.dump(req[:body], mode: :strict) if req[:body] + + params[:query] = req[:query] if req[:query] + + params + end + + def add_auth_header(params, req) + return params if req[:skip_token] + + token_header = req.fetch(:token_header, 'X-Api-Token') + token = req.fetch(:token) { ENV.fetch('LOKALISE_API_TOKEN', nil) } + + params[:headers][token_header] = token + + params + end +end diff --git a/spec/support/test_client.rb b/spec/support/test_client.rb index 03904d8..b43c344 100644 --- a/spec/support/test_client.rb +++ b/spec/support/test_client.rb @@ -5,11 +5,11 @@ def test_client(token = nil, params = {}) RubyLokaliseApi.client(token || ENV.fetch('LOKALISE_API_TOKEN', nil), params) end - def test_oauth2_client(token = nil, params = {}) - RubyLokaliseApi.oauth2_client(token || ENV.fetch('OAUTH2_TOKEN', nil), params) - end - def auth_client RubyLokaliseApi.auth_client(ENV.fetch('OAUTH2_CLIENT_ID', nil), ENV.fetch('OAUTH2_CLIENT_SECRET', nil)) end + + def test_oauth2_client(token = nil, params = {}) + RubyLokaliseApi.oauth2_client(token || ENV.fetch('OAUTH2_TOKEN', nil), params) + end end diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb deleted file mode 100644 index 01e2118..0000000 --- a/spec/support/vcr.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require 'vcr' - -VCR.configure do |c| - c.ignore_hosts 'codeclimate.com' - c.hook_into :faraday - c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes') - c.filter_sensitive_data('') { ENV.fetch('LOKALISE_API_TOKEN') } - c.filter_sensitive_data('') { ENV.fetch('OAUTH2_CLIENT_ID') } - c.filter_sensitive_data('') { ENV.fetch('OAUTH2_CLIENT_SECRET') } - c.filter_sensitive_data('') { ENV.fetch('OAUTH2_TOKEN') } - c.filter_sensitive_data('') { ENV.fetch('OAUTH2_CODE') } - c.filter_sensitive_data('') { ENV.fetch('OAUTH2_REFRESH_TOKEN') } -end