-
Notifications
You must be signed in to change notification settings - Fork 312
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
Conversation
|
||
require 'date' | ||
require 'time' | ||
require 'behance' |
There was a problem hiding this comment.
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 :)
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.
Nah, this is perfect.
We merge everything into the main branch here and deploy that to RubyGems.org.
As long as it's never anyone else's work (without the consent/attribution of the other owner) then you should be OK. |
@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 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] |
There was a problem hiding this comment.
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]
.
There was a problem hiding this comment.
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]
@drewish sounds right :) thanks. |
Looking really great! Any way you could add in some tests for it so we don't break it in the future? |
@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? |
@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"? |
So I've totally reorganized the importers which makes this pull unmergeable as-is. |
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. |
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.