Module: Vimpack::Utils::Api::ClassMethods

Defined in:
lib/vimpack/utils/api.rb

Instance Method Summary collapse

Instance Method Details

#wrap_http_call(cassette_name = 'vimpack') ⇒ Object

Raises:

  • (StandardError)


26
27
28
29
30
31
32
33
34
35
# File 'lib/vimpack/utils/api.rb', line 26

def wrap_http_call(cassette_name='vimpack')
  raise StandardError.new('you must give a block to wrap_http_call') unless block_given?
  if Vimpack.env?(:production)
    yield
  else
    VCR.use_cassette(cassette_name) do
      yield
    end
  end
end

#wrap_open(*args) ⇒ Object



20
21
22
23
24
# File 'lib/vimpack/utils/api.rb', line 20

def wrap_open(*args)
  wrap_http_call do
    open(*args)
  end
end