Class: Crowi::Client
Instance Method Summary
collapse
-
#delete(path, params = nil, headers = nil) ⇒ Object
-
#get(path, params = nil, headers = nil) ⇒ Object
-
#initialize(base_url: nil, access_token: nil) ⇒ Client
constructor
A new instance of Client.
-
#patch(path, params = nil, headers = nil) ⇒ Object
-
#post(path, params = nil, headers = nil) ⇒ Object
-
#put(path, params = nil, headers = nil) ⇒ Object
-
#send_request(method, path, params = {}, headers = nil) ⇒ Object
Methods included from ApiMethods
#add_attachment, #add_comment, #attachments, #comments, #create_page, #page, #pages, #update_page
Constructor Details
#initialize(base_url: nil, access_token: nil) ⇒ Client
Returns a new instance of Client.
8
9
10
11
|
# File 'lib/crowi/client.rb', line 8
def initialize(base_url: nil, access_token: nil)
@base_url = base_url
@access_token = access_token
end
|
Instance Method Details
#delete(path, params = nil, headers = nil) ⇒ Object
29
30
31
|
# File 'lib/crowi/client.rb', line 29
def delete(path, params = nil, = nil)
send_request(:delete, path, params, )
end
|
#get(path, params = nil, headers = nil) ⇒ Object
13
14
15
|
# File 'lib/crowi/client.rb', line 13
def get(path, params = nil, = nil)
send_request(:get, path, params, )
end
|
#patch(path, params = nil, headers = nil) ⇒ Object
25
26
27
|
# File 'lib/crowi/client.rb', line 25
def patch(path, params = nil, = nil)
send_request(:patch, path, params, )
end
|
#post(path, params = nil, headers = nil) ⇒ Object
17
18
19
|
# File 'lib/crowi/client.rb', line 17
def post(path, params = nil, = nil)
send_request(:post, path, params, )
end
|
#put(path, params = nil, headers = nil) ⇒ Object
21
22
23
|
# File 'lib/crowi/client.rb', line 21
def put(path, params = nil, = nil)
send_request(:put, path, params, )
end
|
#send_request(method, path, params = {}, headers = nil) ⇒ Object
33
34
35
36
37
|
# File 'lib/crowi/client.rb', line 33
def send_request(method, path, params = {}, = nil)
params[:access_token] = @access_token
Crowi::Response.new(connection.send(method, path, params, ))
end
|