odesk-api 0.1.6 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/example/myapp.rb CHANGED
@@ -4,18 +4,19 @@ $:.unshift '../lib'
4
4
 
5
5
  $LOAD_PATH << File.dirname(__FILE__)
6
6
 
7
- require 'json'
8
7
  require 'odesk/api'
9
8
  require 'odesk/api/routers/auth'
10
9
  require 'odesk/api/routers/mc'
11
10
  require 'odesk/api/routers/reports/time'
11
+ require 'odesk/api/routers/freelancers/search'
12
+ #require 'pry'
12
13
 
13
14
  # initiate config
14
15
  config = Odesk::Api::Config.new({
15
- 'consumer_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
16
- 'consumer_secret' => 'xxxxxxxxxxxxxxxx',
17
- #'access_token' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',# assign if known
18
- #'access_secret' => 'xxxxxxxxxxxxxxxx',# assign if known
16
+ 'consumer_key' => 'xxxxxxxx',
17
+ 'consumer_secret' => 'xxxxxxxx',
18
+ 'access_token' => 'xxxxxxxx',# assign if known
19
+ 'access_secret' => 'xxxxxxxx',# assign if known
19
20
  #'debug' => false
20
21
  })
21
22
 
@@ -30,28 +31,29 @@ if !config.access_token and !config.access_secret
30
31
  puts "Visit the authorization url and provide oauth_verifier for further authorization"
31
32
  puts authz_url
32
33
  verifier = gets.strip
33
-
34
34
  @token = client.get_access_token(verifier)
35
35
  # store access token data in safe place!
36
36
  end
37
37
 
38
38
  # get my auth data
39
39
  auth = Odesk::Api::Routers::Auth.new(client)
40
- response = auth.get_user_info
41
-
42
- info = JSON.parse(response)
40
+ info = auth.get_user_info
43
41
 
44
42
  # work with mc
45
43
  mc = Odesk::Api::Routers::Mc.new(client)
46
- response = mc.get_trays
44
+ mc_response = mc.get_trays
47
45
 
48
46
  # mark the thread
49
47
  #response = mc.mark_thread 'username', '88888', {'read' => 'false'}
50
- mc = JSON.parse(response)
51
48
 
52
49
  report = Odesk::Api::Routers::Reports::Time.new(client)
53
- rdata = report.get_by_freelancer_limited('mnovozhilov', {'tqx' => 'out:json', 'tq' => "select task where worked_on >= '2014-06-01' AND worked_on <= '2014-06-03' order by worked_on"})
50
+ report_response = report.get_by_freelancer_limited('mnovozhilov', {'tqx' => 'out:json', 'tq' => "select task where worked_on >= '2014-06-01' AND worked_on <= '2014-06-03' order by worked_on"})
51
+
52
+ p info['info']['portrait_32_img'], mc_response['trays'], report_response
54
53
 
55
- data = JSON.parse(rdata)
54
+ params = {'q' => 'python'}
55
+ freelancers = Odesk::Api::Routers::Freelancers::Search.new(client)
56
+ p freelancers.find(params)
56
57
 
57
- p info['info']['portrait_32_img'], mc['trays'], data
58
+ # Start REPL session
59
+ #binding.pry
@@ -11,6 +11,7 @@
11
11
  # Copyright:: Copyright 2014(c) oDesk.com
12
12
  # License:: See LICENSE.txt and TOS - http://developers.odesk.com/API-Terms-of-Use
13
13
 
14
+ require 'json'
14
15
  require 'uri'
15
16
 
16
17
 
@@ -154,7 +155,7 @@ module Odesk
154
155
  raise ArgumentError, "Don't know how to handle http method: :#{method.to_s}"
155
156
  end
156
157
  $LOG.i "got response from server", response
157
- response
158
+ JSON.parse(response)
158
159
  end
159
160
 
160
161
  end
@@ -13,6 +13,6 @@
13
13
 
14
14
  module Odesk # :nodoc:
15
15
  module Api
16
- VERSION = "0.1.6"
16
+ VERSION = "0.2.1"
17
17
  end
18
18
  end
data/odesk-api.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "http://developers.odesk.com"
14
14
  spec.license = "Apache-2.0"
15
15
 
16
- spec.add_dependency('oauth', '>= 0.4.7')
16
+ spec.add_dependency 'oauth', '>= 0.4.7'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0")
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odesk-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: