Fluxx

This a simple SDK for the Fluxx V2 API.

At the moment, it's optimized for read-only operations!

Installation

Add this line to your application's Gemfile:

gem 'fluxx'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluxx

Usage

To start using the application we will need the following environment variables:

  • FLUXX_CLIENT_ID - the OAuth client ID (see below hot to get one)
  • FLUXX_SECRET - the OAuth client secret (see below hot to get one)
  • FLUXX_INSTANCE_URL - the URL of the Fluxx instance, ex: https://my.preprod.fluxxlabs.com

If you need to work with multiple instances, provide these variables through the Thread.current.thread_variable_set(key, value) and make sure you run separate threads for every instance.

With the credentials in place, the following models are available through the SDK:

  • Fluxx::GrantRequest
  • Fluxx::RequestReport
  • Fluxx::RequestOrganization
  • Fluxx::RequestUser
  • Fluxx::RequestTransaction
  • Fluxx::Organization
  • Fluxx::Program
  • Fluxx::SubProgram
  • Fluxx::ModelDocument
  • Fluxx::User
  • Fluxx::GeoCountry
  • Fluxx::GeoState

Any of the models allows the following CRUD methods:

  • all
  • find
  • create
  • update
  • delete

Here's an example on how to fetch all grant requests:

Fluxx::GrantRequest.all(all_core: true, all_dynamic: true)

Or just one record:

Fluxx::GrantRequest.find(1, all_core: true, all_dynamic: true)

To request a filtered collection, use the filter query parameter with a JSON string similar to the ElasticSearch spec.

Fluxx::RequestTransaction.all(
  all_core: true,
  all_dynamic: true,
  filter: { group_type: :and, conditions: [ [:request_id, :eq, 1] ] }.to_json
)

Client ID & Secret

To get an OAuth client ID and a secret, you will need to access the /oauth/applications/ page of your Fluxx instance.

Use the tools provided in the screen to create a new application.

Finally, use the ID and the secret as FLUXX_CLIENT_ID and the FLUXX_SECRET environment variables to make the SDK work.

Provide the FLUXX_INSTANCE_URL environment variable with the full URL to your Fluxx instance (ex. https://<MY INSTANCE NAME>.preprod.fluxxlabs.com).

Development

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/impactmapper/fluxx. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Fluxx project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.