Module: Qiitan::API::Items

Included in:
Client
Defined in:
lib/qiitan/api/items.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



18
19
20
21
# File 'lib/qiitan/api/items.rb', line 18

def delete
	url = "#{API_BASE_URL}items/#{uuid}?token=#{@token}"
	res = Qiitan::HTTP.request(url, :delete, true)
end

#get_newly_postObject



23
24
25
26
27
28
# File 'lib/qiitan/api/items.rb', line 23

def get_newly_post
	url = "#{API_BASE_URL}items?token=#{@token}"
	res = Qiitan::HTTP.request(url, :get, true)

	JSON.parse res.body
end

#post(payload) ⇒ Object

Args

Hash



8
9
10
11
12
13
14
15
16
# File 'lib/qiitan/api/items.rb', line 8

def post(payload)
	url = "#{API_BASE_URL}items?token=#{@token}"
	res = Qiitan::HTTP.request(url, :post, true) do |req|
		req['Content-Type'] = 'application/json'
		req.body = payload
	end

	JSON.parse res.body
end