behance 0.4.0 → 0.5.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjM1MjY1NWVlM2EyMTJjYWQ5MGU5NzRmZDE1NzAxOWRiMDMzOTYxMw==
4
+ MDFjNzI2YzU4NDQxMDljY2U2OTMzZTZjMWM4ZGJlMWEyZWM2Zjk3Nw==
5
5
  data.tar.gz: !binary |-
6
- NGIxZTVjYmFjMDNlNTgzOTAwNWEyMmFhZTg4MmIzZjQwZDkxMDcxNw==
6
+ OGMwNDVmZWM2MDBhOWU0ZTE3ZDVlZDYxMTQxODUyZTQ2NWUxMzhkZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmFjZDMxNDc2NzFiY2NlZDhiZjMzMTI0YjAwZjhlN2MyNWM0MWY1ZWNjMmVk
10
- MzRlOWYwYmQwNTY2ZGMwNTk5MTdlMzAwYTkxNTdiMzc0NjJjNDZlOTdhY2Fj
11
- Y2U3MTQ0OGQ1ZjE2ZGMwZWQ1NjFjMTAwYjY5MjBhZTZkY2ViZTY=
9
+ MGZiOWYwYjFlMzY4YmI5YWZmYjk0NjQ1ZTk3NWRhNjdkZDBhNDcwMmNhZmM1
10
+ YmUyNDRkM2NjZjJmMDcwYmFmYjk2MTQwYzkwYzIzMTFjNDE4NWVkYTRlMmE2
11
+ YjU2YTRiYjBmOTVhM2MxNTRlOTk1ZjhkYmJmZmQ3NjY4NjMyNzE=
12
12
  data.tar.gz: !binary |-
13
- OTAxMDNhMjE5ZDE4MTczYTVkYWYzOTFjNmFlYWU3MDk5NjNmOGU0NzQ3ZmFi
14
- MzM3NGU2MmZkODhjMWM5NzI2NmJjNjg5ODFiOGI1ZTBhNzYzNmJmYjBjMTcx
15
- YWViMWZkMGU0OWJiYmZiNWE0ZjQ4ZDBmNzUzMDljODM5Zjg2NGI=
13
+ NDU4ZGI4OTk3ZDIxZjU0ZTZkYzE4NTE0NTYyNmYzMWMwNTc2ZjkzMGM3Yzc0
14
+ MWMyMjM4YWZlYzEyNmM1N2E0ZjMzMTljZjk3MWUxZjg2YmJjOTc2M2VlMjJi
15
+ YTAxOGQ1MGFmNGQ4MDkyNjQ1NWNlYWNiMmJhMWQxNTczMmI4NDc=
data/README.md CHANGED
@@ -89,6 +89,20 @@ Once you get it, you'll be able to start playing
89
89
  $ client.user_collections(42, page: 2)
90
90
  $ client.user_collections("rur", page: 2)
91
91
 
