MYOB Api is an interface for accessing MYOB's AccountRight Live API.
Add this line to your application's Gemfile:
gem 'myob-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install myob-api
Create an api_client:
api_client = Myob::Api::Client.new({
:consumer => {
:key => YOUR_CONSUMER_KEY,
:secret => YOUR_CONSUMER_SECRET,
},
:access_token => YOUR_OAUTH_ACCESS_TOKEN,
})
Or if you know which Company File you want to access too:
api_client = Myob::Api::Client.new({
:consumer => {
:key => YOUR_CONSUMER_KEY,
:secret => YOUR_CONSUMER_SECRET,
},
:access_token => YOUR_OAUTH_ACCESS_TOKEN,
:company_file => {
:id => COMPANY_FILE_ID,
:username => COMPANY_FILE_USERNAME,
:password => COMPANY_FILE_PASSWORD,
},
})
Before using the majority of API methods you will need to have selected a Company File. If you've already selected one when creating the client, feel free to ignore this.
Return a list of company files
api_client.company_file.all
Select a company file to work with
api_client.select_company_file({
:id => COMPANY_FILE_ID,
:username => COMPANY_FILE_USERNAME,
:password => COMPANY_FILE_PASSWORD,
})
Return a list of all contacts
api_client.contact.all
Return a list of all customers (a subset of contacts)
api_client.customer.all
- Expand API methods
- Refactor client factory architecture
- Tests
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request