Poseidon::Api
Cliente para interactuar con la API del sistema Poseidon.
Instalación
Agregar la siguiente linea a su Gemfile:
gem 'poseidon-api'
Y luego ejecutar:
$ bundle
O instalar directamente:
$ gem install poseidon-api
Modo de uso
Factura para clientes
api = Poseidon::API(url: 'http://poseidon-url.com', user: 'user@test.com', password: '12345')
invoice = Poseidon::Invoice.new(date: Date.today, sale_point: 1, number: 189122)
invoice.client = Poseidon::Client.new(name: 'Los alamos', cuit: 20243234221, iva_condition_id: 1)
invoice.details << Poseidon::Detail.new(amount: 10, unit_price: 15.50, description: 'Carpetas oficio', iva_rate: 21.0)
invoice.details << Poseidon::Detail.new(amount: 4, unit_price: 35.0, description: 'Carpetas plastificada', iva_rate: 21.0)
emitted = api.emit_invoice(invoice)
Retorna un booleano que indica si pudo o no emitir la factura.
En caso de no emitir la factura se pueden verificar los errores utilizando el método 'errors'
Factura de proveedores
api = Poseidon::API(url: 'http://poseidon-url.com', user: 'user@test.com', password: '12345')
invoice = Poseidon::Invoice.new(date: Date.today, sale_point: 1, number: 189122)
invoice.supplier = Poseidon::Supplier.new(name: 'Los alamos', cuit: 20243234221, iva_condition_id: 1)
invoice.details << Poseidon::Detail.new(amount: 10, unit_price: 15.50, description: 'Carpetas oficio', iva_rate: 21.0)
invoice.details << Poseidon::Detail.new(amount: 4, unit_price: 35.0, description: 'Carpetas plastificada', iva_rate: 21.0)
emitted = api.emit_invoice(invoice)
Links
- RDoc: http://rubydoc.info/github/apslab/poseidon-api/master/frames
- Source: https://github.com/apslab/poseidon-api
Contributing
- 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