pinterest-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +63 -0
- data/.travis-gemfile +17 -0
- data/.travis.yml +12 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +24 -0
- data/README.md +34 -0
- data/Rakefile +44 -0
- data/docs/FaradayMiddleware/SafeOj.html +218 -0
- data/docs/FaradayMiddleware.html +125 -0
- data/docs/Pinterest/Board.html +410 -0
- data/docs/Pinterest/Client.html +1894 -0
- data/docs/Pinterest/Collection.html +1877 -0
- data/docs/Pinterest/Endpoints/Authentication.html +578 -0
- data/docs/Pinterest/Endpoints/Boards.html +1443 -0
- data/docs/Pinterest/Endpoints/Pins.html +1296 -0
- data/docs/Pinterest/Endpoints/Users.html +1220 -0
- data/docs/Pinterest/Endpoints.html +127 -0
- data/docs/Pinterest/Entity.html +473 -0
- data/docs/Pinterest/Errors/AuthorizationError.html +158 -0
- data/docs/Pinterest/Errors/BadRequestError.html +158 -0
- data/docs/Pinterest/Errors/BaseError.html +487 -0
- data/docs/Pinterest/Errors/MethodNotAllowedError.html +158 -0
- data/docs/Pinterest/Errors/NotFoundError.html +158 -0
- data/docs/Pinterest/Errors/NotImplementedError.html +158 -0
- data/docs/Pinterest/Errors/PermissionsError.html +158 -0
- data/docs/Pinterest/Errors/RateLimitError.html +158 -0
- data/docs/Pinterest/Errors/ServerError.html +158 -0
- data/docs/Pinterest/Errors/TimeoutError.html +158 -0
- data/docs/Pinterest/Errors.html +377 -0
- data/docs/Pinterest/Image.html +617 -0
- data/docs/Pinterest/Interest.html +402 -0
- data/docs/Pinterest/Pin.html +511 -0
- data/docs/Pinterest/User.html +408 -0
- data/docs/Pinterest/Version.html +187 -0
- data/docs/Pinterest.html +130 -0
- data/docs/_index.html +401 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +106 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +106 -0
- data/docs/js/app.js +243 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +643 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/pinterest/client.rb +146 -0
- data/lib/pinterest/collection.rb +97 -0
- data/lib/pinterest/endpoints/authentication.rb +99 -0
- data/lib/pinterest/endpoints/boards.rb +193 -0
- data/lib/pinterest/endpoints/pins.rb +187 -0
- data/lib/pinterest/endpoints/users.rb +158 -0
- data/lib/pinterest/errors.rb +94 -0
- data/lib/pinterest/models/board.rb +34 -0
- data/lib/pinterest/models/entity.rb +42 -0
- data/lib/pinterest/models/image.rb +49 -0
- data/lib/pinterest/models/interest.rb +30 -0
- data/lib/pinterest/models/pin.rb +43 -0
- data/lib/pinterest/models/user.rb +33 -0
- data/lib/pinterest/safe_oj.rb +25 -0
- data/lib/pinterest/version.rb +23 -0
- data/lib/pinterest.rb +31 -0
- data/pinterest.gemspec +32 -0
- data/spec/cassettes/Pinterest_Client/_perform_network_request_private_/should_correctly_handle_malformed_requests.yml +51 -0
- data/spec/cassettes/Pinterest_Endpoints_Authentication/_fetch_access_token/should_make_the_call_to_Pinterest_and_return_the_authorization_token_also_saving_it.yml +58 -0
- data/spec/cassettes/Pinterest_Endpoints_Authentication/_verify_access_token/should_return_an_exception_when_using_an_invalid_token.yml +52 -0
- data/spec/cassettes/Pinterest_Endpoints_Authentication/_verify_access_token/should_verify_the_token.yml +59 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_board/should_complain_for_invalid_boards.yml +48 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_board/should_get_the_current_informations.yml +63 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_board/should_restrict_to_requested_fields.yml +57 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_boards/should_only_get_requested_fields.yml +57 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_boards/should_return_a_list_of_boards.yml +74 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_create_board/should_create_the_board_and_return_it_with_only_the_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_delete_board/should_perform_the_call_and_return_an_error.yml +48 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_delete_board/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_edit_board/should_edit_the_board_and_return_it_with_only_the_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_follow_board/should_complain_for_invalid_boards.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_follow_board/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_following_boards/should_only_get_requested_fields.yml +59 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_following_boards/should_paginate_correctly.yml +72 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_following_boards/should_return_the_followed_boards.yml +72 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_search_my_boards/should_only_get_requested_fields.yml +59 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_search_my_boards/should_paginate_correctly.yml +66 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_search_my_boards/should_search_boards.yml +75 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_suggested_boards/should_return_the_suggested_boards_returning_only_the_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_unfollow_board/should_complain_for_invalid_boards.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Boards/_unfollow_board/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_board_pins/should_only_get_requested_fields.yml +59 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_board_pins/should_paginate_correctly.yml +85 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_board_pins/should_return_the_pins_of_the_board.yml +85 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_create_pin/should_create_a_pin_by_using_a_image_URL.yml +71 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_create_pin/should_create_a_pin_by_using_a_image_file.yml +1997 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_create_pin/should_return_a_pin_containing_only_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_delete_pin/should_perform_the_call_and_return_an_error.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_delete_pin/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_edit_pin/should_edit_the_pin_and_return_it_with_only_the_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_likes/should_only_get_requested_fields.yml +58 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_likes/should_paginate_correctly.yml +87 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_likes/should_return_the_list_of_liked_pins.yml +85 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pin/should_complain_for_non_existent_pins.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pin/should_get_the_current_informations.yml +71 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pin/should_restrict_to_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pins/should_only_get_requested_fields.yml +59 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pins/should_paginate_correctly.yml +808 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_pins/should_return_my_pins.yml +88 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_search_my_pins/should_only_get_requested_fields.yml +61 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_search_my_pins/should_paginate_correctly.yml +89 -0
- data/spec/cassettes/Pinterest_Endpoints_Pins/_search_my_pins/should_search_my_pins.yml +89 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_follow_interest/should_perform_the_call_and_return_an_error.yml +48 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_follow_user/should_complain_for_invalid_users.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_follow_user/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_followers/should_only_get_requested_fields.yml +62 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_followers/should_paginate_correctly.yml +62 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_followers/should_return_a_list_of_followers.yml +62 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_following_users/should_only_get_requested_fields.yml +62 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_following_users/should_paginate_correctly.yml +131 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_following_users/should_return_a_list_of_followed_users.yml +66 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_interests/should_paginate_correctly.yml +112 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_interests/should_return_a_list_of_followed_interest.yml +58 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_me/should_get_the_current_informations.yml +62 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_me/should_restrict_to_requested_fields.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_unfollow_interest/should_perform_the_call_and_return_an_error.yml +48 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_unfollow_user/should_complain_for_invalid_users.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_unfollow_user/should_perform_the_call_and_return_true.yml +109 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_user/should_complain_for_non_existent_users.yml +56 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_user/should_get_the_current_informations.yml +60 -0
- data/spec/cassettes/Pinterest_Endpoints_Users/_user/should_restrict_to_requested_fields.yml +56 -0
- data/spec/pinterest/client_spec.rb +70 -0
- data/spec/pinterest/collection_spec.rb +82 -0
- data/spec/pinterest/endpoints/authentication_spec.rb +81 -0
- data/spec/pinterest/endpoints/boards_spec.rb +209 -0
- data/spec/pinterest/endpoints/pins_spec.rb +239 -0
- data/spec/pinterest/endpoints/users_spec.rb +194 -0
- data/spec/pinterest/errors_spec.rb +59 -0
- data/spec/pinterest/fixtures/first.jpg +0 -0
- data/spec/pinterest/models/board_spec.rb +48 -0
- data/spec/pinterest/models/entity_spec.rb +35 -0
- data/spec/pinterest/models/image_spec.rb +50 -0
- data/spec/pinterest/models/interest_spec.rb +20 -0
- data/spec/pinterest/models/pin_spec.rb +55 -0
- data/spec/pinterest/models/user_spec.rb +45 -0
- data/spec/spec_helper.rb +49 -0
- data/tester.rb +19 -0
- metadata +341 -0
@@ -0,0 +1,578 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Pinterest::Endpoints::Authentication
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.7
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Pinterest::Endpoints::Authentication";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (A)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Pinterest.html" title="Pinterest (module)">Pinterest</a></span></span> » <span class='title'><span class='object_link'><a href="../Endpoints.html" title="Pinterest::Endpoints (module)">Endpoints</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Authentication</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Pinterest::Endpoints::Authentication
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<dl>
|
78
|
+
<dt>Included in:</dt>
|
79
|
+
<dd><span class='object_link'><a href="../Client.html" title="Pinterest::Client (class)">Client</a></span></dd>
|
80
|
+
</dl>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dl>
|
85
|
+
<dt>Defined in:</dt>
|
86
|
+
<dd>lib/pinterest/endpoints/authentication.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Authentication related endpoints.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#authorization_state-instance_method" title="#authorization_state (instance method)">#<strong>authorization_state</strong> ⇒ String </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Returns a state string needed for authorization by the Pinterest API.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#authorization_url-instance_method" title="#authorization_url (instance method)">#<strong>authorization_url</strong>(callback_url = nil, scopes = nil) ⇒ String </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>Returns the URL to start the authentication flow.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#fetch_access_token-instance_method" title="#fetch_access_token (instance method)">#<strong>fetch_access_token</strong>(authorization_token) ⇒ String </a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<span class="summary_desc"><div class='inline'><p>Fetches the access token.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#verify_access_token-instance_method" title="#verify_access_token (instance method)">#<strong>verify_access_token</strong> ⇒ Hash </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Verifies the access token.</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
</ul>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<div id="instance_method_details" class="method_details_list">
|
214
|
+
<h2>Instance Method Details</h2>
|
215
|
+
|
216
|
+
|
217
|
+
<div class="method_details first">
|
218
|
+
<h3 class="signature first" id="authorization_state-instance_method">
|
219
|
+
|
220
|
+
#<strong>authorization_state</strong> ⇒ <tt>String</tt>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
</h3><div class="docstring">
|
227
|
+
<div class="discussion">
|
228
|
+
<p>Returns a state string needed for authorization by the Pinterest API.</p>
|
229
|
+
|
230
|
+
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
<div class="tags">
|
234
|
+
|
235
|
+
<p class="tag_title">Returns:</p>
|
236
|
+
<ul class="return">
|
237
|
+
|
238
|
+
<li>
|
239
|
+
|
240
|
+
|
241
|
+
<span class='type'>(<tt>String</tt>)</span>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
—
|
246
|
+
<div class='inline'><p>The state.</p>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</li>
|
250
|
+
|
251
|
+
</ul>
|
252
|
+
|
253
|
+
</div><table class="source_code">
|
254
|
+
<tr>
|
255
|
+
<td>
|
256
|
+
<pre class="lines">
|
257
|
+
|
258
|
+
|
259
|
+
14
|
260
|
+
15
|
261
|
+
16</pre>
|
262
|
+
</td>
|
263
|
+
<td>
|
264
|
+
<pre class="code"><span class="info file"># File 'lib/pinterest/endpoints/authentication.rb', line 14</span>
|
265
|
+
|
266
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_authorization_state'>authorization_state</span>
|
267
|
+
<span class='ivar'>@state</span> <span class='op'>||=</span> <span class='const'>SecureRandom</span><span class='period'>.</span><span class='id identifier rubyid_hex'>hex</span>
|
268
|
+
<span class='kw'>end</span></pre>
|
269
|
+
</td>
|
270
|
+
</tr>
|
271
|
+
</table>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method_details ">
|
275
|
+
<h3 class="signature " id="authorization_url-instance_method">
|
276
|
+
|
277
|
+
#<strong>authorization_url</strong>(callback_url = nil, scopes = nil) ⇒ <tt>String</tt>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</h3><div class="docstring">
|
284
|
+
<div class="discussion">
|
285
|
+
<p>Returns the URL to start the authentication flow.</p>
|
286
|
+
|
287
|
+
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
<div class="tags">
|
291
|
+
<p class="tag_title">Parameters:</p>
|
292
|
+
<ul class="param">
|
293
|
+
|
294
|
+
<li>
|
295
|
+
|
296
|
+
<span class='name'>callback_url</span>
|
297
|
+
|
298
|
+
|
299
|
+
<span class='type'>(<tt>String</tt>)</span>
|
300
|
+
|
301
|
+
|
302
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
303
|
+
|
304
|
+
|
305
|
+
—
|
306
|
+
<div class='inline'><p>The callback where to redirect the browser when done.</p>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
<li>
|
312
|
+
|
313
|
+
<span class='name'>scopes</span>
|
314
|
+
|
315
|
+
|
316
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
317
|
+
|
318
|
+
|
319
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
320
|
+
|
321
|
+
|
322
|
+
—
|
323
|
+
<div class='inline'><p>The list of scopes to ask for. For a list of valid fields, see <code>Pinterest::Client::SCOPES</code>.</p>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
</ul>
|
329
|
+
|
330
|
+
<p class="tag_title">Returns:</p>
|
331
|
+
<ul class="return">
|
332
|
+
|
333
|
+
<li>
|
334
|
+
|
335
|
+
|
336
|
+
<span class='type'>(<tt>String</tt>)</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
—
|
341
|
+
<div class='inline'><p>The authorization URL.</p>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
</ul>
|
347
|
+
|
348
|
+
</div><table class="source_code">
|
349
|
+
<tr>
|
350
|
+
<td>
|
351
|
+
<pre class="lines">
|
352
|
+
|
353
|
+
|
354
|
+
23
|
355
|
+
24
|
356
|
+
25
|
357
|
+
26
|
358
|
+
27
|
359
|
+
28
|
360
|
+
29
|
361
|
+
30
|
362
|
+
31
|
363
|
+
32
|
364
|
+
33
|
365
|
+
34
|
366
|
+
35
|
367
|
+
36
|
368
|
+
37
|
369
|
+
38</pre>
|
370
|
+
</td>
|
371
|
+
<td>
|
372
|
+
<pre class="code"><span class="info file"># File 'lib/pinterest/endpoints/authentication.rb', line 23</span>
|
373
|
+
|
374
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_authorization_url'>authorization_url</span><span class='lparen'>(</span><span class='id identifier rubyid_callback_url'>callback_url</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_scopes'>scopes</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
375
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_client_id'>client_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the client_id.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
376
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_callback_url'>callback_url</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the callback_url.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
377
|
+
<span class='id identifier rubyid_validate_callback_url'>validate_callback_url</span><span class='lparen'>(</span><span class='id identifier rubyid_callback_url'>callback_url</span><span class='rparen'>)</span>
|
378
|
+
|
379
|
+
<span class='comment'># Create the query
|
380
|
+
</span> <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='id identifier rubyid_cleanup_params'>cleanup_params</span><span class='lparen'>(</span><span class='lbrace'>{</span>
|
381
|
+
<span class='label'>response_type:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>code</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>client_id:</span> <span class='id identifier rubyid_client_id'>client_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='label'>authorization_state:</span> <span class='id identifier rubyid_authorization_state'>authorization_state</span><span class='comma'>,</span> <span class='label'>redirect_uri:</span> <span class='id identifier rubyid_callback_url'>callback_url</span><span class='comma'>,</span>
|
382
|
+
<span class='label'>scope:</span> <span class='lparen'>(</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='id identifier rubyid_scopes'>scopes</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Pinterest.html" title="Pinterest (module)">Pinterest</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html" title="Pinterest::Client (class)">Client</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html#SCOPES-constant" title="Pinterest::Client::SCOPES (constant)">SCOPES</a></span></span><span class='rparen'>)</span> <span class='op'>&</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Pinterest.html" title="Pinterest (module)">Pinterest</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html" title="Pinterest::Client (class)">Client</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html#SCOPES-constant" title="Pinterest::Client::SCOPES (constant)">SCOPES</a></span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># Restrict to only valid scopes
|
383
|
+
</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
|
384
|
+
|
385
|
+
<span class='comment'># Create the URL
|
386
|
+
</span> <span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='const'>Addressable</span><span class='op'>::</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Pinterest.html" title="Pinterest (module)">Pinterest</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html" title="Pinterest::Client (class)">Client</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Client.html#API_URL-constant" title="Pinterest::Client::API_URL (constant)">API_URL</a></span></span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/oauth</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
387
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query_values'>query_values</span> <span class='op'>=</span> <span class='id identifier rubyid_query'>query</span>
|
388
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
389
|
+
<span class='kw'>end</span></pre>
|
390
|
+
</td>
|
391
|
+
</tr>
|
392
|
+
</table>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div class="method_details ">
|
396
|
+
<h3 class="signature " id="fetch_access_token-instance_method">
|
397
|
+
|
398
|
+
#<strong>fetch_access_token</strong>(authorization_token) ⇒ <tt>String</tt>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
</h3><div class="docstring">
|
405
|
+
<div class="discussion">
|
406
|
+
<p>Fetches the access token.</p>
|
407
|
+
|
408
|
+
|
409
|
+
</div>
|
410
|
+
</div>
|
411
|
+
<div class="tags">
|
412
|
+
<p class="tag_title">Parameters:</p>
|
413
|
+
<ul class="param">
|
414
|
+
|
415
|
+
<li>
|
416
|
+
|
417
|
+
<span class='name'>authorization_token</span>
|
418
|
+
|
419
|
+
|
420
|
+
<span class='type'>(<tt>String</tt>)</span>
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
—
|
425
|
+
<div class='inline'><p>The authorization token.</p>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
</li>
|
429
|
+
|
430
|
+
</ul>
|
431
|
+
|
432
|
+
<p class="tag_title">Returns:</p>
|
433
|
+
<ul class="return">
|
434
|
+
|
435
|
+
<li>
|
436
|
+
|
437
|
+
|
438
|
+
<span class='type'>(<tt>String</tt>)</span>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
—
|
443
|
+
<div class='inline'><p>The authentication token.</p>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
</ul>
|
449
|
+
|
450
|
+
</div><table class="source_code">
|
451
|
+
<tr>
|
452
|
+
<td>
|
453
|
+
<pre class="lines">
|
454
|
+
|
455
|
+
|
456
|
+
44
|
457
|
+
45
|
458
|
+
46
|
459
|
+
47
|
460
|
+
48
|
461
|
+
49
|
462
|
+
50
|
463
|
+
51
|
464
|
+
52
|
465
|
+
53
|
466
|
+
54
|
467
|
+
55
|
468
|
+
56
|
469
|
+
57
|
470
|
+
58</pre>
|
471
|
+
</td>
|
472
|
+
<td>
|
473
|
+
<pre class="code"><span class="info file"># File 'lib/pinterest/endpoints/authentication.rb', line 44</span>
|
474
|
+
|
475
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fetch_access_token'>fetch_access_token</span><span class='lparen'>(</span><span class='id identifier rubyid_authorization_token'>authorization_token</span><span class='rparen'>)</span>
|
476
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_client_id'>client_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the client_id.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
477
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_client_secret'>client_secret</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the client_secret.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
478
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_authorization_token'>authorization_token</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the authorization_token.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
479
|
+
|
480
|
+
<span class='comment'># Create parameters
|
481
|
+
</span> <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='id identifier rubyid_cleanup_params'>cleanup_params</span><span class='lparen'>(</span><span class='lbrace'>{</span>
|
482
|
+
<span class='label'>client_id:</span> <span class='id identifier rubyid_client_id'>client_id</span><span class='comma'>,</span> <span class='label'>client_secret:</span> <span class='id identifier rubyid_client_secret'>client_secret</span><span class='comma'>,</span>
|
483
|
+
<span class='label'>grant_type:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>authorization_code</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>code:</span> <span class='id identifier rubyid_authorization_token'>authorization_token</span>
|
484
|
+
<span class='rbrace'>}</span><span class='rparen'>)</span>
|
485
|
+
|
486
|
+
<span class='comment'># Perform the request and then get the token
|
487
|
+
</span> <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_network_request'>perform_network_request</span><span class='lparen'>(</span><span class='label'>method:</span> <span class='symbol'>:post</span><span class='comma'>,</span> <span class='label'>url:</span> <span class='id identifier rubyid_versioned_url'>versioned_url</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/oauth/token</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>query:</span> <span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
488
|
+
<span class='ivar'>@access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>access_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
489
|
+
<span class='kw'>end</span></pre>
|
490
|
+
</td>
|
491
|
+
</tr>
|
492
|
+
</table>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
<div class="method_details ">
|
496
|
+
<h3 class="signature " id="verify_access_token-instance_method">
|
497
|
+
|
498
|
+
#<strong>verify_access_token</strong> ⇒ <tt>Hash</tt>
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
</h3><div class="docstring">
|
505
|
+
<div class="discussion">
|
506
|
+
<p>Verifies the access token.</p>
|
507
|
+
|
508
|
+
|
509
|
+
</div>
|
510
|
+
</div>
|
511
|
+
<div class="tags">
|
512
|
+
|
513
|
+
<p class="tag_title">Returns:</p>
|
514
|
+
<ul class="return">
|
515
|
+
|
516
|
+
<li>
|
517
|
+
|
518
|
+
|
519
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
—
|
524
|
+
<div class='inline'><p>The access token informations.</p>
|
525
|
+
</div>
|
526
|
+
|
527
|
+
</li>
|
528
|
+
|
529
|
+
</ul>
|
530
|
+
|
531
|
+
</div><table class="source_code">
|
532
|
+
<tr>
|
533
|
+
<td>
|
534
|
+
<pre class="lines">
|
535
|
+
|
536
|
+
|
537
|
+
63
|
538
|
+
64
|
539
|
+
65
|
540
|
+
66
|
541
|
+
67
|
542
|
+
68
|
543
|
+
69
|
544
|
+
70
|
545
|
+
71
|
546
|
+
72</pre>
|
547
|
+
</td>
|
548
|
+
<td>
|
549
|
+
<pre class="code"><span class="info file"># File 'lib/pinterest/endpoints/authentication.rb', line 63</span>
|
550
|
+
|
551
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify_access_token'>verify_access_token</span>
|
552
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_client_id'>client_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must specify the client_id.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
553
|
+
<span class='id identifier rubyid_ensure_param'>ensure_param</span><span class='lparen'>(</span><span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>You must set the access token first.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
554
|
+
|
555
|
+
<span class='comment'># Get the data
|
556
|
+
</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_network_request'>perform_network_request</span><span class='lparen'>(</span><span class='label'>url:</span> <span class='id identifier rubyid_versioned_url'>versioned_url</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/oauth/inspect</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>authenticated:</span> <span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>data</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
557
|
+
|
558
|
+
<span class='comment'># Prepare for output
|
559
|
+
</span> <span class='id identifier rubyid_create_authentication'>create_authentication</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
560
|
+
<span class='kw'>end</span></pre>
|
561
|
+
</td>
|
562
|
+
</tr>
|
563
|
+
</table>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
</div>
|
567
|
+
|
568
|
+
</div>
|
569
|
+
|
570
|
+
<div id="footer">
|
571
|
+
Generated on Thu Jan 12 16:28:12 2017 by
|
572
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
573
|
+
0.9.7 (ruby-2.3.0).
|
574
|
+
</div>
|
575
|
+
|
576
|
+
</div>
|
577
|
+
</body>
|
578
|
+
</html>
|