# Mejuri's ERP integration TODO: Add a accurate description for the gem. ## Installation Add this line to your application's Gemfile: ```ruby gem 'erp_integration' ``` Or run the following command to add `ErpIntegration` to your Gemfile: ```shell $ bundle add erp_integration ``` TODO: Write installation instructions here for the Github package registry. ## Usage ### Configuration To configure the gem, create an initializer and add the following lines: ```erb # config/initializers/erp_integration.rb ErpIntegration.configure do |config| config.fulfil_api_key = '' config.fulfil_merchant_id = '' end ``` ### Querying third-party vendors After configuring the gem, one can easily query all the available ERP resources from the connected third-parties. ```ruby $ ErpIntegration::SalesOrder.where(reference: 'MT1000SKX') => #] /> ``` By default, only the `id` will be added to the found ERP resources. However, one can use the `select` method to include more fields. ```ruby $ ErpIntegration::SalesOrder.select(:id, :reference).where(reference: 'MT1000SKX') => #] /> ``` There are also other type of `where` queries available: - `where_like` for case sensitive queries. - `where_ilike` for case insensitive queries. - `where_not` for non-equality queries. - `where_in` for inclusion queries. - `where_not_in` for exclusion queries. ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. TODO: Write instructions for publishing the gem to the Github package registry. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/mejuri-inc/erp_integration. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mejuri-inc/erp_integration/blob/main/CODE_OF_CONDUCT.md). ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the ErpIntegration project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mejuri-inc/erp_integration/blob/main/CODE_OF_CONDUCT.md). ## Releasing ### Prerequisites To be able to publish a new release, you'll need to set up a Rubygems account. > To begin, you’ll need to create an account on RubyGems.org. Visit the sign up page and supply an email address that you control, a handle (username) and a password. > > After creating the account, use your email and password when pushing the gem. (RubyGems saves the credentials in ~/.gem/credentials for you so you only need to log in once.) > - [Publishing to RubyGems.org](https://guides.rubygems.org/publishing/) It's important to note that you'll need the right privileges to publish the gem. Ask @germansvriz to add you as a gem owner. ### Publish a new version 1 - Run the prerelease script ```shell $ bin/prerelease 0.0.1 ``` 2 - Create Pull Request 3 - Merge it to main 4 - Run Release script ```shell $ bin/release 0.0.1 ``` We're following [semver](https://semver.org/) for the release process of this gem. Make sure to apply the correct semver version for a new release. > **NOTE**: You don't have to add a `v` to the version you want to release. The release script will handle that for you.