Giter Site home page Giter Site logo

sharemeowclient's Introduction

ShareMeowClient ๐Ÿ˜ป

Build Status Test Coverage Code Climate

Ruby client for easily generating ShareMeow URL's. โญ

Learn more about ShareMeow.

Installation

Add this line to your application's Gemfile:

gem 'share_meow_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install share_meow_client

Usage

First, you'll need to set the configuration variables in an initializer.

# config/initializers/share_meow_client.rb
ShareMeowClient.configuration do |config|
  config.base_url = 'https://your-share-meow.example.com'
  config.secret_key = 'a_very_long_secret_key'
end

Then, to generate a URL.

image_url = ShareMeowClient.image_url(template: 'HelloWorld', options: { message: 'Hi' })
# => "https://your-share-meow.herokuapp.com/v1/eyJ0ZW1wbGF0ZSI6IkhlbGxvV29ybGQiLCJtZXNzYWdlIjoiSGVsbG8ifQ==/-lgitNQmEs9NaiWyOCHeV137D80=/image.jpg"

Template is the name of your ShareMeow template. And then options are the required options for your template.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/producthunt/ShareMeowClient. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

sharemeowclient's People

Contributors

chulkilee avatar marckohlbrugge avatar mscoutermarsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

esteedqueen nist

sharemeowclient's Issues

What's the recommended way to pre-generate an image when using a CDN?

Generating images on-the-fly is great, but can be a little bit slow at times. Using a CDN helps, but not for the initial request.

Is there a recommended way to 'ping' the ShareMeow app through the CDN (e.g. a simple GET request) so it starts generating the image and can be loaded from the CDN cache the next request?

A simple open(url) would work, but for large images it seems wasteful waiting for the full response.

Setting config to nil produces cryptic error message

When setting the config variables to nil you'll receive the following error when calling .image_url:

!! #<TypeError: no implicit conversion of nil into String>

I ran into this problem, because I'm using ENV variables in my initializer and accidentally forgot to set a value. This results in the ShareMeow config variables being set no nil, overriding the defaults and .image_url producing the cryptic error above.

Fortunately there's a limited codebase here so debugging this is rather painless, but I still think a more descriptive error message when calling .image_url or using nil as a configuration value would be handy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.