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.



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

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

Class Method Details

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



112
113
114
# File 'lib/embedly/command_line.rb', line 112

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

Instance Method Details

#optionsObject



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

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

#run(endpoint = :oembed) ⇒ Object



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

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