Skip to content

Add examples and Rails project - #7

Open
rohit-fastpix wants to merge 2 commits into
mainfrom
feature/examples
Open

Add examples and Rails project#7
rohit-fastpix wants to merge 2 commits into
mainfrom
feature/examples

Conversation

@rohit-fastpix

Copy link
Copy Markdown
Collaborator

FastPix Ruby SDK - Documentation PR

Documentation Changes

What Changed

  • New documentation added
  • Existing documentation updated
  • Documentation errors fixed
  • Code examples updated
  • Links and references updated
  • Other — renamed samples/examples/, added a runnable Rails app

Files Modified

  • README.md
  • docs/ files
  • USAGE.md
  • CONTRIBUTING.md
  • Other: examples/ (new folder, replaces samples/) + examples/rails-example/

Summary

Brief description of changes:

Replaced the old samples/ folder with a consolidated examples/ folder.

- The previous samples used a dead namespace (FastpixApiSDK::Fastpix) and could
  not run. All flows were rewritten against the real FastpixClient::Fastpixapi
  API, read credentials from the environment, and clean up after themselves.
- Added create_upload.rb (mint a signed direct-upload URL) and verify_webhook.rb
  (offline webhook signature verification, stdlib only).
- Added examples/rails-example/: a minimal single-file Rails app exposing
  POST /uploads and POST /webhooks.
- Added examples/README.md, .env.example, .gitignore, and examples/test_examples.rb
  (offline well-formedness checks + webhook-verifier unit tests).

The main README/USAGE/CONTRIBUTING/docs were not touched — nothing in the repo
referenced the old samples/ folder, so the rename orphaned no links.

Code Examples (if Applicable)

# Mint a signed direct-upload URL (examples/create_upload.rb)
require 'fastpixapi'

Models = ::FastpixClient::Models

sdk = ::FastpixClient::Fastpixapi.new(
  security: Models::Components::Security.new(
    username: ENV.fetch('FASTPIX_USERNAME'), # Access Token
    password: ENV.fetch('FASTPIX_PASSWORD')  # Secret Key
  )
)

req = Models::Operations::DirectUploadVideoMediaRequest.new(
  cors_origin: '*', # tighten to your own origin before shipping
  push_media_settings: Models::Operations::PushMediaSettings.new(
    metadata: { 'source' => 'create_upload_example' }
  )
)

data = sdk.input_video.direct_upload_video_media(request: req).object&.data
puts "Upload ID: #{data&.upload_id}"
puts "PUT your file to: #{data&.url}"

Testing

  • All code examples tested
  • Links verified
  • Grammar checked
  • Formatting consistent

Review Checklist

  • Content is accurate
  • Code examples work
  • Links are working
  • Grammar is correct
  • Formatting is consistent

Ready for review!

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.

2 participants