Module: NationBuilder

Defined in:
lib/nation_builder.rb,
lib/nation_builder/tags.rb,
lib/nation_builder/client.rb,
lib/nation_builder/people.rb,
lib/nation_builder/actions/list.rb,
lib/nation_builder/actions/show.rb,
lib/nation_builder/actions/create.rb,
lib/nation_builder/actions/update.rb,
lib/nation_builder/remote_controller.rb,
lib/nation_builder/exceptions/validation_error.rb

Defined Under Namespace

Modules: Actions, Exceptions Classes: Client, People, RateLimitedError, RemoteController, Tags

Class Method Summary collapse

Class Method Details

.method_missing(method, *args) ⇒ Object



33
34
35
36
# File 'lib/nation_builder.rb', line 33

def method_missing(method, *args)
  return super unless new.respond_to?(method)
  new.send(method, *args)
end

.new(options = {}) ⇒ Object

Initializes a new NationBuilder client

Parameters:

  • options (Hash) (defaults to: {})

    the options to make the request with

Options Hash (options):

  • :client_id (String)

    client ID used for OAuth 2.0 authenticated requests

  • :client_secret (String)

    secret used for OAuth 2.0 authenticated requests

  • :hostname (String)

    NationBuilder site hostname, must not include protocol (i.e.: ‘http://’)

  • :token (String)

    OAuth2 access token used for perform authenticated calls. Not required if performing authenticated calls with :username and :password

  • :username (String)

    username used for getting a OAuth 2.0 access token. Not required if performing authenticated calls with :token

  • :password (String)

    password used for getting a OAuth 2.0 access token. Not required if performing authenticated calls with :token

  • :instrumentation (Proc)

    block of code to be invoked on every request to NationBuilder. Should receive a single Hash argument that includes :path and :request_type. :path argument is normalized, replacing IDs with ‘_’

  • :logger (Logger)

    optional. If provided, rate limit related headers from successful responses will be logged.



29
30
31
# File 'lib/nation_builder.rb', line 29

def new(options = {})
  NationBuilder::Client.new(options)
end

.respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/nation_builder.rb', line 38

def respond_to?(method, include_private = false)
  new.respond_to?(method, include_private) || super(method, include_private)
end