Class: Embedly::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/embedly/command_line.rb

Defined Under Namespace

Classes: Parser

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CommandLine

Returns a new instance of CommandLine.



121
122
123
# File 'lib/embedly/command_line.rb', line 121

def initialize(args)
  @options, @args = {}, args
end

Class Method Details

.run!(endpoint, args = []) ⇒ Object



116
117
118
# File 'lib/embedly/command_line.rb', line 116

def run!(endpoint, args = [])
  new(args).run(endpoint)
end

Instance Method Details

#optionsObject



131
132
133
134
# File 'lib/embedly/command_line.rb', line 131

def options
  @options = Parser.parse!(@args.dup)
  @options
end

#run(endpoint = :oembed) ⇒ Object



125
126
127
128
129
# File 'lib/embedly/command_line.rb', line 125

def run(endpoint = :oembed)
  api_options = options.dup
  query = api_options.delete(:query)
  Embedly::API.new(api_options).send(endpoint, query)
end