Interfactura::Ruby

Interfactura Ruby is a small SDK written in Ruby to interact with the Interfactura web services.

Table of contents

Installation instructions

Add this line to your application's Gemfile:

gem 'interfactura-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install interfactura-ruby

Usage

We currently only support one operation from the web services, which is the invoice generation, an example on how to run this would be:


# We first create the client 
client = Interfactura::Ruby::Client.new(wsdl: "https://pruebas2.interfactura.com/OnLiveIFWebService/OnLiveIFWebService.asmx?WSDL", ssl_cert_file: "/certs/certificate.pem", ssl_cert_key_file: "/certs/key.pem")

# Then we create an invoice object
invoice = Interfactura::Ruby::Invoice.new({
    id:  "fake_id_1234",
    total: 123.50,
    rfc:  "AAAA881217TT1",
    name: "Nachito",
    phone: "1111111111",
    email:  "[email protected]",
    city: "Mexico City",
    municipality: "Monterrey",
    street: "Foo",
    number: "1234",
    zipcode: "64770",
    state: "NL",
    colony: "foo bar"
})

# And then we sign it through Interfactura

client.generate_document(invoice)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/interfactura-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.