module Stir::Endpoints::ClassMethods

Public Instance Methods

delete(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 34
def delete(name, &block)
  endpoint(name, :delete, &block)
end
get(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 18
def get(name, &block)
  endpoint(name, :get, &block)
end
head(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 30
def head(name, &block)
  endpoint(name, :head, &block)
end
patch(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 38
def patch(name, &block)
  endpoint(name, :patch, &block)
end
post(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 26
def post(name, &block)
  endpoint(name, :post, &block)
end
put(name, &block) click to toggle source
# File lib/stir/rest/endpoints.rb, line 22
def put(name, &block)
  endpoint(name, :put, &block)
end

Private Instance Methods

endpoint(name, method) { || ... } click to toggle source
# File lib/stir/rest/endpoints.rb, line 43
def endpoint(name, method, &block)
  send(:define_method, name) do |*args|
    @response = HTTParty.send(method, yield.interpolate(args.first), merge_configs(args.flatten.first))
  end
  endpoints.push({name => yield.to_s})
end
endpoints() click to toggle source
# File lib/stir/rest/endpoints.rb, line 50
def endpoints
  @endpoints ||= []
end