Sha256: c8ccb0c39f00794a40e3c54370728d0a5bbff4fd7eee6e47046b1c35d399962d

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

module ActionNetworkRest
  class Client < Vertebrae::API
    attr_accessor :api_key

    def initialize(options={}, &block)
      self.api_key = options[:api_key]
      super(options={}, &block)
    end

    def default_options
      {
        host: 'actionnetwork.org',
        prefix: '/api/v2',
        content_type: 'application/json',
        additional_headers: {'OSDI-API-Token' => api_key},
        user_agent: 'ruby: ActionNetworkRest'
      }
    end

    def extract_data_from_params(params)
      params.to_json
    end

    ## Helpers to let users do things like `an_client.people.create(params)`

    def entry_point
      @_entry_point ||= ActionNetworkRest::EntryPoint.new(client: self)
    end

    def people
      @_people ||= ActionNetworkRest::People.new(client: self)
    end

    def petitions(petition_id=nil)
      @_petitions ||= ActionNetworkRest::Petitions.new(petition_id, client: self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_network_rest-0.2.0 lib/action_network_rest/client.rb