Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multipage conversion (save_in_group) parameter to document conversion #173

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

vipulnsward
Copy link
Collaborator

@vipulnsward vipulnsward commented Jun 22, 2024

Description

Add multipage conversion (save_in_group) parameter to document conversion

Checklist

Summary by CodeRabbit

  • New Features

    • Added multi-page conversion option to document conversion API (save_in_group parameter).
  • Tests

    • Updated test cases to cover new multi-page conversion functionality.
    • Added new VCR cassettes for multipage conversion scenarios.

Copy link
Contributor

coderabbitai bot commented Jun 22, 2024

Walkthrough

The recent updates focus on enhancing the document conversion capabilities within the Uploadcare API. Notably, a new multi-page conversion feature has been introduced through the addition of the save_in_group parameter. This affects various components, including the API endpoint, configuration files, and test cases, adding functionality to group and convert multi-page documents seamlessly. Testing frameworks have been adjusted to validate these new features.

Changes

Files Change Summary
CHANGELOG.md Added parameter save_in_group for multi-page conversion in DocumentConverter#convert options.
api_examples/rest_api/post_convert_document.rb Updated options to include { store: '1', save_in_group: '1' } for multipage conversion.
lib/uploadcare/client/conversion/base_conversion_client.rb Added save_in_group option to build_body_for_many method in JSON payload construction.
spec/fixtures/...document_convert_convert_multipage_group.yml Captured HTTP interactions for document conversion to images and retrieval of conversion status.
spec/fixtures/...document_convert_convert_multipage_zip.yml Added HTTP interactions for converting a document to JPG format and retrieving conversion options for multipage ZIP scenarios.
spec/fixtures/...document_convert_to_multipage.yml POST request for converting a document to multipage format; specifying parameters and receiving response details.
spec/support/vcr.rb Added configure_rspec_metadata! method affecting RSpec metadata behavior.
spec/uploadcare/client/conversion/document_conversion_client_spec.rb Refactored test context for document conversion; introduced new contexts for multipage conversion with VCR tags.
spec/uploadcare/entity/conversion/document_converter_spec.rb Renamed convert_many to convert; added multipage and group handling in shared examples and contexts; updated test logic for these scenarios.

Poem

🌟 The code did twinkle, bright and new,
Convert in groups, pages quite a few.
Multi-page documents, all in a line,
Saved together, looking fine.
Tests abound, to check and see,
Uploadcare’s magic, as it should be.
🐇 A bunny's dream, now in code,
To ease the document-heavy load!


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df19608 and bda80cb.

Files selected for processing (9)
  • CHANGELOG.md (1 hunks)
  • api_examples/rest_api/post_convert_document.rb (1 hunks)
  • lib/uploadcare/client/conversion/base_conversion_client.rb (1 hunks)
  • spec/fixtures/vcr_cassettes/document_convert_convert_multipage_group.yml (1 hunks)
  • spec/fixtures/vcr_cassettes/document_convert_convert_multipage_zip.yml (1 hunks)
  • spec/fixtures/vcr_cassettes/document_convert_to_multipage.yml (1 hunks)
  • spec/support/vcr.rb (1 hunks)
  • spec/uploadcare/client/conversion/document_conversion_client_spec.rb (2 hunks)
  • spec/uploadcare/entity/conversion/document_converter_spec.rb (2 hunks)
Files skipped from review due to trivial changes (2)
  • spec/fixtures/vcr_cassettes/document_convert_convert_multipage_group.yml
  • spec/fixtures/vcr_cassettes/document_convert_to_multipage.yml
Additional context used
LanguageTool
CHANGELOG.md

[duplication] ~10-~10: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...toptions. ## 4.4.2 — 2024-05-29 ### Fixed * Fixed theUploadcare::File.remote_copy` meth...


[uncategorized] ~11-~11: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...ruct::EntityError: {url} must be Hash. Now returns a string instead of a File` en...


[duplication] ~18-~18: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...Converter. ## 4.4.1 — 2024-04-27 ### Added * Added AWS Rekognition Moderation` Add-On. * ...


[uncategorized] ~27-~27: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...ies. ### Fixed * Throw AuthError if current public key or secret key config are emp...


[uncategorized] ~28-~28: You might be missing the article “a” here. (AI_EN_LECTOR_MISSING_DETERMINER_A)
Context: ...een renamed to AkamaiGenerator to fix typo in class name. ## 4.4.0 — 2024-03-09 ...


[uncategorized] ~28-~28: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...med to AkamaiGenerator to fix typo in class name. ## 4.4.0 — 2024-03-09 ### Break...


