ruby-upwork-oauth2 2.0.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.tests +1 -0
- data/.travis.yml +0 -1
- data/CHANGES.md +21 -0
- data/README.md +7 -7
- data/lib/upwork/api/client.rb +3 -2
- data/lib/upwork/api/routers/activities/engagement.rb +2 -2
- data/lib/upwork/api/routers/messages.rb +23 -2
- data/lib/upwork/api/routers/metadata.rb +12 -0
- data/lib/upwork/api/routers/snapshot.rb +3 -3
- data/lib/upwork/api/routers/workdays.rb +2 -2
- data/lib/upwork/api/routers/workdiary.rb +11 -1
- data/lib/upwork/api/version.rb +1 -1
- data/ruby-upwork-oauth2.gemspec +1 -1
- data/test/test_messages.rb +10 -0
- data/test/test_metadata.rb +10 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae0c55c23aa24352c0f7abbb6e8997c9ddd9a569f18e51073d677ee1db27de56
|
4
|
+
data.tar.gz: 1146d2241c4ef5309dcbfa9437cfe07531e72c5c61b5fbf1188a7279802e4ac1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7de51dee4754a23762d8641acb725641838942563bcef8389058db5dd915e624105242d5266c932d833c85ebdd3c085b7ccfd57369eace355d8640aac135e4b0
|
7
|
+
data.tar.gz: '064596e784a903ca8415a130a9df988ead4082dbe6ac2037dc6cbd55d9920f1dd6f97e979604070c8a761a55250579f203e7278456cea262c555dda69773e483'
|
data/.tests
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rake test
|
data/.travis.yml
CHANGED
data/CHANGES.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Release History
|
2
|
+
|
3
|
+
## 2.1.3
|
4
|
+
* Send Message to a Batch of Rooms API
|
5
|
+
|
6
|
+
## 2.1.2
|
7
|
+
* Add Room Messages API
|
8
|
+
* Sync-up routers with OAuth1 version
|
9
|
+
|
10
|
+
## 2.2.1
|
11
|
+
* Resolve a vulnarable dependency
|
12
|
+
|
13
|
+
## 2.1.0
|
14
|
+
* Add Specialties API
|
15
|
+
* Add Skills V2 API
|
16
|
+
|
17
|
+
## 2.0.1
|
18
|
+
* Set library User-Agent
|
19
|
+
|
20
|
+
## 2.0.0
|
21
|
+
* Release ruby-upwork-oauth2
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Ruby bindings for Upwork API (OAuth2)
|
2
2
|
============
|
3
3
|
|
4
|
-
[](https://github.com/upwork/ruby-upwork/releases)
|
7
|
-
[](https://travis-ci.org/upwork/ruby-upwork)
|
8
|
-
[](http://waffle.io/upwork/ruby-upwork)
|
4
|
+
[](http://www.apache.org/licenses/LICENSE-2.0.html)
|
5
|
+
[](http://badge.fury.io/rb/ruby-upwork-oauth2)
|
6
|
+
[](https://github.com/upwork/ruby-upwork-oauth2/releases)
|
7
|
+
[](https://travis-ci.org/upwork/ruby-upwork-oauth2)
|
8
|
+
[](http://waffle.io/upwork/ruby-upwork-oauth2)
|
9
9
|
|
10
10
|
# Upwork::Api
|
11
11
|
|
@@ -60,7 +60,7 @@ To integrate this library you need to have:
|
|
60
60
|
|
61
61
|
Add this line to your application's Gemfile:
|
62
62
|
|
63
|
-
gem 'upwork-
|
63
|
+
gem 'ruby-upwork-oauth2'
|
64
64
|
|
65
65
|
And then execute:
|
66
66
|
|
@@ -68,7 +68,7 @@ And then execute:
|
|
68
68
|
|
69
69
|
Or install it yourself as:
|
70
70
|
|
71
|
-
$ gem install upwork-
|
71
|
+
$ gem install ruby-upwork-oauth2
|
72
72
|
|
73
73
|
## Usage
|
74
74
|
|
data/lib/upwork/api/client.rb
CHANGED
@@ -43,7 +43,8 @@ module Upwork
|
|
43
43
|
@config.client_secret,
|
44
44
|
:site => Upwork::Api::BASE_HOST,
|
45
45
|
:authorize_url => @url_auth,
|
46
|
-
:token_url => @url_atoken
|
46
|
+
:token_url => @url_atoken,
|
47
|
+
:connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}
|
47
48
|
)
|
48
49
|
end
|
49
50
|
|
@@ -137,7 +138,7 @@ module Upwork
|
|
137
138
|
|
138
139
|
# get url with parameters for get requests
|
139
140
|
def get_url_with_params(path, params)
|
140
|
-
"#{path}?".concat(params.collect{|k,v| "#{k}=#{
|
141
|
+
"#{path}?".concat(params.collect{|k,v| "#{k}=#{URI::escape(v.to_s)}"}.join("&"))
|
141
142
|
end
|
142
143
|
|
143
144
|
# Send request
|
@@ -44,7 +44,7 @@ module Upwork
|
|
44
44
|
# engagement: (String)
|
45
45
|
# params: (Hash)
|
46
46
|
def assign(company, team, engagement, params)
|
47
|
-
@client.put '/otask/v1/tasks/companies/' + company + '/' + team + '/engagements/' + engagement, params
|
47
|
+
@client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/engagements/' + engagement + '/tasks', params
|
48
48
|
end
|
49
49
|
|
50
50
|
# Assign to specific engagement the list of activities
|
@@ -53,7 +53,7 @@ module Upwork
|
|
53
53
|
# engagement_ref: (String)
|
54
54
|
# params: (Hash)
|
55
55
|
def assign_to_engagement(engagement_ref, params)
|
56
|
-
@client.put '/tasks/v2/tasks/contracts/' + engagement_ref
|
56
|
+
@client.put '/tasks/v2/tasks/contracts/' + engagement_ref, params
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -47,6 +47,17 @@ module Upwork
|
|
47
47
|
@client.get '/messages/v3/' + company + '/rooms/' + room_id, params
|
48
48
|
end
|
49
49
|
|
50
|
+
# Get messages from a specific room
|
51
|
+
#
|
52
|
+
# Arguments:
|
53
|
+
# company: (String)
|
54
|
+
# room_id: (String)
|
55
|
+
# params: (Hash)
|
56
|
+
def get_room_messages(company, room_id, params = {})
|
57
|
+
$LOG.i "running " + __method__.to_s
|
58
|
+
@client.get '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params
|
59
|
+
end
|
60
|
+
|
50
61
|
# Get a specific room by offer ID
|
51
62
|
#
|
52
63
|
# Arguments:
|
@@ -89,7 +100,7 @@ module Upwork
|
|
89
100
|
$LOG.i "running " + __method__.to_s
|
90
101
|
@client.post '/messages/v3/' + company + '/rooms', params
|
91
102
|
end
|
92
|
-
|
103
|
+
|
93
104
|
# Send a message to a room
|
94
105
|
#
|
95
106
|
# Arguments:
|
@@ -100,7 +111,17 @@ module Upwork
|
|
100
111
|
$LOG.i "running " + __method__.to_s
|
101
112
|
@client.post '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params
|
102
113
|
end
|
103
|
-
|
114
|
+
|
115
|
+
# Send a message to a batch of rooms
|
116
|
+
#
|
117
|
+
# Arguments:
|
118
|
+
# company: (String)
|
119
|
+
# params: (Hash)
|
120
|
+
def send_message_to_rooms(company, params = {})
|
121
|
+
$LOG.i "running " + __method__.to_s
|
122
|
+
@client.post '/messages/v3/' + company + '/stories/batch', params
|
123
|
+
end
|
124
|
+
|
104
125
|
# Update a room settings
|
105
126
|
#
|
106
127
|
# Arguments:
|
@@ -39,6 +39,18 @@ module Upwork
|
|
39
39
|
@client.get '/profiles/v1/metadata/skills'
|
40
40
|
end
|
41
41
|
|
42
|
+
# Get skills V2
|
43
|
+
def get_skills_v2(params)
|
44
|
+
$LOG.i "running " + __method__.to_s
|
45
|
+
@client.get '/profiles/v2/metadata/skills'
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get specialties
|
49
|
+
def get_specialties
|
50
|
+
$LOG.i "running " + __method__.to_s
|
51
|
+
@client.get '/profiles/v1/metadata/specialties'
|
52
|
+
end
|
53
|
+
|
42
54
|
# Get regions
|
43
55
|
def get_regions
|
44
56
|
$LOG.i "running " + __method__.to_s
|
@@ -34,7 +34,7 @@ module Upwork
|
|
34
34
|
# ts: (String)
|
35
35
|
def get_by_contract(contract, ts)
|
36
36
|
$LOG.i "running " + __method__.to_s
|
37
|
-
@client.get '/team/
|
37
|
+
@client.get '/team/v3/snapshots/contracts/' + contract + '/' + ts
|
38
38
|
end
|
39
39
|
|
40
40
|
# Update snapshot by specific contract
|
@@ -45,7 +45,7 @@ module Upwork
|
|
45
45
|
# params: (Hash)
|
46
46
|
def update_by_contract(contract, ts, params)
|
47
47
|
$LOG.i "running " + __method__.to_s
|
48
|
-
@client.put '/team/
|
48
|
+
@client.put '/team/v3/snapshots/contracts/' + contract + '/' + ts, params
|
49
49
|
end
|
50
50
|
|
51
51
|
# Delete snapshot by specific contract
|
@@ -54,7 +54,7 @@ module Upwork
|
|
54
54
|
# ts: (String)
|
55
55
|
def delete_by_contract(contract, ts)
|
56
56
|
$LOG.i "running " + __method__.to_s
|
57
|
-
@client.delete '/team/
|
57
|
+
@client.delete '/team/v3/snapshots/contracts/' + contract + '/' + ts
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -35,7 +35,7 @@ module Upwork
|
|
35
35
|
# params: (Hash)
|
36
36
|
def get_by_company(company, from_date, till_date, params = {})
|
37
37
|
$LOG.i "running " + __method__.to_s
|
38
|
-
@client.get '/team/
|
38
|
+
@client.get '/team/v3/workdays/companies/' + company + '/' + from_date + ',' + till_date, params
|
39
39
|
end
|
40
40
|
|
41
41
|
# Get Workdays by Contract
|
@@ -46,7 +46,7 @@ module Upwork
|
|
46
46
|
# params: (Hash)
|
47
47
|
def get_by_contract(contract, from_date, till_date, params = {})
|
48
48
|
$LOG.i "running " + __method__.to_s
|
49
|
-
@client.get '/team/
|
49
|
+
@client.get '/team/v3/workdays/contracts/' + contract + '/' + from_date + ',' + till_date, params
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -27,6 +27,16 @@ module Upwork
|
|
27
27
|
@client.epoint = ENTRY_POINT
|
28
28
|
end
|
29
29
|
|
30
|
+
# Get Workdiary by Company
|
31
|
+
# Arguments:
|
32
|
+
# company: (String)
|
33
|
+
# date: (String)
|
34
|
+
# params: (Hash)
|
35
|
+
def get(company, date, params = {})
|
36
|
+
$LOG.i "running " + __method__.to_s
|
37
|
+
@client.get '/team/v3/workdiaries/companies/' + company + '/' + date, params
|
38
|
+
end
|
39
|
+
|
30
40
|
# Get Work Diary by Contract
|
31
41
|
# Arguments:
|
32
42
|
# contract: (String)
|
@@ -34,7 +44,7 @@ module Upwork
|
|
34
44
|
# params: (Hash)
|
35
45
|
def get_by_contract(contract, date, params = {})
|
36
46
|
$LOG.i "running " + __method__.to_s
|
37
|
-
@client.get '/team/
|
47
|
+
@client.get '/team/v3/workdiaries/contracts/' + contract + '/' + date, params
|
38
48
|
end
|
39
49
|
end
|
40
50
|
end
|
data/lib/upwork/api/version.rb
CHANGED
data/ruby-upwork-oauth2.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
-
spec.add_development_dependency "rake", "
|
24
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
25
25
|
spec.add_development_dependency "mocha", "~> 0"
|
26
26
|
spec.add_development_dependency "test-unit", "~> 0"
|
27
27
|
end
|
data/test/test_messages.rb
CHANGED
@@ -19,6 +19,11 @@ class MessagesTest < Test::Unit::TestCase
|
|
19
19
|
assert api.get_room_details('company', 'room-id', {})
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_get_room_messages
|
23
|
+
api = Upwork::Api::Routers::Messages.new(get_client_mock)
|
24
|
+
assert api.get_room_messages('company', 'room-id', {})
|
25
|
+
end
|
26
|
+
|
22
27
|
def test_get_room_by_offer
|
23
28
|
api = Upwork::Api::Routers::Messages.new(get_client_mock)
|
24
29
|
assert api.get_room_by_offer('company', '1234', {})
|
@@ -44,6 +49,11 @@ class MessagesTest < Test::Unit::TestCase
|
|
44
49
|
assert api.send_message_to_room('company', 'room-id', {})
|
45
50
|
end
|
46
51
|
|
52
|
+
def test_send_message_to_rooms
|
53
|
+
api = Upwork::Api::Routers::Messages.new(get_client_mock)
|
54
|
+
assert api.send_message_to_rooms('company', {})
|
55
|
+
end
|
56
|
+
|
47
57
|
def test_update_room_settings
|
48
58
|
api = Upwork::Api::Routers::Messages.new(get_client_mock)
|
49
59
|
assert api.update_room_settings('company', 'room-id', 'username', {})
|
data/test/test_metadata.rb
CHANGED
@@ -24,6 +24,16 @@ class MetadataTest < Test::Unit::TestCase
|
|
24
24
|
assert api.get_skills
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_get_skills_v2
|
28
|
+
api = Upwork::Api::Routers::Metadata.new(get_client_mock)
|
29
|
+
assert api.get_skills_v2({})
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_get_specialties
|
33
|
+
api = Upwork::Api::Routers::Metadata.new(get_client_mock)
|
34
|
+
assert api.get_specialties
|
35
|
+
end
|
36
|
+
|
27
37
|
def test_get_categories_v2
|
28
38
|
api = Upwork::Api::Routers::Metadata.new(get_client_mock)
|
29
39
|
assert api.get_categories_v2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-upwork-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maksym Novozhylov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,9 @@ extra_rdoc_files: []
|
|
90
90
|
files:
|
91
91
|
- ".docgen"
|
92
92
|
- ".gitignore"
|
93
|
+
- ".tests"
|
93
94
|
- ".travis.yml"
|
95
|
+
- CHANGES.md
|
94
96
|
- Gemfile
|
95
97
|
- LICENSE.txt
|
96
98
|
- README.md
|
@@ -187,8 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
189
|
- !ruby/object:Gem::Version
|
188
190
|
version: '0'
|
189
191
|
requirements: []
|
190
|
-
|
191
|
-
rubygems_version: 2.7.6
|
192
|
+
rubygems_version: 3.1.2
|
192
193
|
signing_key:
|
193
194
|
specification_version: 4
|
194
195
|
summary: Ruby bindings for Upwork API (OAuth2).
|