No commit activity in last 3 years
No release in over 3 years
The PreferredPictures Ruby client library provides a convenient way to call the PreferredPictures API for applications written in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.2
 Project Readme

PreferredPictures Ruby Client Library

The PreferredPictures PHP library provides a convenient way to call the PreferredPictures API for applications written in Ruby

View the full documentation about the PreferredPicture's API

Learn more about what PreferredPictures can do.

Installation

gem install preferredpictures

And then execute:

$ bundle install

Or install it yourself as:

$ gem install preferredpictures

Usage

require "preferredpictures"

# Create a new client using an issued identity
# and a secret key
client = PreferredPictures::Client.new(
    identity: "testidentity",
    secret_key: "secret123456")

# A simple example with just choices and the a tournament.
url = client.createChooseUrl(
    choices: ['https://example.com/image-red.jpg',
              'https://example.com/image-green.jpg',
              'https://example.com/image-blue.jpg'],
    tournament: 'test-tournament')

# A more involved example setting a prefix and suffix
# applied to the choices for brevity
url = client.createChooseUrl(
    choices: ['red', 'green', 'blue'],
    tournament: 'test-tournament',
    choices_prefix: "https://example.com/image-",
    choices_suffix: ".jpg")

# The url returned will appear to be something like:
#
# https://api.preferred-pictures.com/choose-url?choices=red%2Cgreen%2Cblue&tournament=testing&expiration=[EXPIRATION]&uid=[UNIQUEID]&ttl=600&prefix=https%3A%2F%2Fexample.com%2Fjacket-&suffix=.jpg&identity=test-identity&signature=[SIGNATURE]
#
# which should be placed where it is needed in your application or templates.

Contributing

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

License

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

Code of Conduct

Everyone interacting in the Preferredpictures project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.