behance 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +15 -0
- data/README.md +143 -63
- data/lib/behance/client.rb +3 -1
- data/lib/behance/collections.rb +24 -16
- data/lib/behance/creatives_to_follow.rb +23 -0
- data/lib/behance/fields.rb +12 -1
- data/lib/behance/project.rb +36 -30
- data/lib/behance/user.rb +91 -35
- data/lib/behance/version.rb +1 -1
- data/lib/behance/wips.rb +19 -22
- data/spec/behance/client_spec.rb +1 -1
- data/spec/behance/collections_spec.rb +5 -5
- data/spec/behance/creatives_to_follow_spec.rb +44 -0
- data/spec/behance/fields_spec.rb +20 -1
- data/spec/behance/project_spec.rb +4 -4
- data/spec/behance/user_spec.rb +122 -28
- data/spec/behance/wips_spec.rb +28 -13
- data/spec/fixtures/collection.json +218 -34
- data/spec/fixtures/collection_projects.json +688 -88
- data/spec/fixtures/collections.json +2192 -104
- data/spec/fixtures/creatives_to_follow.json +302 -0
- data/spec/fixtures/fields.json +323 -26
- data/spec/fixtures/project.json +716 -10
- data/spec/fixtures/project_comments.json +13140 -271
- data/spec/fixtures/projects.json +786 -339
- data/spec/fixtures/user.json +165 -31
- data/spec/fixtures/user_appreciations.json +1155 -211
- data/spec/fixtures/user_collections.json +2153 -70
- data/spec/fixtures/user_followers.json +319 -0
- data/spec/fixtures/user_following.json +362 -0
- data/spec/fixtures/user_projects.json +2076 -172
- data/spec/fixtures/user_stats.json +14 -13
- data/spec/fixtures/user_wips.json +2095 -46
- data/spec/fixtures/user_work_experience.json +37 -29
- data/spec/fixtures/users.json +347 -97
- data/spec/fixtures/wip.json +72 -23
- data/spec/fixtures/wip_revision.json +28 -8
- data/spec/fixtures/wip_revision_comments.json +184 -108
- data/spec/fixtures/wips.json +1015 -158
- metadata +26 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YWJjY2E2YjY1ZGQ2ODBkYTJiYjNjNWQ5NDM3YTdhMTBiZmRiZDlhNQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 984c4d17b922fb3a353824caf5f37589aef0903d
|
4
|
+
data.tar.gz: 7d2ba3866bb1cb2e8bbc1b874a8bbf3cf7cbe0c3
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWU2NGM1ZjM2YzQxZjc1ZTI0ZmJlZmE2N2Q3MTI5MjQzYTBmZmI5NmY4OWFk
|
11
|
-
ZTU5Yzg3MGZmZjNhZDQzMWQwMGMyZWI4YjUwMTk4MWVjMTM1Nzg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzJkYWUwMTA2YTk3ZTVhNzRiY2QwZjlmNDZhOTc1MzIwMGIzYjgyMzg3YWYx
|
14
|
-
YTk4YTQ2YzhjODQ3Nzk5YmIxNTZjZTA0ZDllZWY1NjkxOWQzZjdjNTZmY2Zm
|
15
|
-
N2RlMmFiYWMwY2RjOTM0ZjQyYzA0YjIzOTdmZjc4NTUyNjcwYTE=
|
6
|
+
metadata.gz: 58129857a0e5474dd71860c1fceefd971e6c1eaebc20119666877f2f3db73399df2b022f6339c99d349994277f44f42c4a63f22f06338b5d0f2e1717482f966f
|
7
|
+
data.tar.gz: b4b556c770059adba40cef49d792cb3e333a2201de0398b2ff7dc5c2b15a9acf4cd2f2f41b60e720da4f292be3e00d9b52c9c1220b92b6d554193d22b7a1f52b
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
master
|
2
|
+
===
|
3
|
+
...
|
4
|
+
|
5
|
+
0.6.0
|
6
|
+
===
|
7
|
+
* Introducing CHANGELOG.md.
|
8
|
+
* [Creatives To Follow Endpoint](https://www.behance.net/dev/api/endpoints/9) added.
|
9
|
+
* `@client.popular` retrieves all Creative Fields (in 'popular').
|
10
|
+
* `@client.user_appreciations`, `@client.user_collections` and `@client.wip_revision_comments` now accepts options hash.
|
11
|
+
* `@client.user_followers` and `@client.user_following` added.
|
12
|
+
|
13
|
+
0.5.1
|
14
|
+
===
|
15
|
+
...
|
data/README.md
CHANGED
@@ -4,161 +4,241 @@ A Ruby wrapper for the Behance API.
|
|
4
4
|
|
5
5
|
More information about the API capabilities can be found [here][api].
|
6
6
|
|
7
|
-
[api]:
|
7
|
+
[api]: https://www.behance.net/dev
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
|
11
|
+
```
|
12
|
+
$ gem install behance
|
13
|
+
```
|
12
14
|
|
13
15
|
## API Usage Examples
|
14
16
|
|
15
17
|
First of all, you will need to get an access token [here][register].
|
16
18
|
|
17
|
-
[register]:
|
19
|
+
[register]: https://www.behance.net/dev/register
|
18
20
|
|
19
21
|
Once you get it, you'll be able to start playing
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
```ruby
|
24
|
+
# initializing the client
|
25
|
+
client = Behance::Client.new(access_token: "access-token")
|
26
|
+
```
|
23
27
|
|
24
28
|
### Projects
|
25
29
|
|
26
30
|
[Search for projects][projects]
|
27
31
|
|
28
|
-
[projects]:
|
32
|
+
[projects]: https://www.behance.net/dev/api/endpoints/1#projects-get-10
|
29
33
|
|
30
|
-
|
31
|
-
|
34
|
+
```ruby
|
35
|
+
client.projects
|
36
|
+
client.projects(city: "San Francisco", state: "California", field: "branding")
|
37
|
+
```
|
32
38
|
|
33
39
|
[Get the information and content of a project][project]
|
34
40
|
|
35
|
-
[project]:
|
41
|
+
[project]: https://www.behance.net/dev/api/endpoints/1#projects-get-4
|
36
42
|
|
37
|
-
|
43
|
+
```ruby
|
44
|
+
client.project(5133725)
|
45
|
+
```
|
38
46
|
|
39
47
|
[Get the comments for a project][project_comments]
|
40
48
|
|
41
|
-
[project_comments]:
|
49
|
+
[project_comments]: https://www.behance.net/dev/api/endpoints/1#projects-get-5
|
42
50
|
|
43
|
-
|
51
|
+
```ruby
|
52
|
+
client.project_comments(5133725)
|
53
|
+
```
|
44
54
|
|
45
55
|
### Users
|
46
56
|
|
47
|
-
[Search for users][users]
|
57
|
+
[Search for users][users]
|
48
58
|
|
49
|
-
[users]:
|
59
|
+
[users]: https://www.behance.net/dev/api/endpoints/2#users-get-9
|
50
60
|
|
51
|
-
|
52
|
-
|
61
|
+
```ruby
|
62
|
+
client.users
|
63
|
+
client.users(state: "California", city: "San Francisco")
|
64
|
+
```
|
53
65
|
|
54
|
-
[Get basic information about
|
66
|
+
[Get basic information about a user][user]
|
55
67
|
|
56
|
-
[user]:
|
68
|
+
[user]: https://www.behance.net/dev/api/endpoints/2#users-get-1
|
57
69
|
|
58
|
-
|
59
|
-
|
70
|
+
```ruby
|
71
|
+
client.user(920309)
|
72
|
+
client.user("jonkap1")
|
73
|
+
```
|
60
74
|
|
61
|
-
[Get the projects published by
|
75
|
+
[Get the projects published by a user][user_projects]
|
62
76
|
|
63
|
-
[user_projects]:
|
77
|
+
[user_projects]: https://www.behance.net/dev/api/endpoints/2#users-get-2
|
64
78
|
|
65
|
-
|
66
|
-
|
67
|
-
|
79
|
+
```ruby
|
80
|
+
client.user_projects(920309)
|
81
|
+
client.user_projects("jonkap1")
|
82
|
+
client.user_projects("jonkap1", page: 2, sort: "views")
|
83
|
+
```
|
68
84
|
|
69
|
-
[Get the works-in-progress published by
|
85
|
+
[Get the works-in-progress published by a user][user_wips]
|
70
86
|
|
71
|
-
[user_wips]:
|
87
|
+
[user_wips]: https://www.behance.net/dev/api/endpoints/2#users-get-3
|
72
88
|
|
73
|
-
|
74
|
-
|
75
|
-
|
89
|
+
```ruby
|
90
|
+
client.user_wips(920309)
|
91
|
+
client.user_wips(920309, page: 2)
|
92
|
+
client.user_wips("jonkap1", sort: "comments", page: 3)
|
93
|
+
```
|
76
94
|
|
77
95
|
[Get a list of user's recently appreciated projects][user_appreciations]
|
78
96
|
|
79
|
-
[user_appreciations]:
|
97
|
+
[user_appreciations]: https://www.behance.net/dev/api/endpoints/2#users-get-13
|
80
98
|
|
81
|
-
|
82
|
-
|
99
|
+
```ruby
|
100
|
+
client.user_appreciations(920309)
|
101
|
+
client.user_appreciations("jonkap1", page: 2)
|
102
|
+
```
|
83
103
|
|
84
|
-
[Get a list of a user's collections
|
104
|
+
[Get a list of a user's collections][user_collections]
|
85
105
|
|
86
|
-
[user_collections]:
|
106
|
+
[user_collections]: https://www.behance.net/dev/api/endpoints/2#users-get-21
|
87
107
|
|
88
|
-
|
89
|
-
|
90
|
-
|
108
|
+
```ruby
|
109
|
+
client.user_collections(42)
|
110
|
+
client.user_collections(42, page: 2)
|
111
|
+
client.user_collections("rur", page: 2)
|
112
|
+
```
|
91
113
|
|
92
|
-
[Get user's statistics (all-time and today)
|
114
|
+
[Get user's statistics (all-time and today)][user_stats]
|
93
115
|
|
94
116
|
[user_stats]: https://www.behance.net/dev/api/endpoints/2#users-get-55
|
95
117
|
|
96
|
-
|
97
|
-
|
118
|
+
```ruby
|
119
|
+
client.user_stats(42)
|
120
|
+
client.user_stats("jonkap1")
|
121
|
+
```
|
98
122
|
|
99
|
-
[
|
123
|
+
[Get a list of creatives who follow the user][user_followers]
|
124
|
+
|
125
|
+
[user_followers]: https://www.behance.net/dev/api/endpoints/2#users-get-57
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
client.user_followers(1)
|
129
|
+
client.user_followers("foo", sort: "alpha", page: 2)
|
130
|
+
```
|
131
|
+
|
132
|
+
[Get a list of creatives followed by the user][user_following]
|
133
|
+
|
134
|
+
[user_following]: https://www.behance.net/dev/api/endpoints/2#users-get-59
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
client.user_following(1)
|
138
|
+
client.user_following("foo", sort: "alpha", page: 2)
|
139
|
+
```
|
140
|
+
|
141
|
+
[A list of the user's professional experience][user_work_experience]
|
100
142
|
|
101
143
|
[user_work_experience]: https://www.behance.net/dev/api/endpoints/2#users-get-71
|
102
144
|
|
103
|
-
|
104
|
-
|
145
|
+
```ruby
|
146
|
+
client.user_work_experience(42)
|
147
|
+
client.user_work_experience("jonkap1")
|
148
|
+
```
|
105
149
|
|
106
150
|
### Works in Progress
|
107
151
|
|
108
152
|
[Search for works-in-progress][wips]
|
109
153
|
|
110
|
-
[wips]:
|
154
|
+
[wips]: https://www.behance.net/dev/api/endpoints/3#work-in-progress-get-11
|
111
155
|
|
112
|
-
|
113
|
-
|
156
|
+
```ruby
|
157
|
+
client.wips
|
158
|
+
client.wips(time: "today", page: 2)
|
159
|
+
```
|
114
160
|
|
115
161
|
[Get information about a work in progress][wip]
|
116
162
|
|
117
|
-
[wip]:
|
163
|
+
[wip]: https://www.behance.net/dev/api/endpoints/3#work-in-progress-get-6
|
118
164
|
|
119
|
-
|
165
|
+
```ruby
|
166
|
+
client.wip(69)
|
167
|
+
```
|
120
168
|
|
121
169
|
[Get information and contents of a revision of a work in progress][wip_revision]
|
122
170
|
|
123
|
-
[wip_revision]:
|
171
|
+
[wip_revision]: https://www.behance.net/dev/api/endpoints/3#work-in-progress-get-7
|
124
172
|
|
125
|
-
|
173
|
+
```ruby
|
174
|
+
client.wip_revision(69, 133)
|
175
|
+
```
|
126
176
|
|
127
177
|
[Get comments on a revision of a work in progress][wip_revision_comments]
|
128
178
|
|
129
|
-
[wip_revision_comments]:
|
179
|
+
[wip_revision_comments]: https://www.behance.net/dev/api/endpoints/3#work-in-progress-get-8
|
130
180
|
|
131
|
-
|
181
|
+
```ruby
|
182
|
+
client.wip_revision_comments(69, 133)
|
183
|
+
client.wip_revision_comments(69, 133, page: 2)
|
184
|
+
```
|
132
185
|
|
133
186
|
### Collections
|
134
187
|
|
135
188
|
[Search for collections][collections]
|
136
189
|
|
137
|
-
[collections]:
|
190
|
+
[collections]: https://www.behance.net/dev/api/endpoints/5#collections-get-15
|
138
191
|
|
139
|
-
|
140
|
-
|
192
|
+
```ruby
|
193
|
+
client.collections
|
194
|
+
client.collections(time: "today", page: 2)
|
195
|
+
```
|
141
196
|
|
142
197
|
[Get basic information about a collection][collection]
|
143
198
|
|
144
|
-
[collection]:
|
199
|
+
[collection]: https://www.behance.net/dev/api/endpoints/5#collections-get-17
|
145
200
|
|
146
|
-
|
201
|
+
```ruby
|
202
|
+
client.collection(5074147)
|
203
|
+
```
|
147
204
|
|
148
205
|
[Get projects from a collection][collection_projects]
|
149
206
|
|
150
|
-
[collection_projects]:
|
207
|
+
[collection_projects]: https://www.behance.net/dev/api/endpoints/5#collections-get-19
|
151
208
|
|
152
|
-
|
153
|
-
|
209
|
+
```ruby
|
210
|
+
client.collection_projects(5074147)
|
211
|
+
client.collection_projects(5074147, page: 2)
|
212
|
+
```
|
154
213
|
|
155
214
|
### Creative Fields
|
156
215
|
|
157
|
-
[
|
216
|
+
[Retrieves all Creative Fields][fields]
|
158
217
|
|
159
218
|
[fields]: https://www.behance.net/dev/api/endpoints/11#creative-fields-get-75
|
160
219
|
|
161
|
-
|
220
|
+
```ruby
|
221
|
+
client.fields
|
222
|
+
```
|
223
|
+
|
224
|
+
[Retrieves popular Creative Fields][popular]
|
225
|
+
|
226
|
+
[popular]: https://www.behance.net/dev/api/endpoints/11#creative-fields-get-75
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
client.popular
|
230
|
+
```
|
231
|
+
|
232
|
+
### Creatives To Follow
|
233
|
+
|
234
|
+
[Provides a list of creatives you might be interested in following][creatives_to_follow]
|
235
|
+
|
236
|
+
[creatives_to_follow]: https://www.behance.net/dev/api/endpoints/9#creatives-to-follow-get-69
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
client.creatives_to_follow
|
240
|
+
client.creatives_to_follow(page: 2)
|
241
|
+
```
|
162
242
|
|
163
243
|
## Contributing
|
164
244
|
|
data/lib/behance/client.rb
CHANGED
@@ -3,6 +3,7 @@ require File.expand_path('../user', __FILE__)
|
|
3
3
|
require File.expand_path('../wips', __FILE__)
|
4
4
|
require File.expand_path('../collections', __FILE__)
|
5
5
|
require File.expand_path('../fields', __FILE__)
|
6
|
+
require File.expand_path('../creatives_to_follow', __FILE__)
|
6
7
|
require 'faraday'
|
7
8
|
require 'faraday_middleware'
|
8
9
|
|
@@ -18,6 +19,7 @@ module Behance
|
|
18
19
|
include Behance::Client::Wips
|
19
20
|
include Behance::Client::Collections
|
20
21
|
include Behance::Client::Fields
|
22
|
+
include Behance::Client::CreativesToFollow
|
21
23
|
|
22
24
|
attr_accessor :access_token, :connection
|
23
25
|
|
@@ -33,7 +35,7 @@ module Behance
|
|
33
35
|
# Returns a Faraday instance object.
|
34
36
|
def initialize(options={})
|
35
37
|
@access_token = options[:access_token]
|
36
|
-
@connection = Faraday.new(:
|
38
|
+
@connection = Faraday.new(url: Behance::Client::API_URL) do |b|
|
37
39
|
b.adapter Faraday.default_adapter
|
38
40
|
b.use FaradayMiddleware::ParseJson
|
39
41
|
end
|
data/lib/behance/collections.rb
CHANGED
@@ -4,13 +4,15 @@ module Behance
|
|
4
4
|
module Collections
|
5
5
|
# Public: Search for collections.
|
6
6
|
#
|
7
|
-
# options - The Hash
|
8
|
-
# :q
|
9
|
-
# :time
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
7
|
+
# options - The Hash with options that the API would expect:
|
8
|
+
# :q - Free text query string.
|
9
|
+
# :time - Limits the search by time.
|
10
|
+
# Possible values: all (default), today, week, month.
|
11
|
+
# :page - The page number of the results, always starting
|
12
|
+
# with 1.
|
13
|
+
# :sort - The order the results are returned in.
|
14
|
+
# Possible values: comments (default), views,
|
15
|
+
# last_item_added_date.
|
14
16
|
#
|
15
17
|
# Examples
|
16
18
|
#
|
@@ -30,29 +32,35 @@ module Behance
|
|
30
32
|
#
|
31
33
|
# @client.collection(1)
|
32
34
|
#
|
33
|
-
# Returns a single
|
35
|
+
# Returns a single collection object.
|
34
36
|
def collection(collection)
|
35
37
|
request("collections/#{collection}")["collection"]
|
36
38
|
end
|
37
39
|
|
38
40
|
# Public: Get projects from a collection.
|
39
41
|
#
|
40
|
-
# collection
|
41
|
-
# options
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
42
|
+
# collection - it has to be an ID (Integer).
|
43
|
+
# options - The Hash with options that the API would expect:
|
44
|
+
# :time - Limits the search by time.
|
45
|
+
# Possible values: all (default), today, week,
|
46
|
+
# month.
|
47
|
+
# :page - The page number of the results, always starting
|
48
|
+
# with 1.
|
49
|
+
# :sort - The order the results are returned in.
|
50
|
+
# Possible values: featured_date (default),
|
51
|
+
# appreciations, views, comments, published_date,
|
52
|
+
# followed.
|
53
|
+
# :per_page - The number of results per page. (Max: 20)
|
46
54
|
#
|
47
55
|
# Examples
|
48
56
|
#
|
49
57
|
# @client.collections_projects(1)
|
50
58
|
# @client.collections_projects(1, page: 2)
|
51
59
|
#
|
52
|
-
# Returns an array of projects
|
60
|
+
# Returns an array of projects from a collection in JSON format.
|
53
61
|
def collection_projects(collection, options={})
|
54
62
|
request("collections/#{collection}/projects", options)["projects"]
|
55
63
|
end
|
56
64
|
end
|
57
65
|
end
|
58
|
-
end
|
66
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Creatives To Follow Endpoints.
|
2
|
+
module Behance
|
3
|
+
class Client
|
4
|
+
module CreativesToFollow
|
5
|
+
# Public: Provides a list of creatives you might be interested
|
6
|
+
# in following
|
7
|
+
#
|
8
|
+
# options - The Hash with options that the API would expect:
|
9
|
+
# :page - The page number of the results, always
|
10
|
+
# starting with 1.
|
11
|
+
#
|
12
|
+
# Examples
|
13
|
+
#
|
14
|
+
# @client.creatives_to_follow
|
15
|
+
# @client.creatives_to_follow(page: 2)
|
16
|
+
#
|
17
|
+
# Returns an array of creatives in JSON format.
|
18
|
+
def creatives_to_follow(options={})
|
19
|
+
request("creativestofollow", options)["creatives_to_follow"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|