pingboard 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pingboard/client.rb +53 -42
- data/lib/pingboard/request.rb +1 -2
- data/pingboard.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b969ab807311476df36a6804141dfc4b2f7f66
|
4
|
+
data.tar.gz: ec03d39b5b31c5739745d377b53471df09d95a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da1c270d59d4d5134468af64cc53df26c138bb6d7d7fde97fb795fb49c30fbf3f9e193a033c4018074076cf6c5f17de88c0fd143f304f9032faf258e0944c494
|
7
|
+
data.tar.gz: ca2c407572a28b3a9415d1112094d9df0d9ed3314c57c24ddbf692a87e817ae036ea74c35fb4524fe88b2794eafc83fc0713a8d97170fc0a6faca4d69f62e7ea
|
data/README.md
CHANGED
data/lib/pingboard/client.rb
CHANGED
@@ -23,61 +23,61 @@ module Pingboard
|
|
23
23
|
|
24
24
|
def search(query, options={})
|
25
25
|
options.merge!(q: query)
|
26
|
-
response =
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
response = build_request(
|
27
|
+
self,
|
28
|
+
:get,
|
29
|
+
URL_API_VERSION_PATH + URL_SEARCH_USERS_PATH,
|
30
|
+
{'Authorization' => "Bearer #{access_token}" },
|
31
|
+
nil,
|
32
|
+
options
|
33
33
|
).do
|
34
34
|
JSON.parse(response.body)
|
35
35
|
end
|
36
36
|
|
37
37
|
def users(options={})
|
38
|
-
response =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
response = build_request(
|
39
|
+
self,
|
40
|
+
:get,
|
41
|
+
URL_API_VERSION_PATH + URL_USERS_PATH,
|
42
|
+
{'Authorization' => "Bearer #{access_token}" },
|
43
|
+
nil,
|
44
|
+
options
|
45
45
|
).do
|
46
46
|
JSON.parse(response.body)
|
47
47
|
end
|
48
48
|
|
49
49
|
def user(user_id, options={})
|
50
|
-
response =
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
response = build_request(
|
51
|
+
self,
|
52
|
+
:get,
|
53
|
+
URL_API_VERSION_PATH + URL_USERS_PATH + "/#{user_id}",
|
54
|
+
{'Authorization' => "Bearer #{access_token}" },
|
55
|
+
nil,
|
56
|
+
options
|
57
57
|
).do
|
58
58
|
JSON.parse(response.body)
|
59
59
|
end
|
60
60
|
|
61
61
|
def status(status_id, options={})
|
62
|
-
response =
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
response = build_request(
|
63
|
+
self,
|
64
|
+
:get,
|
65
|
+
URL_API_VERSION_PATH + URL_STATUSES_PATH + "/#{status_id}",
|
66
|
+
{'Authorization' => "Bearer #{access_token}" },
|
67
|
+
nil,
|
68
|
+
options
|
69
69
|
).do
|
70
70
|
JSON.parse(response.body)
|
71
71
|
end
|
72
72
|
|
73
73
|
def status_types
|
74
|
-
response =
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
response = build_request(
|
75
|
+
self,
|
76
|
+
:get,
|
77
|
+
URL_API_VERSION_PATH + URL_STATUS_TYPES_PATH,
|
78
|
+
{'Authorization' => "Bearer #{access_token}" },
|
79
|
+
nil,
|
80
|
+
nil
|
81
81
|
).do
|
82
82
|
JSON.parse(response.body)
|
83
83
|
end
|
@@ -93,6 +93,17 @@ module Pingboard
|
|
93
93
|
|
94
94
|
private
|
95
95
|
|
96
|
+
def build_request(client, http_verb, path, headers, body, params)
|
97
|
+
@request.new(
|
98
|
+
client: client,
|
99
|
+
http_verb: http_verb,
|
100
|
+
path: path,
|
101
|
+
headers: headers,
|
102
|
+
body: body,
|
103
|
+
params: params
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
96
107
|
def access_token_expired?
|
97
108
|
Time.now > token_expiration_time
|
98
109
|
end
|
@@ -105,13 +116,13 @@ module Pingboard
|
|
105
116
|
end
|
106
117
|
|
107
118
|
def access_token_request
|
108
|
-
@access_token_request =
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
119
|
+
@access_token_request = build_request(
|
120
|
+
self,
|
121
|
+
:post,
|
122
|
+
URL_OAUTH_TOKEN_PATH,
|
123
|
+
{ 'Content-Type' => 'application/x-www-form-urlencoded' },
|
124
|
+
{ 'client_id' => "#{service_app_id}", 'client_secret' => "#{service_app_secret}" },
|
125
|
+
{ 'grant_type' => 'client_credentials' }
|
115
126
|
).do
|
116
127
|
end
|
117
128
|
|
data/lib/pingboard/request.rb
CHANGED
@@ -13,13 +13,12 @@ module Pingboard
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def do
|
16
|
-
@
|
16
|
+
@client.connection.public_send(@http_verb) do |request|
|
17
17
|
request.url "#{@path}"
|
18
18
|
set_headers!(request) if headers
|
19
19
|
set_body!(request) if body
|
20
20
|
set_params!(request) if params
|
21
21
|
end
|
22
|
-
@test
|
23
22
|
end
|
24
23
|
|
25
24
|
private
|
data/pingboard.gemspec
CHANGED
@@ -3,8 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'pingboard'
|
6
|
-
s.version = '0.0.
|
7
|
-
s.date = '2017-08-
|
6
|
+
s.version = '0.0.9'
|
7
|
+
s.date = '2017-08-06'
|
8
8
|
s.summary = "The Pingboard API Ruby Client"
|
9
9
|
s.description = "A Ruby client interface for the Pingboard API"
|
10
10
|
s.authors = ["Bryan B. Cabalo"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan B. Cabalo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby client interface for the Pingboard API
|
14
14
|
email: bcabalo@gmail.com
|