workmate 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,2 +1,3 @@
1
1
  v0.1.0 first release
2
- v0.1.1 fix application url
2
+ v0.1.1 fix application url
3
+ v0.1.2 fix api url
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('workmate', '0.1.1') do |p|
6
+ Echoe.new('workmate', '0.1.2') do |p|
7
7
  p.description = "Ruby library for Workmate API."
8
8
  p.url = "http://github.com/workmate/workmate-ruby"
9
9
  p.author = "Iskander Haziev"
@@ -2,16 +2,16 @@ require 'json'
2
2
  require 'oauth2'
3
3
  module Workmate
4
4
  class Client
5
- BASE_URL = 'https://workmateapp.com'
6
- API_URL = "#{BASE_URL}/api"
5
+ BASE_URL = 'http://workmateapp.com'
7
6
 
8
7
  def initialize(client_id, client_secret, token = nil, url = BASE_URL)
8
+ @base_url = url
9
9
  @client = OAuth2::Client.new(client_id, client_secret, :site => url)
10
10
  @token = OAuth2::AccessToken.from_hash(@client, access_token: token)
11
11
  end
12
12
 
13
13
  def call(uri)
14
- response = @token.get("#{API_URL}#{uri}.json", parse: :json)
14
+ response = @token.get("#{api_url}#{uri}.json", parse: :json)
15
15
  response.parsed
16
16
  end
17
17
 
@@ -22,5 +22,10 @@ module Workmate
22
22
  def user(user_id)
23
23
  call('/users/' + user_id)
24
24
  end
25
+
26
+ protected
27
+ def api_url
28
+ "#{@base_url}/api"
29
+ end
25
30
  end
26
31
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{workmate}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Iskander Haziev}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
16
- requirement: &2169904140 !ruby/object:Gem::Requirement
16
+ requirement: &2169618360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2169904140
24
+ version_requirements: *2169618360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &2169834880 !ruby/object:Gem::Requirement
27
+ requirement: &2169617540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2169834880
35
+ version_requirements: *2169617540
36
36
  description: Ruby library for Workmate API.
37
37
  email: gvalmon@gmail.com
38
38
  executables: []