module Fastly::Fetcher

def client(opts = {})

Get the current Fastly::Client
:nodoc: all
Encapsulates HTTP client interactions
def client(opts = {})
  @client ||= Client.new(opts)
end

def create(klass, opts)

def create(klass, opts)
  hash = client.post(klass.post_path(opts), opts)
  klass.new(hash, self)
end

def delete(klass, obj)

def delete(klass, obj)
  client.delete(klass.delete_path(obj))
end

def get(klass, *args)

def get(klass, *args)
  if [User, Customer].include?(klass) && args.empty?
    hash = client.get("/current_#{klass.path}")
  else
    hash = client.get(klass.get_path(*args))
  end
  hash.nil? ? nil : klass.new(hash, self)
end

def list(klass, opts = {})

def list(klass, opts = {})
  list = client.get(klass.list_path(opts))
  return [] if list.nil?
  list.map { |hash| klass.new(hash, self) }
end

def update(klass, obj)

def update(klass, obj)
  hash = client.put(klass.put_path(obj), obj.as_hash)
  klass.new(hash, self)
end