Project

vaporizer

0.0
No commit activity in last 3 years
No release in over 3 years
Vaporizer is a lightweight ruby wrapper which enable to consume easily the new Leafly API which needs authentication
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
>= 0

Runtime

>= 0
 Project Readme

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