MJMortimer / elixero

Xero API client library for elixir
MIT License
17 stars 25 forks source link

Pass in Xero configuration when creating the Client struct #19

Open raouldevil opened 5 years ago

raouldevil commented 5 years ago

Xero API libraries in other languages (specifically Ruby) allow you to pass in the Xero credentials and file location when you initialize the Xero object for use. This is very useful when you have to interact with multiple Xero organizations from a single application.

Can we change this library to take in a map which has the credentials and file location when the client struct is created and then exclusively use those rather than use values from a config file?

So calling the create function would look something like this:

EliXero.create_client(%{ private_key_path: "priv/dev_xero_za-tmp.pem", consumer_key: "LKLKJLJLKJ", consumer_secret: "98BKBJKBK", app_type: :private })

I am happy to do this change and submit a pull request.