Class: ZendeskAPI::Server::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/zendesk_api/server/base.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) '/'(options = {})

Parameters:

  • options (Hash) (defaults to: {})

    Options to pass to the request

  • options (Hash) (defaults to: {})

    Options to pass to the request

Returns:

  • (Boolean)

    Success of this call

  • (Boolean)

    Success of this call



67
68
69
# File 'lib/zendesk_api/server/base.rb', line 67

get '/' do
  haml :index, :format => :html5
end

- (Boolean) '/:object_id'(options = {})

Success of this call

Parameters:

  • options (Hash) (defaults to: {})

    Options to pass to the request

Returns:

  • (Boolean)

    Success of this call



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/zendesk_api/server/base.rb', line 71

get '/:object_id' do
  begin
    @user_request = UserRequest.where(:_id => Moped::BSON::ObjectId(params[:object_id])).first
  rescue Moped::Errors::InvalidObjectId; end

  if @user_request
    params["url"] = @user_request.url
    @path = @user_request.path

    @method = @user_request.method
    @json = @user_request.json
    @url_params = @user_request.url_params

    set_request(@user_request.request) unless @user_request.request.empty?
    set_response(@user_request.response) unless @user_request.response.empty?
  end

  haml :index, :format => :html5
end

- (Boolean) '/search'(options = {})

Success of this call

Parameters:

  • options (Hash) (defaults to: {})

    Options to pass to the request

Returns:

  • (Boolean)

    Success of this call



91
92
93
94
95
96
97
# File 'lib/zendesk_api/server/base.rb', line 91

post '/search' do
  if md = settings.documentation[params[:query]]
    md[:body]
  else
    settings.help
  end
end