proz 0.2.0 → 0.3.0
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/README.md +148 -4
- data/lib/proz/version.rb +1 -1
- data/lib/proz/wiwo_entries.rb +5 -5
- data/lib/proz/wiwo_reply.rb +22 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40b3104e7d826fc8a20eae3297d5ccecb4893643
|
4
|
+
data.tar.gz: 3541b3ac232b3fac4a925bc11c65878b6aef6d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca80ec7a09ccc6b792489f3af34e69fbb2c73ae8d86b2af1ba3cd603fc1108b4c4ff1371e878bf29c35a74705bc613abc4671857fb3d9670e056f844dba01fcb
|
7
|
+
data.tar.gz: 67f51368ef8ae3966845bcab22969aa76f7b214d1bf7579fb5a3f90f9d3683620021e2e2eff68e654b5c5f00e39c0d9139728d7aa6676791b4a146610512fee0
|
data/README.md
CHANGED
@@ -20,9 +20,9 @@ gem 'proz'
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
### Directory Service API
|
24
24
|
|
25
|
-
|
25
|
+
#### Freelancer
|
26
26
|
|
27
27
|
Get a representation of a single freelancer by providing that freelancer's [uuid](http://www.proz.com/api-docs/formats/uuid). The uuid is not provided publicly by ProZ so you have to obtain it either through the Freelancer Match API or the OAuth2 API.
|
28
28
|
|
@@ -41,7 +41,7 @@ freelancer.site_name
|
|
41
41
|
|
42
42
|
Further details for each method can be found in the [ProZ API Specification](http://www.proz.com/api-docs/types/freelancer).
|
43
43
|
|
44
|
-
|
44
|
+
#### Freelancer Matches
|
45
45
|
|
46
46
|
Get freelancers that match a set of criteria. A [language pair](http://www.proz.com/api-docs/formats/language-pair) is required for this query. The language pair code should be in the form of a source language code, an underscore, and a target language code. The language codes are a variation of an earlier version of the ISO 639-2 standard, so please check the [ProZ language code](http://www.proz.com/api-docs/codes/language) list to make sure you have the correct language code.
|
47
47
|
|
@@ -57,7 +57,151 @@ fm.freelancer_matches[0]['freelancer']['uuid']
|
|
57
57
|
# => 'b9eade6d-33ac-4c7d-b6f1-42905375fc0b'
|
58
58
|
```
|
59
59
|
|
60
|
-
####
|
60
|
+
#### WIWO (What I'm Working On)
|
61
|
+
|
62
|
+
GET WIWO data
|
63
|
+
|
64
|
+
Note that all referenced users are included in the response (using "side loading").
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
wiwo = Proz::WiwoEntries.new(key: 'yourAPIkey')
|
68
|
+
wiwo.entries
|
69
|
+
|
70
|
+
# => {
|
71
|
+
# "_links": {
|
72
|
+
# "self": {
|
73
|
+
# "href": "https://api.proz.com/v2/wiwo"
|
74
|
+
# },
|
75
|
+
# "next": {
|
76
|
+
# "href": "https://api.proz.com/v2/wiwo?page=2"
|
77
|
+
# },
|
78
|
+
# "prev": {
|
79
|
+
# "href": null
|
80
|
+
# }
|
81
|
+
# },
|
82
|
+
# "wiwos": [
|
83
|
+
# {
|
84
|
+
# "id": 110,
|
85
|
+
# "self_link": "https://api.proz.com/v2/wiwo/110",
|
86
|
+
# "time": "2016-07-12T15:51:10+00:00",
|
87
|
+
# "user_eid": 1943273,
|
88
|
+
# "user_link": "https://api.proz.com/v2/users/fcfc20dc-bac6-41bd-8dbe-897e5aeefaac",
|
89
|
+
# "message": "Law-related articles from Arabic to Italian. About 30k words. Really demanding!",
|
90
|
+
# "message_language": null,
|
91
|
+
# "source_language": null,
|
92
|
+
# "target_language": null,
|
93
|
+
# "wordcount": null,
|
94
|
+
# "disc_gen_id": null,
|
95
|
+
# "disc_spec_id": null,
|
96
|
+
# "discipline": null,
|
97
|
+
# "cat_tool": null,
|
98
|
+
# "public": true,
|
99
|
+
# "num_replies": 3,
|
100
|
+
# "replies": [
|
101
|
+
# {
|
102
|
+
# "id": 1,
|
103
|
+
# "wiwo_id": 110,
|
104
|
+
# "wiwo_link": "https://api.proz.com/v2/wiwo/110",
|
105
|
+
# "time": "2016-07-11T19:02:54+00:00",
|
106
|
+
# "user_eid": 41429,
|
107
|
+
# "user_link": "https://api.proz.com/v2/users/32a9a4d0-cb6e-463f-a0ab-63d0a0418bc7",
|
108
|
+
# "message": "Test wiwo reply",
|
109
|
+
# "message_language": null
|
110
|
+
# },
|
111
|
+
# {
|
112
|
+
# "id": 2,
|
113
|
+
# "wiwo_id": 110,
|
114
|
+
# "wiwo_link": "https://api.proz.com/v2/wiwo/110",
|
115
|
+
# "time": "2016-07-11T19:03:38+00:00",
|
116
|
+
# "user_eid": 41429,
|
117
|
+
# "user_link": "https://api.proz.com/v2/users/32a9a4d0-cb6e-463f-a0ab-63d0a0418bc7",
|
118
|
+
# "message": "Test wiwo reply",
|
119
|
+
# "message_language": null
|
120
|
+
# },
|
121
|
+
# {
|
122
|
+
# "id": 3,
|
123
|
+
# "wiwo_id": 110,
|
124
|
+
# "wiwo_link": "https://api.proz.com/v2/wiwo/110",
|
125
|
+
# "time": "2016-07-11T19:04:48+00:00",
|
126
|
+
# "user_eid": 41429,
|
127
|
+
# "user_link": "https://api.proz.com/v2/users/32a9a4d0-cb6e-463f-a0ab-63d0a0418bc7",
|
128
|
+
# "message": "Test wiwo reply",
|
129
|
+
# "message_language": null
|
130
|
+
# }
|
131
|
+
# ]
|
132
|
+
# },
|
133
|
+
# { ... }
|
134
|
+
# ],
|
135
|
+
# "users": [
|
136
|
+
# {
|
137
|
+
# "self_link": "https://api.proz.com/v2/users/3f9f64e5-5ef7-4641-98aa-df01a228f44c",
|
138
|
+
# "uuid": "3f9f64e5-5ef7-4641-98aa-df01a228f44c",
|
139
|
+
# "site_name": "Alice Wolfe, DDS",
|
140
|
+
# "account_type": 2,
|
141
|
+
# "freelancer_profile_link": "https://api.proz.com/v2/freelancer/3f9f64e5-5ef7-4641-98aa-df01a228f44c",
|
142
|
+
# "profile_url": "http://www.proz.com/profile/610",
|
143
|
+
# "image_url": "https://static-ssl.proz.com/profile_resources/610_r4cd97b7149061.jpg",
|
144
|
+
# "is_proz_member": true,
|
145
|
+
# "proz_membership_type": "individual",
|
146
|
+
# "is_cpn": true,
|
147
|
+
# "cpn_language_pair": "eng_dan",
|
148
|
+
# "native_languages": [
|
149
|
+
# "dan"
|
150
|
+
# ],
|
151
|
+
# "timezone": "America/New_York",
|
152
|
+
# "country": "us",
|
153
|
+
# "skype": "awolfe"
|
154
|
+
# },
|
155
|
+
# { ... }
|
156
|
+
# ]
|
157
|
+
# }
|
158
|
+
```
|
159
|
+
|
160
|
+
POST WIWO
|
161
|
+
|
162
|
+
Uses OAuth2 with the `wiwo.post` default scope. Use the [omniauth-proz](https://github.com/diasks2/omniauth-proz) gem to easily authenticate.
|
163
|
+
|
164
|
+
Send a JSON object with the following fields. Only the "message" is required.
|
165
|
+
* message (string) - a plain text message.
|
166
|
+
* message_language (string) - a 3-character language code for the message.
|
167
|
+
* source_language (string) - a 3-character language code for the source
|
168
|
+
* target_language (string)
|
169
|
+
* discipline (string) - a free-text discipline
|
170
|
+
* wordcount (int) - the number of words completed
|
171
|
+
* public (boolean) - whether or not the status update should be publicly visible.
|
172
|
+
* cat_tool (string) - A free-text name of the CAT tool in use, if any.
|
173
|
+
|
174
|
+
```
|
175
|
+
Proz::WiwoEntry.new(
|
176
|
+
token: 'access_token',
|
177
|
+
message: "Hello World",
|
178
|
+
source_language: "eng",
|
179
|
+
target_language: "esp",
|
180
|
+
wordcount: 500,
|
181
|
+
discipline: "automotive",
|
182
|
+
message_language: "eng",
|
183
|
+
public: 1,
|
184
|
+
cat_tool: "Awesome CAT"
|
185
|
+
).post
|
186
|
+
```
|
187
|
+
|
188
|
+
POST Reply
|
189
|
+
|
190
|
+
Uses OAuth2 with the `wiwo.post` default scope. Use the [omniauth-proz](https://github.com/diasks2/omniauth-proz) gem to easily authenticate.
|
191
|
+
|
192
|
+
Send a JSON object with the following fields. Only the "message" is required.
|
193
|
+
* message (string) - a plain text message.
|
194
|
+
* message_language (string) - a 3-character language code for the message.
|
195
|
+
|
196
|
+
```
|
197
|
+
Proz::WiwoReply.new(
|
198
|
+
token: 'access_token',
|
199
|
+
message: "Hello World",
|
200
|
+
message_language: "eng"
|
201
|
+
).post
|
202
|
+
```
|
203
|
+
|
204
|
+
### OAuth2
|
61
205
|
|
62
206
|
To Setup Your App with ProZ OAuth2:
|
63
207
|
|
data/lib/proz/version.rb
CHANGED
data/lib/proz/wiwo_entries.rb
CHANGED
@@ -4,9 +4,9 @@ module Proz
|
|
4
4
|
class WiwoEntries
|
5
5
|
include HTTParty
|
6
6
|
base_uri "https://api.proz.com/v2"
|
7
|
-
attr_reader :
|
8
|
-
def initialize(
|
9
|
-
@
|
7
|
+
attr_reader :key
|
8
|
+
def initialize(key:)
|
9
|
+
@key = key
|
10
10
|
end
|
11
11
|
|
12
12
|
def entries
|
@@ -22,13 +22,13 @@ module Proz
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def user_entries(user_uuid)
|
25
|
-
self.class.get("/wiwo?user_uuid=" + user_uuid, headers: { 'X-Proz-API-Key' =>
|
25
|
+
self.class.get("/wiwo?user_uuid=" + user_uuid, headers: { 'X-Proz-API-Key' => key })
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def all_wiwos
|
31
|
-
@wiwos ||= self.class.get("/wiwo", headers: { 'X-Proz-API-Key' =>
|
31
|
+
@wiwos ||= self.class.get("/wiwo", headers: { 'X-Proz-API-Key' => key })
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module Proz
|
4
|
+
class WiwoReply
|
5
|
+
include HTTParty
|
6
|
+
base_uri "https://api.proz.com/v2"
|
7
|
+
attr_reader :token, :id, :message, :options
|
8
|
+
def initialize(token:, id:, message:, **options)
|
9
|
+
@token = token
|
10
|
+
@id = id
|
11
|
+
@message = { message: message }
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def post
|
16
|
+
body = message.merge!(options)
|
17
|
+
self.class.post("/wiwo/#{id}/replies",
|
18
|
+
body: body,
|
19
|
+
headers: { 'Authorization' => "Bearer #{token}" } )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin S. Dias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/proz/version.rb
|
146
146
|
- lib/proz/wiwo_entries.rb
|
147
147
|
- lib/proz/wiwo_entry.rb
|
148
|
+
- lib/proz/wiwo_reply.rb
|
148
149
|
- proz.gemspec
|
149
150
|
- spec/fixtures/vcr_cassettes/exchange_code_for_token.yml
|
150
151
|
- spec/fixtures/vcr_cassettes/exchange_code_for_token_invalid_code.yml
|