Skip to content

Adds support to other invoice types and minor update to README #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -104,7 +109,7 @@ Select a company file to work with
:password => COMPANY_FILE_PASSWORD,
})

#### Contacts
#### Contacts

Return a list of all contacts

Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions lib/myob-api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions lib/myob/api/models/invoice_miscellaneous.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Myob
module Api
module Model
class InvoiceMiscellaneous < Base
def model_route
'Sale/Invoice/Miscellaneous'
end
end
end
end
end
11 changes: 11 additions & 0 deletions lib/myob/api/models/invoice_professional.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Myob
module Api
module Model
class InvoiceProfessional < Base
def model_route
'Sale/Invoice/Professional'
end
end
end
end
end
11 changes: 11 additions & 0 deletions lib/myob/api/models/invoice_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Myob
module Api
module Model
class InvoiceService < Base
def model_route
'Sale/Invoice/Service'
end
end
end
end
end
11 changes: 11 additions & 0 deletions lib/myob/api/models/invoice_time_billing.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Myob
module Api
module Model
class InvoiceTimeBilling < Base
def model_route
'Sale/Invoice/TimeBilling'
end
end
end
end
end