- Notifications
You must be signed in to change notification settings - Fork4
A Ruby wrapper for the NGP-VAN API
License
MIT, MIT licenses found
Licenses found
christopherstyles/ngp_van
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An unofficial Ruby wrapper for theNGP VAN RESTful API.
Install via Rubygems:
geminstallngp_van
Or add this line to your application's Gemfile:
gem'ngp_van'
ngp_van is cryptographically signed. To be sure the gem you install hasn’t been tampered with, add the public key as a trusted certificate:
gem cert --add <(curl -Ls https://raw.github.com/christopherstyles/ngp_van/master/certs/christopherstyles.pem)Then install with:
gem install ngp_van -P MediumSecurityor if using bundler:
bundle install --trust-policy MediumSecurityTheMediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.
This is necessary because not all ofngp_vans dependencies are signed, so we cannot useHighSecurity.
NGP VAN can be configured using a block:
NgpVan.configuredo |config|config.application_name='MyCampaignApp'# See http://developers.everyaction.com/van-api#van-authenticationconfig.api_key='de286a1a-f2e7-421a-91b8-f8cc8201558f|1'# Defaults to "https://api.securevan.com/v4/"config.api_endpoint='https://intlapi.securevan.com/v4'# Defaults to "NGP VAN Ruby Gem #{NgpVan::VERSION}"config.user_agent='CustomUserAgent'end
Options can also be set on the configuration object:
% NgpVan.configuration.api_key = 'de286a1a-f2e7-421a-91b8-f8cc8201558f|1'# => "de286a1a-f2e7-421a-91b8-f8cc8201558f|1"
In a multi-threaded environment you may want to use multiple configurations simultaneously.In that case, pass an appropriately setup configuration class to the client object.
configuration=NgpVan::Configuration.newconfiguration.api_key='de286a1a-f2e7-421a-91b8-f8cc8201558f|1'client=NgpVan::Client.new(configuration)client.district_fields
API Methods can be called as module methods or as instance methods on the client.
NgpVan.district_fields# => [# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...},# {"districtFieldId"=>4, "name"=>"County", "parentFieldId"=>1...}# ]
or
client=NpgVan.clientclient.district_fields# => [# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...},# {"districtFieldId"=>4, "name"=>"County", "parentFieldId"=>1...}# ]
After checking out the repo, runrake spec to run the tests.
A console task has also been provided to automatically load the NGP VAN environment. Runbin/console for an interactive prompt that will allow you to experiment.
% bin/console[1] pry(main)> NgpVan::VERSION# => "x.x.x"[2] pry(main)> NgpVan.configuration.application_name = 'MyCampaignApplication'# => "MyCampaignApplication"[3] pry(main)> NgpVan.configuration.api_key = 'de286a1a-f2e7-421a-91b8-f8cc8201558f|1'# => "de286a1a-f2e7-421a-91b8-f8cc8201558f|1"[4] pry(main)> NgpVan.district_fields# => [# {"districtFieldId"=>1, "name"=>"State", "parentFieldId"=>nil...,# {"districtFieldId"=>2, "name"=>"County", "parentFieldId"=>1...# ]
Bug reports and pull requests are welcome on GitHub athttps://github.com/christopherstyles/ngp_van/issues.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to theContributor Covenant code of conduct.
The gem is available as open source under the terms of theMIT License.
About
A Ruby wrapper for the NGP-VAN API
Resources
License
MIT, MIT licenses found
Licenses found
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.