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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73eb5f8da96a607d4340eebefbcddd7b26c468cf
4
- data.tar.gz: bd8cafeef9fd121b4cbd6a12a3779fed3ef8956a
3
+ metadata.gz: b991c3ff24d08f39bf230931835ed0efa6910fca
4
+ data.tar.gz: d9101ba5aedc1c31884e8862c2317ceccd6d858c
5
5
  SHA512:
6
- metadata.gz: 216c6d0a4fa709fe938916bd4031e2922c57341682e8727c34531fccb7055965db14f15406dcc889c4996daf80d87f461f8473d48004e31ea44e5ec512da21da
7
- data.tar.gz: 0c8f340f47acaa2b79bcd68c22023d53c0b94499c70837d63c0cf6c2636a2bd5a3367d26fb4b9cd918d621ade286b5f29dcb1706febe018460371670ec249646
6
+ metadata.gz: 91149181a03c3f0c21faef0be928387ac70e191fb9de1fd89d8d0c71a8f380c615c8cebbbc8b4fe15c3cd8ae37fe482d76a524da0fc807f2e0f2df39dedf2644
7
+ data.tar.gz: 720ff6a6bfa6dfac5a0f6ee85915790d08796e0dc5bbd7fbac5c1b9763d4d6f372619ae6c36da90bcd5bb744b99415a03d296117bae8e61c5c9392182efe6085
data/README.md CHANGED
@@ -7,7 +7,7 @@ This gem is to communicate through Wrike.com API
7
7
 
8
8
  Add to your Gemfile:
9
9
 
10
- <pre><code>gem 'wrike3', :github => 'morshedalam/wrike3'</code></pre>
10
+ <pre><code>gem 'wrike3'</code></pre>
11
11
 
12
12
  Then run:
13
13
 
@@ -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
- "#{Wrike3.protocol}://#{Wrike3.api_host}/api/#{Wrike3.api_version}"
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, query: parameters, headers: request_headers)
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
@@ -1,3 +1,3 @@
1
1
  module Wrike3
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrike3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morshed Alam