92
+ [Get user's statistics (all-time and today).][user_stats]
93
+
94
+ [user_stats]: https://www.behance.net/dev/api/endpoints/2#users-get-55
95
+
96
+ $ client.user_stats(42)
97
+ $ client.user_stats("jonkap1")
98
+
99
+ [A list of the user's professional experience.][user_work_experience]
100
+
101
+ [user_work_experience]: https://www.behance.net/dev/api/endpoints/2#users-get-71
102
+
103
+ $ client.user_work_experience(42)
104
+ $ client.user_work_experience("jonkap1")
105
+
92
106
  ### Works in Progress
93
107
 
94
108
  [Search for works-in-progress][wips]
@@ -121,6 +121,34 @@ module Behance
121
121
  def user_collections(user)
122
122
  request("users/#{user}/collections")["collections"]
123
123
  end
124
+
125
+ # Public: Get user's statistics (all-time and today).
126
+ #
127
+ # user - can be an ID (Integer) or username (String).
128
+ #
129
+ # Examples
130
+ #
131
+ # @client.user_stats(1)
132
+ # @client.user_stats("foo")
133
+ #
134
+ # Returns "today" and "all_time" stats objects.
135
+ def user_stats(user)
136
+ request("users/#{user}/stats")["stats"]
137
+ end
138
+
139
+ # Public: A list of the user's professional experience.
140
+ #
141
+ # user - can be an ID (Integer) or username (String).
142
+ #
143
+ # Examples
144
+ #
145
+ # @client.user_work_experience(1)
146
+ # @client.user_work_experience("foo")
147
+ #
148
+ # Returns an array od user's professions experience.
149
+ def user_work_experience(user)
150
+ request("users/#{user}/work_experience")["work_experience"]
151
+ end
124
152
  end
125
153
  end
126
154
  end
@@ -1,3 +1,3 @@
1
1
  module Behance
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -155,4 +155,40 @@ describe Behance::Client::User do
155
155
  @collections.size.should == 2
156
156
  end
157
157
  end
158
+
159
+ describe "#user_stats" do
160
+ before do
161
+ stub_get("users/1/stats").with(query: @options).
162
+ to_return(body: fixture("user_stats.json"))
163
+ @stats = @client.user_stats(1)
164
+ end
165
+
166
+ it "makes a http request" do
167
+ a_get("users/1/stats").with(query: @options).
168
+ should have_been_made
169
+ end
170
+
171
+ it "gets a users stats" do
172
+ @stats.size.should == 2
173
+ @stats["today"]["project_appreciations"].should == 5
174
+ @stats["all_time"]["project_comments"].should == 20
175
+ end
176
+ end
177
+
178
+ describe "#user_work_experience" do
179
+ before do
180
+ stub_get("users/1/work_experience").with(query: @options).
181
+ to_return(body: fixture("user_work_experience.json"))
182
+ @work_experience = @client.user_work_experience(1)
183
+ end
184
+
185
+ it "makes a http request" do
186
+ a_get("users/1/work_experience").with(query: @options).
187
+ should have_been_made
188
+ end
189
+
190
+ it "gets a list of work_experience" do
191
+ @work_experience.size.should == 5
192
+ end
193
+ end
158
194
  end
@@ -0,0 +1,16 @@
1
+ {
2
+ "stats": {
3
+ "today": {
4
+ "project_views": 220,
5
+ "project_appreciations": 5,
6
+ "project_comments": 0,
7
+ "profile_views": 28
8
+ },
9
+ "all_time": {
10
+ "project_views": 33488,
11
+ "project_appreciations": 1841,
12
+ "project_comments": 20,
13
+ "profile_views": 6587
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+
3
+ "work_experience": [
4
+ {
5
+ "position": "Co-Founder & Chief of Design",
6
+ "organization": "Behance",
7
+ "location": "Brooklyn, NY, USA"
8
+ },
9
+ {
10
+ "position": "Senior Designer",
11
+ "organization": "AR Media",
12
+ "location": "Brooklyn, NY, USA"
13
+ },
14
+ {
15
+ "position": "Senior Designer",
16
+ "organization": "Pro Am",
17
+ "location": "New York, NY, USA"
18
+ },
19
+ {
20
+ "position": "Junior Designer",
21
+ "organization": "Zeligmedia",
22
+ "location": "Barcelona, Spain"
23
+ },
24
+ {
25
+ "position": "Junior Designer",
26
+ "organization": "Triada Comunicación",
27
+ "location": "Barcelona, Spain"
28
+ }
29
+ ]
30
+
31
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: behance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amed Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -118,7 +118,9 @@ files:
118
118
  - spec/fixtures/user_appreciations.json
119
119
  - spec/fixtures/user_collections.json
120
120
  - spec/fixtures/user_projects.json
121
+ - spec/fixtures/user_stats.json
121
122
  - spec/fixtures/user_wips.json
123
+ - spec/fixtures/user_work_experience.json
122
124
  - spec/fixtures/users.json
123
125
  - spec/fixtures/wip.json
124
126
  - spec/fixtures/wip_revision.json
@@ -166,7 +168,9 @@ test_files:
166
168
  - spec/fixtures/user_appreciations.json
167
169
  - spec/fixtures/user_collections.json
168
170
  - spec/fixtures/user_projects.json
171
+ - spec/fixtures/user_stats.json
169
172
  - spec/fixtures/user_wips.json
173
+ - spec/fixtures/user_work_experience.json
170
174
  - spec/fixtures/users.json
171
175
  - spec/fixtures/wip.json
172
176
  - spec/fixtures/wip_revision.json