{"id":13878937,"url":"https://github.com/useflyyer/flyyer-ruby","last_synced_at":"2025-07-22T20:34:12.232Z","repository":{"id":47469399,"uuid":"286085547","full_name":"useflyyer/flyyer-ruby","owner":"useflyyer","description":"Ruby helpers to create https://cdn.flyyer.io URLs | Og:Image as a Service","archived":false,"fork":false,"pushed_at":"2021-10-21T13:41:11.000Z","size":77,"stargazers_count":12,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T21:23:03.878Z","etag":null,"topics":["flyyer","gem","image-generator","open-graph","rails","ruby","seo","twitter-cards"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/flyyer","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/useflyyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-08T17:08:51.000Z","updated_at":"2023-10-27T20:58:07.000Z","dependencies_parsed_at":"2022-08-27T02:30:33.467Z","dependency_job_id":null,"html_url":"https://github.com/useflyyer/flyyer-ruby","commit_stats":null,"previous_names":["flayyer/flayyer-ruby"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/useflyyer/flyyer-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/useflyyer","download_url":"https://codeload.github.com/useflyyer/flyyer-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265512666,"owners_count":23779966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flyyer","gem","image-generator","open-graph","rails","ruby","seo","twitter-cards"],"created_at":"2024-08-06T08:02:04.712Z","updated_at":"2025-07-22T20:34:12.193Z","avatar_url":"https://github.com/useflyyer.png","language":"Ruby","readme":"# flyyer-ruby\n\nThe AI-powered preview system built from your website (no effort required).\n\n![Flyyer live image](https://github.com/useflyyer/create-flyyer-app/blob/master/.github/assets/website-to-preview.png?raw=true\u0026v=1)\n\n**This gem is agnostic to any Ruby framework.**\n\n## Index\n\n- [Get started (5 minutes)](#get-started-5-minutes)\n- [Advanced usage](#advanced-usage)\n- [Flyyer Render](#flyyer-render)\n- [Development](#development)\n- [Test](#test)\n\n## Get started (5 minutes)\n\nHaven't registered your website yet? Go to [Flyyer.io](https://flyyer.io?ref=flyyer-ruby) and create a project (e.g. `website-com`).\n\n### 1. Install the library\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'flyyer'\n```\n\nAnd then execute:\n\n```sh\nbundle install\n```\n\nOr install it yourself as:\n\n```sh\ngem install flyyer\n```\n\n### 2. Get your Flyyer.io smart image link\n\nIn your website code (e.g. your landing or product/post view file), set the following:\n\n```ruby\nflyyer = Flyyer::Flyyer.create do |f|\n  # Your project slug\n  f.project = 'website-com'\n  # The current path of your website\n  f.path = '/path/to/product' # In Ruby on Rails you can use `request.env['PATH_INFO']`\n  # (Optional, Recommended) Default or main image for each page\n  f.default=\"/static/image-1.png\" # or https://your-site.com/static/image-1.png\nend\n\n# Check:\nputs flyyer.href\n# \u003e https://cdn.flyyer.io/v2/website-com/_/__v=1618281823\u0026_def=%2Fstatic%2Fimage-1.png/path/to/product\n```\n\n### 3. Put your smart image link in your `\u003chead\u003e` tags\n\nYou'll get the best results like this:\n\n```ruby\n# .haml\n%meta{ property: 'og:image', content: flyyer.href }\n%meta{ name: 'twitter:image', content: flyyer.href }\n%meta{ name: 'twitter:card', content: 'summary_large_image' }\n\n# .erb\n\u003cmeta property=\"og:image\" content='\u003c%= flyyer.href %\u003e'\u003e\n\u003cmeta name=\"twitter:image\" content='\u003c%= flyyer.href %\u003e'\u003e\n\u003cmeta name=\"twitter:card\" content=\"summary_large_image\"\u003e\n\n# IMPORTANT: if you're using Ruby on Rails, please use `flyyer.href.html_safe` to prevent double serialization\n```\n\n### 4. Create a `rule` for your project\n\nGo to your dashboard [here](https://flyyer.io/dashboard/_/projects/_/manage) and create a rule like the following:\n\n[![Flyyer basic rule example](https://github.com/useflyyer/create-flyyer-app/blob/master/.github/assets/rule-example.png?raw=true\u0026v=1)](https://flyyer.io/dashboard)\n\nVoilà!\n\n## Advanced usage\n\nAdvanced features include:\n\n- Custom variables: additional information for your preview that is not present in your website. [Note: if you need customization you should take a look at [Flyyer Render](#flyyer-render)]\n- Custom metadata: set custom width, height, resolution, and more (see example).\n- Signed URLs.\n\nHere you have a detailed full example for project `website-com` and path `/path/to/product`.\n\n```ruby\nflyyer = Flyyer::Flyyer.create do |f|\n  # [Required] Your project slug, find it in your dashboard https://www.flyyer.io/dashboard/_/projects/_/integrate.\n  f.project = 'website-com'\n  # [Recommended] The current path of your website (by default it's `/`).\n  f.path = '/path/to/product'\n  # [Optional] In case you want to provide information that is not present in your page set it here.\n  f.variables = {\n    'title': 'Product name',\n    'img': 'https://flyyer.io/img/marketplace/flyyer-banner.png',\n  }\n  # [Optional] Custom metadata for rendering the image. ID is recommended so we provide you with better statistics.\n  f.meta = {\n    'id': 'jeans-123', # recommended for better stats\n    'v': '12369420123', # specific handler version, by default it's a random number to circumvent platforms' cache,\n    'width': 1200,\n    'height': 600,\n    'resolution': 0.9, # from 0.0 to 1.0\n    'agent': 'whatsapp', # force dimensions for specific platform\n  }\nend\n\n# Use this image in your \u003chead/\u003e tags (og:image \u0026 twitter:image)\nputs flyyer.href\n# \u003e https://cdn.flyyer.io/v2/website-com/_/__id=jeans-123\u0026__v=1618281823\u0026img=https%3A%2F%2Fflyyer.io%2Fimg%2Fmarketplace%2Fflyyer-banner.png\u0026title=Product+name/path/to/product\n\n# IMPORTANT: if you're using Ruby on Rails, please use `flyyer.href.html_safe` to prevent double serialization\n```\n\nFor signed URLs, just provide your secret (find it in Dashboard \u003e Project \u003e Advanced settings) and choose a strategy (`HMAC` or `JWT`).\n\n```ruby\nflyyer = Flyyer::Flyyer.create do |f|\n  f.project = 'website-com'\n  f.path = '/path/to/product'\n  f.secret = 'your-secret-key'\n  f.strategy = 'JWT' # or 'HMAC'\nend\n\nurl = flyyer.href\n# \u003e https://cdn.flyyer.io/v2/website-com/jwt-eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJhbXMiOnsiX19pZCI6ImplYW5zLTEyMyJ9LCJwYXRoIjoiXC9wYXRoXC90b1wvcHJvZHVjdCJ9.X8Vs5SGEA1-3M6bH-h24jhQnbwH95V_G0f-gPhTBTzE?__v=1618283086\n\n# IMPORTANT: if you're using Ruby on Rails, please prevent double serialization like the following:\nurl = flyyer.href.html_safe\n```\n\n## Flyyer Render\n\nAs you probably realized, **Flyyer** uses the [rules defined on your dashboard](https://flyyer.io/dashboard/_/projects) to decide how to handle every image based on path patterns. It analyses your website to obtain information and then render a content-rich image with no effort. Let's say _\"Flyyer delivers images based on the content of this route\"_.\n\n**Flyyer Render** instead requires you to explicitly declare template and variables for the images to render, **giving you more control for customization**. Let's say _\"FlyyerRender delivers an image using this template and these explicit variables\"_.\n\n```ruby\nrequire 'flyyer'\n\nflyyer = Flyyer::FlyyerRender.create do |f|\n  f.tenant = 'tenant'\n  f.deck = 'deck'\n  f.template = 'template'\n  f.variables = {\n      title: 'Hello world!'\n  }\nend\n\n# Use this image in your \u003chead/\u003e tags\nurl = flyyer.href\n# \u003e https://cdn.flyyer.io/render/v2/tenant/deck/template.jpeg?__v=1596906866\u0026title=Hello+world%21\n\n# IMPORTANT: if you're using Ruby on Rails, please prevent double serialization like the following:\nurl = flyyer.href.html_safe\n```\n\nVariables can be complex arrays and hashes.\n\n```ruby\nflyyer = Flyyer::FlyyerRender.create do |f|\n  # ...\n  f.variables = {\n      items: [\n          { text: 'Oranges', count: 12 },\n          { text: 'Apples', count: 14 },\n      ],\n  }\n  f.meta = {\n    id: 'slug-or-id', # To identify the resource in our analytics report\n  }\nend\n```\n\n**IMPORTANT: variables must be serializable.**\n\nTo decode the URL for debugging purposes:\n\n```ruby\nprint(CGI.unescape(url))\n# \u003e https://cdn.flyyer.io/render/v2/tenant/deck/template.jpeg?title=Hello+world!\u0026__v=123\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Test\n\nRun Rake tests with:\n\n```sh\nrake spec\n```\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseflyyer%2Fflyyer-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuseflyyer%2Fflyyer-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseflyyer%2Fflyyer-ruby/lists"}