Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Behance Importer #46

Closed
wants to merge 9 commits into from
Closed

Add Behance Importer #46

wants to merge 9 commits into from

Conversation

rayfranco
Copy link
Contributor

Hello,

— I'm really new to Ruby so, thank in advance for your indulgence —

I've built a little importer draft that works with Behance's API. It imports all projects from a specific user and create new post entries for each project. For now, it's pretty straightforward : all the meta datas returned by the API are stored in the post variable named "project", all of them, as delivered.

So, before going any further, I'd like to have some feedback from you guys.

I'm pretty sure it could be better if the project modules are printed in the post content (instead of relying on the metadatas) and if images are stored locally.

Do this project follow the jekyll-import guidelines? Should I publish it as a standalone import script? And what about new branches for new importers, I haven't seen one. And finally, do you think an importer go against the API terms of use?

Any help and feedback is welcome.

Thanks.


require 'date'
require 'time'
require 'behance'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please catch the potential LoadError and print a nice message to ask the user to install the gem :)

@parkr
Copy link
Member

parkr commented Aug 10, 2013

I'm pretty sure it could be better if the project modules are printed in the post content (instead of relying on the metadatas) and if images are stored locally.

The metadata is nice because it allows more flexibility in styling. If you output modules, it would be a lot harder for me to make my tweaks. I think adding the fields as metadata and maybe a description or something as content, then you're on the right track with Jekyll.

Do this project follow the jekyll-import guidelines? Should I publish it as a standalone import script?

Nah, this is perfect.

And what about new branches for new importers, I haven't seen one.

We merge everything into the main branch here and deploy that to RubyGems.org.

And finally, do you think an importer go against the API terms of use?

As long as it's never anyone else's work (without the consent/attribution of the other owner) then you should be OK.

@rayfranco
Copy link
Contributor Author

@parkr thanks for your encouraging feedback. Here my updated code, raked and tested in a real jekyll environment. Works great, I should maybe make sure all the metadatas are usable, but I guess safe_yaml did its job.

I'am just not sure about importing assets (at least images) in a local folder, but this would go against the API that serve full URL, and this involve rewriting URL in modules, which I think is not a very good idea. What do you think ?

module JekyllImport
module BehanceImport
def self.validate(options)
if !options[:user]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm still pretty new to ruby so take it with a grain of salt, but i feel like it's more ruby-esq to do use unless options[:user] rather than if !options[:user].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and frequently you see it as a modifier:

abort "Missing mandatory option --user." unless options[:user]

@rayfranco
Copy link
Contributor Author

@drewish sounds right :) thanks.

@parkr
Copy link
Member

parkr commented Aug 14, 2013

Looking really great! Any way you could add in some tests for it so we don't break it in the future?

@rayfranco
Copy link
Contributor Author

@parkr of course, but I have several questions. Is it a good practice to test the return of an API? If so, how can I test it without providing an API key in the test files?
Also, how can I test jekyll-import output? I can see a helper.rb but I don't see any test using it yet.

@parkr
Copy link
Member

parkr commented Sep 29, 2013

@rayfranco Sorry for the ridiculously long delay! It's not generally good practice to test the API directly, but to test with mock data. That is, you should be able to override your method which accesses the API and send back mock data so you know what to expect.

What do you mean, "test jekyll-import output"?

@parkr
Copy link
Member

parkr commented Nov 10, 2013

So I've totally reorganized the importers which makes this pull unmergeable as-is.

@parkr parkr closed this Dec 8, 2013
@parkr parkr mentioned this pull request Dec 8, 2013
@rayfranco
Copy link
Contributor Author

Sorry for the late reply, but I currently have no plan to work on this PR since I've moved to a node based generator.

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants