class Freshsales::RequestBuilder
Public Class Methods
new(client)
click to toggle source
# File lib/freshsales/request_builder.rb, line 5 def initialize(client) @client = client @httpmethods = %i[get put post delete] @path_parts = [] end
Public Instance Methods
get_all(*args)
click to toggle source
# File lib/freshsales/request_builder.rb, line 16 def get_all(*args) Cursor.new(@client, path, :elt, @path_parts[0], *args) end
get_all_pages(*args)
click to toggle source
# File lib/freshsales/request_builder.rb, line 12 def get_all_pages(*args) Cursor.new(@client, path, :page, @path_parts[0], *args) end
method_missing(method, *args)
click to toggle source
rubocop:disable Style/MethodMissing
# File lib/freshsales/request_builder.rb, line 21 def method_missing(method, *args) if @httpmethods.include? method @client.httprequest(method.to_s, path, *args) else @path_parts << method.to_s args.each do |arg| @path_parts << arg end self end end
respond_to_missing?(_method_name, _include_private = false)
click to toggle source
rubocop:enable Style/MethodMissing
# File lib/freshsales/request_builder.rb, line 34 def respond_to_missing?(_method_name, _include_private = false) true end
Private Instance Methods
path()
click to toggle source
# File lib/freshsales/request_builder.rb, line 40 def path "/api/#{@path_parts.join('/')}" end