Skip to content

Update instructions to use outside Rails Apps#179

Merged
vipulnsward merged 2 commits intomainfrom
gh-178
Apr 1, 2025
Merged

Update instructions to use outside Rails Apps#179
vipulnsward merged 2 commits intomainfrom
gh-178

Conversation

@vipulnsward
Copy link
Collaborator

@vipulnsward vipulnsward commented Apr 1, 2025

Description

Update instructions to use outside Rails Apps.
Fixes #178

Checklist

Summary by CodeRabbit

  • Documentation
    • Enhanced the installation instructions to support direct installation via the command line.
    • Added an example snippet demonstrating how to configure and use the gem in standalone Ruby applications.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

Walkthrough

The pull request updates the README documentation to include instructions for using the uploadcare-ruby gem outside of Rails. It explains how to install the gem via the command line using $ gem install uploadcare-ruby and provides a code snippet demonstrating how to configure the gem by setting the public and secret keys and retrieving file information using Uploadcare::File.info(uuid). Additionally, it modifies the logic in several Ruby files, including changes to the is_active assignment in the WebhookClient class and updates to the argument construction in various test files. No changes were made to the declarations of exported or public entities.

Changes

File Change Summary
README.md Added instructions for standalone installation and usage, including the command line install and Ruby code configuration.
lib/uploadcare/client/webhook_client.rb Simplified logic for determining the is_active key in the create method.
lib/uploadcare/param/conversion/video/processing_job_url_builder.rb Modified syntax for assigning resize_mode in the size_part method.
spec/uploadcare/client/conversion/video_convertion_client_spec.rb Updated argument construction from select to slice for clarity in tests.
spec/uploadcare/entity/conversion/video_converter_spec.rb Updated argument construction from select to slice for clarity in tests.
spec/uploadcare/param/conversion/video/processing_job_url_builder_spec.rb Updated argument construction from select to slice for clarity in tests.

Assessment against linked issues

Objective Addressed Explanation
Update docs to show gem usage without bundler as a standalone require (#178)

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 8335ce0 and 6f0b3f3.

📒 Files selected for processing (5)
  • lib/uploadcare/client/webhook_client.rb (1 hunks)
  • lib/uploadcare/param/conversion/video/processing_job_url_builder.rb (1 hunks)
  • spec/uploadcare/client/conversion/video_convertion_client_spec.rb (1 hunks)
  • spec/uploadcare/entity/conversion/video_converter_spec.rb (1 hunks)
  • spec/uploadcare/param/conversion/video/processing_job_url_builder_spec.rb (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • lib/uploadcare/param/conversion/video/processing_job_url_builder.rb
🧰 Additional context used
🧬 Code Definitions (1)
spec/uploadcare/param/conversion/video/processing_job_url_builder_spec.rb (1)
lib/uploadcare/entity/file.rb (1)
  • uuid (25-30)
🔇 Additional comments (4)
lib/uploadcare/client/webhook_client.rb (1)

16-16: ⚠️ Potential issue

Check the behavior of the is_active assignment

The change from a conditional expression to using the logical OR (||) operator might introduce a behavior change. With the current implementation, if options[:is_active] is explicitly set to false, it will be overridden to true because false || true evaluates to true. This means clients cannot explicitly disable webhooks by passing is_active: false.

Consider using a nil check instead to preserve the ability to set webhooks as inactive:

- is_active: options[:is_active].nil? || options[:is_active]
+ is_active: options[:is_active].nil? ? true : options[:is_active]

Likely an incorrect or invalid review comment.

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

41-41: Good refactoring using Hash#slice

Replacing select with slice makes the code more readable and concise while maintaining the same functionality. This is a good improvement for code clarity.

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

48-48: Good refactoring using Hash#slice

Using slice instead of select improves code readability and maintains consistent code style across the test files. This change keeps the same functionality while making the code more concise.

spec/uploadcare/param/conversion/video/processing_job_url_builder_spec.rb (1)

46-46: Good refactoring using Hash#slice consistently

Replacing select with slice across all these test cases improves code readability and maintains a consistent approach throughout the codebase. This change makes the code more concise while preserving the same functionality.

Also applies to: 57-57, 65-65, 74-74


🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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: 0

🧹 Nitpick comments (1)
README.md (1)

56-61: Enhance Shell Command Formatting
The new instructions clearly explain that the gem can be used outside of Rails. However, the shell command on line 60 ($ gem install uploadcare-ruby) is indented rather than enclosed in a fenced code block. Using a fenced code block (e.g., with bash) would improve readability and comply with markdown style guidelines.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

60-60: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


60-60: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc31e0c and 8335ce0.

📒 Files selected for processing (1)
  • README.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

60-60: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


60-60: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

🔇 Additional comments (1)
README.md (1)

62-74: Clear Ruby Configuration Snippet
The Ruby code snippet effectively demonstrates how to configure the gem in a standalone Ruby application. It clearly shows the required require statement, setting the public and secret keys, and provides an example usage of retrieving file information. This addition meets the PR objective perfectly.

@vipulnsward vipulnsward merged commit 8770f37 into main Apr 1, 2025
10 checks passed
@vipulnsward vipulnsward deleted the gh-178 branch April 1, 2025 12:11
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.

Update docs to show gem usage without bundler as a standalone require

1 participant