[uncategorized] ~106-~106: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...0.0 — 2022-12-29 This version supports latest Uploadcare REST API — [v0.7](https://up...


[style] ~129-~129: In American English, abbreviations like “etc.” require a period. (ETC_PERIOD)
Context: ...s mime-type, image (dimensions, format, etc), video information (duration, format, ...


[style] ~129-~129: In American English, abbreviations like “etc.” require a period. (ETC_PERIOD)
Context: ...information (duration, format, bitrate, etc), audio information, etc - Field `met...


[style] ~129-~129: In American English, abbreviations like “etc.” require a period. (ETC_PERIOD)
Context: ...rmat, bitrate, etc), audio information, etc - Field metadata that includes arbi...


[style] ~135-~135: This phrase is redundant (‘I’ stands for ‘interface’). Use simply “API”. (ACRONYM_TAUTOLOGY)
Context: ...plications ### Added - Add Uploadcare API interface: - Uploadcare::FileMetadata -...


[duplication] ~161-~161: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...tureVerifier ## 3.1.1 — 2021-10-13 - FixedUploadcare::File#store- FixedUploadcare::File#delete` ## 3.1.0 — 2...


[uncategorized] ~168-~168: The grammatical number of this noun doesn’t look right. Consider replacing it. (AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)
Context: ... an option to add custom logic to large files uploading process ## 3.0.5 — 2021-04-1...

Markdownlint
CHANGELOG.md

88-88: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


89-89: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


97-97: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


98-98: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


102-102: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


115-115: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


116-116: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


117-117: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


118-118: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


119-119: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


120-120: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


121-121: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


122-122: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


123-123: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


124-124: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


128-128: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


129-129: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


130-130: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


131-131: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


135-135: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


136-136: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


137-137: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


138-138: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


139-139: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


143-143: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


147-147: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


148-148: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


152-152: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


156-156: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


157-157: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


161-161: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


162-162: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


166-166: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


167-167: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


168-168: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


172-172: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


173-173: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


177-177: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


178-178: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


179-179: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


183-183: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


187-187: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


188-188: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


192-192: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


193-193: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


194-194: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


195-195: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


196-196: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


202-202: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


206-206: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


207-207: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


208-208: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


209-209: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


210-210: Expected: asterisk; Actual: dash (MD004, ul-style)
Unordered list style


136-136: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


137-137: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


47-47: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


60-60: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


67-67: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


10-10: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


13-13: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


18-18: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


22-22: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


44-44: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


6-6: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


11-11: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


14-14: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


19-19: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


23-23: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


45-45: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


107-107: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines

Additional comments not posted (5)
spec/support/vcr.rb (1)

16-16: Good integration with RSpec metadata.

Adding configure_rspec_metadata! enhances the use of VCR with RSpec, leveraging metadata to manage test cassettes effectively. This is a beneficial change for maintaining clean and isolated test environments.

lib/uploadcare/client/conversion/base_conversion_client.rb (1)

53-54: Correct implementation of multi-page conversion options.

The addition of store and save_in_group options in the build_body_for_many method is correctly implemented. These changes are essential for supporting the new functionality of multi-page document conversion.

spec/uploadcare/client/conversion/document_conversion_client_spec.rb (1)

30-44: Enhanced test coverage for multi-page conversion.

The addition of new contexts with specific VCR tags for testing multi-page conversion is well-executed. These tests appropriately cover the new functionality, ensuring that the feature behaves as expected under different scenarios.

spec/uploadcare/entity/conversion/document_converter_spec.rb (1)

Line range hint 11-85: Review of the multipage conversion feature in DocumentConverter tests.

The test suite for the DocumentConverter reflects the new multipage conversion feature well. The use of shared examples to test both single and multipage scenarios is a good practice as it ensures code reusability and maintainability. However, ensure that the vcr tags correspond to the correct VCR cassettes to guarantee that the tests are reliable and reflect real API interactions.

CHANGELOG.md (1)

5-7: Changelog Update for Multipage Conversion Feature.

The changelog entry for the new save_in_group feature in the DocumentConverter#convert method is clear and concise. This will help users understand the new capabilities of the library. Ensure that the changelog is kept up-to-date with all such significant changes to maintain clarity for the end users.

Tools
Markdownlint

5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


6-6: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines

@vipulnsward vipulnsward merged commit e0db13d into main Jun 22, 2024
10 checks passed
@vipulnsward vipulnsward deleted the gh-127 branch June 22, 2024 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant