Skip to content

A lightweight but complete ruby wrapper to consume Leafly API

License

Notifications You must be signed in to change notification settings

nflorentin/vaporizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vaporizer

Vaporizer is a lightweight ruby wrapper of Leafly API.

Installation

Add this line to your application's Gemfile:

gem 'vaporizer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install vaporizer

Good to know

Some things to know before using this gem:

  • This is my first gem, please be tolerant
  • Leafly API is kind of inconsistent and do not respect rules of JSON API standard, that's not my fault
  • Changes in Leafly API could break this gem, if it happens, do not hesitate to open an issue and I will fix it as fast as possible
  • Vaporizer returns pure parsed JSON and do not wrap results with objects
  • If you need more functionalities, do not hesitate to contact me and we will discuss it

Configuration

require 'vaporizer'

Vaporizer.configure do |config|
  config.app_id = "YOUR_APP_ID"
  config.app_key = "YOUR_APP_KEY"
  config.timeout = 3 # timeout for the requests, optional, in seconds
end

Usage examples

These examples are a bit minimalist but you can of course pass more arguments to the methods

Strains

search

Vaporizer::Strain.search(search: 'dream', page: 0, take: 10)

more complex search

Vaporizer::Strain.search(
    filters: {
      flavors: ['blueberry'],
      conditions: ['anxiety']
    },
    search: '',
    page: 0, take: 10
)

details

Vaporizer::Strain.details('la-confidential') # argument is a slug of strain's name

reviews

Vaporizer::Strain.reviews('la-confidential', { page: 0, take: 3 })

review details

Vaporizer::Strain.review_details('la-confidential', 2836) # 2nd argument is the review id

photos

Vaporizer::Strain.photos('la-confidential', { page: 0, take: 4 })

availabilities

Vaporizer::Strain.availabilities('la-confidential', { lat: 33.5, lon: -117.6 })

Locations

search

Vaporizer::Location.search(latitude: 47.606, longitude: -122.333, page: 0, take: 5)

details

Vaporizer::Location.details('papa-ganja')

menu

Vaporizer::Location.menu('papa-ganja')

reviews

Vaporizer::Location.reviews('papa-ganja', { take: 3, skip: 0})

specials

Vaporizer::Location.specials('papa-ganja')

More options

To have the list of all params and filters available of the Leafly API, please refer to the official documentation

Contributing

  1. Fork it ( https://github.com/[my-github-username]/vaporizer/fork )
  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 a new Pull Request

About

A lightweight but complete ruby wrapper to consume Leafly API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages