Skip to content

Commit 8f0492a

Browse files
committed
Merge pull request #167 from adrianjonmiller/patch-1
2 parents fbef033 + f5ef091 commit 8f0492a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/jekyll-import/importers/behance.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ def self.process(options)
3434
user = options.fetch('user')
3535
token = options.fetch('api_token')
3636

37-
projects = fetch_projects(token, user)
37+
client = fetch_behance(token)
3838

39-
puts "#{projects.length} project(s) found. Importing now..."
39+
user_projects = client.user_projects(user)
4040

41-
projects.each do |project|
41+
puts "#{user_projects.length} project(s) found. Importing now..."
42+
43+
user_projects.each do |project|
4244

4345
details = client.project(project['id'])
4446
title = project['name'].to_s
@@ -53,15 +55,15 @@ def self.process(options)
5355
header = {
5456
"layout" => "post",
5557
"title" => title,
56-
"project" => details
58+
"details" => details
5759
}
5860

5961
FileUtils.mkdir_p("_posts")
6062

6163
File.open("_posts/#{name}.md", "w") do |f|
6264
f.puts header.to_yaml
6365
f.puts "---\n\n"
64-
f.puts details['description']
66+
f.puts details['description'].to_s
6567
end
6668
end
6769

@@ -70,8 +72,8 @@ def self.process(options)
7072

7173
private
7274

73-
def self.fetch_projects(token, user)
74-
Behance::Client.new(access_token: token).user_projects(user)
75+
def self.fetch_behance(token)
76+
::Behance::Client.new(access_token: token)
7577
end
7678
end
7779
end

0 commit comments

Comments
 (0)