Sha256: ebb4d6c1c95fe9f5a5653a75ccd6784481feb6a4874f7d50e4aa22196e92428c
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
# Bitmarkable Generate and persist a bitly URL to an ActiveRecord object using Redis. ## Installation Add this line to your application's Gemfile: gem 'bitmarkable' And then execute: $ bundle Or install it yourself as: $ gem install bitmarkable ## Usage ```ruby Bitmarkable.configure do |c| c.login = "username" # bitly username c.api_key = "12345" # https://bitly.com/a/your_api_key c.base_url = Rails.application.config.base_url # base URL to prepend, if you're using relative paths end ``` Then, include it in your model. ```ruby include Bitmarkable::Bitmarked bitmark :site_url # optional method/attribute containing the URL to shorten, defaults to :url ``` The short URL can then be fetched using `instance.bitmark`. The value is stored in Redis with the key `class_name:id:bitmark`. If the bitmarkable class responds to `.delay` (e.g. you're using DelayedJob or Sidekiq) then bitmarks will be processed asynchronously. If running in Rails and in development or test environments, the bitmark will be set to the full localhost URL and the bitly API will not be called (because it will not shorten localhost URLs). The URL will still be set asynchronously (if applicable) to mimic production behavior. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bitmarkable-0.1.2 | README.md |
bitmarkable-0.1.1 | README.md |