Sha256: 4cb07a58ced91f3e032194b21ec86d335abac0dd815f40fdd43ae85537d26299

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'bubblefish.rb'
require 'unirest'

class App
  include Methadone::Main
  include Methadone::CLILogging

  DEFAULT_TYPE = 'synonyms'.freeze

  main do |word|
    type = options['type'] || DEFAULT_TYPE
    url = "https://wordsapiv1.p.mashape.com/words/#{word}/#{type}"
    response = Unirest.get url,
                headers: {
                  "X-Mashape-Key" => ENV['MASHAPE_KEY'],
                  "Accept" => "application/json"
                }
    info response.body[type].join("\n")
  end

  description "one line description of your app"

  on("--type VAL","Which type of word search to use, defaults to synonyms")

  arg :word, "Starting point for search"

  version Bubblefish::VERSION

  use_log_level_option :toggle_debug_on_signal => 'USR1'

  go!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bubblefish-0.1.1 bin/bubblefish
bubblefish-0.1.0 bin/bubblefish