cloudpt-api 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,8 @@ module Cloudpt
|
|
9
9
|
response = yield
|
10
10
|
raise Cloudpt::API::Error::ConnectionFailed if !response
|
11
11
|
status = response.code.to_i
|
12
|
-
puts "STATUS:#{status}"
|
13
|
-
puts "PAYLOAD:\n#{response.body}"
|
12
|
+
#puts "STATUS:#{status}"
|
13
|
+
#puts "PAYLOAD:\n#{response.body}"
|
14
14
|
case status
|
15
15
|
when 401
|
16
16
|
raise Cloudpt::API::Error::Unauthorized
|
@@ -35,7 +35,7 @@ module Cloudpt
|
|
35
35
|
|
36
36
|
def get_raw(endpoint, path, data = {}, headers = {})
|
37
37
|
query = Cloudpt::API::Util.query(data)
|
38
|
-
puts "GET #{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}"
|
38
|
+
#puts "GET #{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}"
|
39
39
|
request(:raw => true) do
|
40
40
|
token(endpoint).get "#{Cloudpt::API::Config.prefix}#{path}?#{URI.parse(URI.encode(query))}", headers
|
41
41
|
end
|
@@ -44,23 +44,23 @@ module Cloudpt
|
|
44
44
|
def get(endpoint, path, data = {}, headers = {})
|
45
45
|
query = Cloudpt::API::Util.query(data)
|
46
46
|
query = "?#{URI.parse(URI.encode(query))}" unless query.empty?
|
47
|
-
puts "GET #{Cloudpt::API::Config.prefix}#{path}#{query}"
|
47
|
+
#puts "GET #{Cloudpt::API::Config.prefix}#{path}#{query}"
|
48
48
|
request do
|
49
49
|
token(endpoint).get "#{Cloudpt::API::Config.prefix}#{path}#{query}", headers
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def post(endpoint, path, data = {}, headers = {})
|
54
|
-
puts "POST #{Cloudpt::API::Config.prefix}#{path}"
|
55
|
-
puts "BODY:\n#{data}"
|
54
|
+
#puts "POST #{Cloudpt::API::Config.prefix}#{path}"
|
55
|
+
#puts "BODY:\n#{data}"
|
56
56
|
request do
|
57
57
|
token(endpoint).post "#{Cloudpt::API::Config.prefix}#{path}", data, headers
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
def put(endpoint, path, data = {}, headers = {})
|
62
|
-
puts "PUT #{Cloudpt::API::Config.prefix}#{path}"
|
63
|
-
puts "BODY:\n#{data}"
|
62
|
+
#puts "PUT #{Cloudpt::API::Config.prefix}#{path}"
|
63
|
+
#puts "BODY:\n#{data}"
|
64
64
|
request do
|
65
65
|
token(endpoint).put "#{Cloudpt::API::Config.prefix}#{path}", data, headers
|
66
66
|
end
|
data/lib/cloudpt-api/version.rb
CHANGED