diff --git a/README.md b/README.md index 2778047..43b8a51 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MYOB Api -[MYOB Api](https://github.com/davidlumley/myob-api) is an interface for accessing [MYOB](http://developer.myob.com/api/accountright/v2/)'s AccountRight Live API. +[MYOB Api](https://github.com/davidlumley/myob-api) is an interface for accessing [MYOB](http://developer.myob.com/api/accountright/v2/)'s AccountRight Live API. ## Installation @@ -24,12 +24,12 @@ If you've already got an OAuth access token, feel free to skip to API Client Set The MYOB API uses 3 legged OAuth2. If you don't want to roll your own, or use the [OmniAuth strategy](https://github.com/davidlumley/omniauth-myob) you can authenticate using the `get_access_code_url` and `get_access_token` methods that [ghiculescu](https://github.com/ghiculescu) has provided like so: - class MYOBSessionController + class MYOBSessionController def new redirect_to myob_client.get_access_code_url end - def create + def callback @token = myob_client.get_access_token(params[:code]) @company_files = myob_client.company_file.all # then show the user a view where they can log in to their company file @@ -41,8 +41,13 @@ The MYOB API uses 3 legged OAuth2. If you don't want to roll your own, or use th :key => YOUR_CONSUMER_KEY, :secret => YOUR_CONSUMER_SECRET, }, + :redirect_uri => redirect_uri }) end + + def redirect_uri + callback_myob_session_url + end end ### API Client Setup @@ -104,7 +109,7 @@ Select a company file to work with :password => COMPANY_FILE_PASSWORD, }) -#### Contacts +#### Contacts Return a list of all contacts @@ -167,13 +172,11 @@ To update an existing entity, call #save on its model, passing through a hash yo user['FirstName'] = 'New First Name' api_client.employee.save(user) - ## Todo -* Expand API methods -* Refactor client factory architecture -* Tests - +- Expand API methods +- Refactor client factory architecture +- Tests ## Contributing diff --git a/lib/myob-api.rb b/lib/myob-api.rb index 9d91fff..f0f0d8d 100644 --- a/lib/myob-api.rb +++ b/lib/myob-api.rb @@ -21,6 +21,10 @@ require 'myob/api/models/customer_payment' require 'myob/api/models/invoice' require 'myob/api/models/invoice_item' +require 'myob/api/models/invoice_miscellaneous' +require 'myob/api/models/invoice_professional' +require 'myob/api/models/invoice_service' +require 'myob/api/models/invoice_time_billing' require 'myob/api/models/payroll_category' require 'myob/api/models/wage' diff --git a/lib/myob/api/models/invoice_miscellaneous.rb b/lib/myob/api/models/invoice_miscellaneous.rb new file mode 100644 index 0000000..05449f3 --- /dev/null +++ b/lib/myob/api/models/invoice_miscellaneous.rb @@ -0,0 +1,11 @@ +module Myob + module Api + module Model + class InvoiceMiscellaneous < Base + def model_route + 'Sale/Invoice/Miscellaneous' + end + end + end + end +end diff --git a/lib/myob/api/models/invoice_professional.rb b/lib/myob/api/models/invoice_professional.rb new file mode 100644 index 0000000..04e8e18 --- /dev/null +++ b/lib/myob/api/models/invoice_professional.rb @@ -0,0 +1,11 @@ +module Myob + module Api + module Model + class InvoiceProfessional < Base + def model_route + 'Sale/Invoice/Professional' + end + end + end + end +end diff --git a/lib/myob/api/models/invoice_service.rb b/lib/myob/api/models/invoice_service.rb new file mode 100644 index 0000000..ce9e584 --- /dev/null +++ b/lib/myob/api/models/invoice_service.rb @@ -0,0 +1,11 @@ +module Myob + module Api + module Model + class InvoiceService < Base + def model_route + 'Sale/Invoice/Service' + end + end + end + end +end diff --git a/lib/myob/api/models/invoice_time_billing.rb b/lib/myob/api/models/invoice_time_billing.rb new file mode 100644 index 0000000..6b2a9d9 --- /dev/null +++ b/lib/myob/api/models/invoice_time_billing.rb @@ -0,0 +1,11 @@ +module Myob + module Api + module Model + class InvoiceTimeBilling < Base + def model_route + 'Sale/Invoice/TimeBilling' + end + end + end + end +end