Module: Leadcli::Routes

Included in:
ApiCaller
Defined in:
lib/leadcli/routes.rb

Instance Method Summary collapse

Instance Method Details

#create_endpoint(options) ⇒ Object



4
5
6
# File 'lib/leadcli/routes.rb', line 4

def create_endpoint(options)
  [:post, create_url(options)]
end

#create_url(options = {}) ⇒ Object



8
9
10
11
12
# File 'lib/leadcli/routes.rb', line 8

def create_url(options={})
  url = http_scheme.build(base_options.merge(path: create_path))
  url.query = options[:query].map { |k,v| "#{k}=#{v}" }.join('&') if options[:query]
  url.to_s
end

#delete_endpoint(options) ⇒ Object



14
15
16
# File 'lib/leadcli/routes.rb', line 14

def delete_endpoint(options)
  [:delete, delete_url(options)]
end

#delete_url(options) ⇒ Object



18
19
20
21
# File 'lib/leadcli/routes.rb', line 18

def delete_url(options)
  url = http_scheme.build(base_options.merge(path: delete_path(options[:id])))
  url.to_s
end