Class: ApiResource::Mocks::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/api_resource/mocks.rb

Overview

A simple interface class to change the new connection to look like the old activeresource connection

Instance Method Summary collapse

Instance Method Details

#delete(path, *args, &block) ⇒ Object



26
27
28
# File 'lib/api_resource/mocks.rb', line 26

def delete(path, *args, &block)
  Connection.delete(process_path(path), *args, &block)
end

#get(path, *args, &block) ⇒ Object



15
16
17
18
19
# File 'lib/api_resource/mocks.rb', line 15

def get(path, *args, &block)
  uri = URI.parse(path)
  path = uri.path + (uri.query.present? ? "?#{uri.query}" : '')
  Connection.get(path, *args, &block)
end

#head(path, *args, &block) ⇒ Object



29
30
31
# File 'lib/api_resource/mocks.rb', line 29

def head(path, *args, &block)
  Connection.head(process_path(path), *args, &block)
end

#post(path, *args, &block) ⇒ Object



20
21
22
# File 'lib/api_resource/mocks.rb', line 20

def post(path, *args, &block)
  Connection.post(process_path(path), *args, &block)
end

#put(path, *args, &block) ⇒ Object



23
24
25
# File 'lib/api_resource/mocks.rb', line 23

def put(path, *args, &block)
  Connection.put(process_path(path), *args, &block)
end