Giter Club home page Giter Club logo

nationbuilder-rb's Introduction

nationbuilder-rb

Build Status

A Ruby client for the NationBuilder API.

Installing

To install this gem to your current gemset, run:

$ gem install nationbuilder-rb

Or, add this to your gemfile:

gem 'nationbuilder-rb'

Creating a client

Require the gem:

require 'nationbuilder'

Then, create a client by specifying the name of your nation and your API token:

client = NationBuilder::Client.new('my_nation_name', 'my_api_token')

Calling the API

There is only a single method for calling the NationBuilder API in nationbuilder-rb, and that's the #call method on a client. The #call method takes three parameters: the name of the endpoint, the name of the method, and an optional hash containing arguments for the method.

Examples

Fetching a person

client.call(:people, :show, id: 15)

Creating a person

params = {
  person: {
    email: "[email protected]",
    last_name: "Smith",
    first_name: "Bob"
  }
}

client.call(:people, :create, params)

Destroying a person

client.call(:people, :destroy, id: 15)

Documentation

This gem includes a command line utility that prints out all covered endpoints, methods, and parameters. To see documentation for a single endpoint, run:

$ nbdoc ENDPOINT_NAME

To see all documentation, don't provide a endpoint name:

$ nbdoc

Example

$ nbdoc basic_pages

=====================
Endpoint: basic_pages
=====================

  Method: index
  Description: Shows a list of the basic pages in the system
  Required parameters: site_slug

  Method: create
  Description: Creates a basic page for a site
  Required parameters: site_slug

...

nationbuilder-rb's People

Contributors

dstockdale avatar davidhuie avatar

Watchers

 avatar James Cloos avatar

Forkers

hartogsmith

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.