README.md in erp_integration-0.6.0 vs README.md in erp_integration-0.7.0
- old
+ new
@@ -1,8 +1,8 @@
# Mejuri's ERP integration
-TODO: Add a accurate description for the gem.
+The ERP integration gem allows connecting to multiple ERP at the same time and query the data from these ERP's. It's currently only supporting [Fulfil](https://www.fulfil.io).
## Installation
Add this line to your application's Gemfile:
@@ -14,12 +14,10 @@
```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:
@@ -30,75 +28,101 @@
config.fulfil_api_key = '<your-api-key>'
config.fulfil_merchant_id = '<your-merchant-id>'
end
```
-### Querying third-party vendors
+### Supported Query Methods
-After configuring the gem, one can easily query all the available ERP resources from the connected third-parties.
+After configuring the gem, one can easily query all the available ERP resources from the connected third-parties. In all cases, the API will return a collection of resources.
+> **NOTE**: If you need to lookup an individual resource take a look at the "Supported finder methods" section.
+
```ruby
$ ErpIntegration::SalesOrder.where(reference: 'MT1000SKX')
-=> #<ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @id=100 />] />
+=> [<ErpIntegration::SalesOrder @id=100 />]
```
-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')
-=> #<ErpIntegration::Fulfil::Collection @items=[<ErpIntegration::SalesOrder @id=100 @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
+### Supported Finder Methods
-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.
+The __Query Methods__ allow you to lookup a list of resources. The __Finder Methods__ allow you to lookup **an individual resource** from the API.
-TODO: Write instructions for publishing the gem to the Github package registry.
+- `#find` looks up a resource by id and raises `ErpIntegration::ResourceNotFound` when no result is found.
+- `#find_by` looks up a resource by a given set of query methods and returns `nil` when no result is found.
+- `#find_by!` looks up a resource by a given set of query methods and raises `ErpIntegration::ResourceNotFound` when no result is found.
-## Contributing
+A difference between the query methods and the finder methods is the way it's executed. The finder methods are executed directly after they're called. The query methods will be lazily executed.
-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).
+```ruby
+$ ErpIntegration::SalesOrder.find(100)
+# => #<ErpIntegration::SalesOrder @id=100 />
-## License
+$ ErpIntegration::SalesOrder.find_by(code: "MT100")
+# => #<ErpIntegration::SalesOrder @id=100 />
-The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
+$ ErpIntegration::SalesOrder.find_by!(code: "MT100")
+# => #<ErpIntegration::SalesOrder @id=100 />
+```
-## Code of Conduct
+### Supported Selection Methods
-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).
+By default, only the `id` will be added to ERP resources. However, one can use the `select` method to include more fields.
-## Releasing
+```ruby
+$ ErpIntegration::SalesOrder.select(:id, :reference).find_by(reference: 'MT1000SKX')
+# => <ErpIntegration::SalesOrder @id=100 @reference=MT1000SKX />
+```
-### Prerequisites
+## 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.
+
+### 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/)
+> [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.
+It's important to note that you'll need the right privileges to publish the gem. Ask [@germansvriz](https://github.com/germansvriz) or [@stefanvermaas](https://github.com/stefanvermaas) to add you as a gem owner.
-### Publish a new version
+**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
-```
+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.
+
+## 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).