proz 0.3.1 → 1.0.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 +36 -2
- data/lib/proz.rb +3 -2
- data/lib/proz/get_wiwo_entry.rb +23 -0
- data/lib/proz/{wiwo_entry.rb → post_wiwo_entry.rb} +1 -1
- data/lib/proz/{wiwo_reply.rb → post_wiwo_reply.rb} +1 -1
- data/lib/proz/version.rb +1 -1
- data/lib/proz/wiwo_entries.rb +18 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6367453ab1a5c9097d24f789a1483f24f27e22b0
|
4
|
+
data.tar.gz: cdc37ca31e412e4d18d31d5351acbe598415920b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f40122fe7d4e9e908f0c68b29fa077e199f943e66e26c0b1c53cefa8b60d4effddcd28c98eb62b850e891f1674025b76e8fbd38590b23ff6177fa5591523f4c1
|
7
|
+
data.tar.gz: 9dfe889444c2f76da5ba712b0ad1a6cd58d1134e49cc513e314dce652ae81ec8a271c2cc9dc467dc1ba0f417ced7205c227964c10ef1d4b964a0732ae9a7d02f
|
data/README.md
CHANGED
@@ -155,6 +155,38 @@ wiwo.entries
|
|
155
155
|
# { ... }
|
156
156
|
# ]
|
157
157
|
# }
|
158
|
+
|
159
|
+
|
160
|
+
wiwo = Proz::WiwoEntries.new(key: 'yourAPIkey')
|
161
|
+
# Filter the returned WIWOs
|
162
|
+
# Options include:
|
163
|
+
# * user_uuid (string)
|
164
|
+
# * message_contains (string)
|
165
|
+
# * min_time (datetime)
|
166
|
+
|
167
|
+
options = {
|
168
|
+
user_uuid: '7ccfee74-a2a4-484f-8dbc-215a67026ce1',
|
169
|
+
message_contains: 'hello world',
|
170
|
+
min_time: '2016-07-013T01:01:01+00:00'
|
171
|
+
}
|
172
|
+
wiwo.filtered_entries(options)
|
173
|
+
```
|
174
|
+
|
175
|
+
GET WIWO (OAuth2)
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
# Get user's WIWOs (public + private)
|
179
|
+
Proz::GetWiwoEntry.new(
|
180
|
+
token: 'access_token',
|
181
|
+
include_private: true
|
182
|
+
).get
|
183
|
+
|
184
|
+
# Get user's WIWOs (public only)
|
185
|
+
Proz::GetWiwoEntry.new(
|
186
|
+
token: 'access_token',
|
187
|
+
include_private: false
|
188
|
+
).get
|
189
|
+
|
158
190
|
```
|
159
191
|
|
160
192
|
POST WIWO
|
@@ -172,7 +204,7 @@ Send a JSON object with the following fields. Only the "message" is required.
|
|
172
204
|
* cat_tool (string) - A free-text name of the CAT tool in use, if any.
|
173
205
|
|
174
206
|
```
|
175
|
-
Proz::
|
207
|
+
Proz::PostWiwoEntry.new(
|
176
208
|
token: 'access_token',
|
177
209
|
message: "Hello World",
|
178
210
|
source_language: "eng",
|
@@ -190,11 +222,13 @@ POST Reply
|
|
190
222
|
Uses OAuth2 with the `wiwo.post` default scope. Use the [omniauth-proz](https://github.com/diasks2/omniauth-proz) gem to easily authenticate.
|
191
223
|
|
192
224
|
Send a JSON object with the following fields. Only the "message" is required.
|
225
|
+
* id (string) - id of the parent wiwo
|
193
226
|
* message (string) - a plain text message.
|
194
227
|
* message_language (string) - a 3-character language code for the message.
|
195
228
|
|
196
229
|
```
|
197
|
-
Proz::
|
230
|
+
Proz::PostWiwoReply.new(
|
231
|
+
id: '567',
|
198
232
|
token: 'access_token',
|
199
233
|
message: "Hello World",
|
200
234
|
message_language: "eng"
|
data/lib/proz.rb
CHANGED
@@ -3,6 +3,7 @@ require "proz/oauth"
|
|
3
3
|
require "proz/profile"
|
4
4
|
require "proz/freelancer"
|
5
5
|
require "proz/freelancer_matches"
|
6
|
-
require "proz/
|
6
|
+
require "proz/post_wiwo_entry"
|
7
|
+
require "proz/get_wiwo_entry"
|
7
8
|
require "proz/wiwo_entries"
|
8
|
-
require "proz/
|
9
|
+
require "proz/post_wiwo_reply"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module Proz
|
4
|
+
class GetWiwoEntry
|
5
|
+
include HTTParty
|
6
|
+
base_uri "https://api.proz.com/v2"
|
7
|
+
attr_reader :token, :include_private
|
8
|
+
def initialize(token:, include_private:)
|
9
|
+
@token = token
|
10
|
+
@include_private = include_private
|
11
|
+
end
|
12
|
+
|
13
|
+
def get
|
14
|
+
if include_private
|
15
|
+
self.class.get("/wiwo?include_private=1",
|
16
|
+
headers: { 'Authorization' => "Bearer #{token}" } )
|
17
|
+
else
|
18
|
+
self.class.get("/wiwo",
|
19
|
+
headers: { 'Authorization' => "Bearer #{token}" } )
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/proz/version.rb
CHANGED
data/lib/proz/wiwo_entries.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'httparty'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
module Proz
|
4
5
|
class WiwoEntries
|
@@ -21,8 +22,23 @@ module Proz
|
|
21
22
|
all_wiwos["users"]
|
22
23
|
end
|
23
24
|
|
24
|
-
def
|
25
|
-
|
25
|
+
def filtered_entries(**options)
|
26
|
+
if options[:user_uuid]
|
27
|
+
user_uuid_query = "user_uuid=" + options[:user_uuid] + '&'
|
28
|
+
else
|
29
|
+
user_uuid_query = ""
|
30
|
+
end
|
31
|
+
if options[:keyword]
|
32
|
+
keyword_query = "message_contains=" + URI.encode(options[:keyword], /\W/) + '&'
|
33
|
+
else
|
34
|
+
keyword_query = ""
|
35
|
+
end
|
36
|
+
if options[:min_time]
|
37
|
+
min_time_query = "min_time=" + URI.encode(options[:min_time]) + '&'
|
38
|
+
else
|
39
|
+
min_time_query = ""
|
40
|
+
end
|
41
|
+
self.class.get("/wiwo?" + user_uuid_query + keyword_query + min_time_query, headers: { 'X-Proz-API-Key' => key })
|
26
42
|
end
|
27
43
|
|
28
44
|
private
|
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: 1.0.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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,12 +140,13 @@ files:
|
|
140
140
|
- lib/proz.rb
|
141
141
|
- lib/proz/freelancer.rb
|
142
142
|
- lib/proz/freelancer_matches.rb
|
143
|
+
- lib/proz/get_wiwo_entry.rb
|
143
144
|
- lib/proz/oauth.rb
|
145
|
+
- lib/proz/post_wiwo_entry.rb
|
146
|
+
- lib/proz/post_wiwo_reply.rb
|
144
147
|
- lib/proz/profile.rb
|
145
148
|
- lib/proz/version.rb
|
146
149
|
- lib/proz/wiwo_entries.rb
|
147
|
-
- lib/proz/wiwo_entry.rb
|
148
|
-
- lib/proz/wiwo_reply.rb
|
149
150
|
- proz.gemspec
|
150
151
|
- spec/fixtures/vcr_cassettes/exchange_code_for_token.yml
|
151
152
|
- spec/fixtures/vcr_cassettes/exchange_code_for_token_invalid_code.yml
|