wrike3 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/wrike3/base.rb +15 -2
- data/lib/wrike3/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b991c3ff24d08f39bf230931835ed0efa6910fca
|
4
|
+
data.tar.gz: d9101ba5aedc1c31884e8862c2317ceccd6d858c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91149181a03c3f0c21faef0be928387ac70e191fb9de1fd89d8d0c71a8f380c615c8cebbbc8b4fe15c3cd8ae37fe482d76a524da0fc807f2e0f2df39dedf2644
|
7
|
+
data.tar.gz: 720ff6a6bfa6dfac5a0f6ee85915790d08796e0dc5bbd7fbac5c1b9763d4d6f372619ae6c36da90bcd5bb744b99415a03d296117bae8e61c5c9392182efe6085
|
data/README.md
CHANGED
data/lib/wrike3/base.rb
CHANGED
@@ -9,9 +9,13 @@ module Wrike3
|
|
9
9
|
Wrike3.access_token = options.fetch(:access_token) { '' }
|
10
10
|
end
|
11
11
|
|
12
|
+
def site_url
|
13
|
+
"#{Wrike3.protocol}://#{Wrike3.api_host}"
|
14
|
+
end
|
15
|
+
|
12
16
|
# Returns the base url used in all Wrike API calls
|
13
17
|
def base_url
|
14
|
-
"#{
|
18
|
+
"#{site_url}/api/#{Wrike3.api_version}"
|
15
19
|
end
|
16
20
|
|
17
21
|
def account
|
@@ -61,9 +65,18 @@ module Wrike3
|
|
61
65
|
|
62
66
|
def execute(method, url, parameters = {}, request_headers = {}, include_auth_header = true)
|
63
67
|
request_headers = self.auth_headers(request_headers) if include_auth_header
|
64
|
-
response = HTTParty.send(method.to_s, url,
|
68
|
+
response = HTTParty.send(method.to_s, build_query_with_url(url, parameters), headers: request_headers)
|
65
69
|
response.parsed_response
|
66
70
|
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def build_query_with_url(url, parameters = {})
|
75
|
+
query = []
|
76
|
+
parameters.each { |item| query << "#{item.first.to_s}=#{item.last.to_s}" }
|
77
|
+
url = "#{url}?#{query.join('&')}" if query.any?
|
78
|
+
URI.parse(URI.encode(url))
|
79
|
+
end
|
67
80
|
end
|
68
81
|
|
69
82
|
class << self
|
data/lib/wrike3/version.rb
CHANGED