CrowdFundingParser
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'crowd_funding_parser'And then execute:
$ bundle
Or install it yourself as:
$ gem install crowd_funding_parser
Usage
You can use it to get single project's attributes, listed below (sometimes just some of them):
project id(platform_project_id)titlecategorycreator_namecreator_idcreator_linksummarystart_dateend_dateregioncurrency_stringmoney_goalmoney_pledgedbacker_countleft_timestatusfb_countfollowing_count
by using:
flyingv_parser = CrowdFundingParser::Parser::Flyingv.new
project_data = flyingv_parser.get_project(PROJECT_URL)Or you can use it to get all project's links, using
flyingv_parser = CrowdFundingParser::Parser::Flyingv.new
project_links = flyingv_parser.get_project_links(STATUS) # "finished" or "online"Contributing
- Fork it ( https://github.com/[my-github-username]/crowd_funding_parser/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Add New Parser
1. Add Test
What to test
There should be 18 methods that need to be tested:
get_idget_titleget_categoryget_creator_nameget_creator_idget_creator_linkget_summaryget_start_dateget_end_dateget_regionget_currency_stringget_money_goalget_money_pledgedget_backer_countget_left_timeget_statusget_fb_countget_following_count
How to write a test
- Use
get_project_doc(campaign_page_url, platform_name)to get test doc (please use a finished project). - Set expectations as the project's attributes (use
""if can't get that attribute). - Example spec.
How to run test
We use Rspec to run our test, so just run bundle exec rspec.
Or you can run bundle exec guard to automatically run tests whenever you changed spec.
Add Parser(only deal with single project's data parsing)
-
Place your parser in
lib/crowd_funding_parsers/parser -
Naming your parser class after its platform's name
-
Write parser in
MethodBuilder.set_methodsblock: -
use
insert_parsermethod to register your parser class in method_builder -
use
set_variableto set variables you need to use in parser methods, like@platform_url -
use
set_methodto define method -
if you need to use methods you set in method_builder, call it with
@parservariable.