-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added install generator #32
Open
7chris71000
wants to merge
3
commits into
master
Choose a base branch
from
features/20210625-creating-initial-generator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
source "https://rubygems.org" | ||
|
||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } | ||
|
||
# Specify your gem's dependencies in spire.gemspec | ||
gemspec | ||
|
||
# lower rails version | ||
gem "rails", "~> 4.0.0" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Spire | ||
|
||
Spire is a Ruby wrapper around the [Spire Systems API](http://www.spiresystems.com/). | ||
|
||
This gem was inspired by [ruby-trello](https://github.com/jeremytregunna/ruby-trello). | ||
|
@@ -22,13 +23,29 @@ gem 'spire', git: "https://github.com/bitesite/spire-ruby", tag: "v2.5.0" | |
|
||
And then execute: | ||
|
||
$ bundle | ||
```shell | ||
$ bundle | ||
``` | ||
|
||
## Usage | ||
|
||
First you will need to configure spire. This is a global configuration. Thus it will be applied anywhere you use spire within | ||
your application. | ||
|
||
### Rails | ||
|
||
There are 2 options to configure your rails project to use this gem. | ||
|
||
**Automated Rails Generator** | ||
|
||
Run the following command in your projects root folder. | ||
|
||
```shell | ||
$ rails generate spire:install | ||
``` | ||
|
||
**Manual** | ||
|
||
If you are using spire within a Rails application, you could put the following config in an initializer. | ||
|
||
```ruby | ||
|
@@ -41,97 +58,117 @@ end | |
``` | ||
|
||
### Items | ||
|
||
Below are a few usage examples. For other uses, please refer to `lib/item.rb`. | ||
|
||
Will retrieve one item from Spire | ||
|
||
```ruby | ||
Spire::Item.find(itemId) | ||
``` | ||
|
||
Will search Spire for an item that matches the given query | ||
|
||
```ruby | ||
Spire::Item.search('GF-1234') | ||
``` | ||
|
||
Will retrieve many Items based on a filter from Spire | ||
|
||
```ruby | ||
Spire::Item.filter('{"partNo":"ABCD-0001", "whse":"00"}') | ||
``` | ||
|
||
Will create a new item on Spire | ||
|
||
```ruby | ||
Spire::Item.create(options) | ||
``` | ||
|
||
Will delete an item from Spire | ||
|
||
```ruby | ||
Spire::Item.find(itemId).delete | ||
``` | ||
|
||
Updates item description on Spire | ||
|
||
```ruby | ||
item = Spire::Item.find(71) | ||
item.description = 'This is a new description' | ||
item.save | ||
``` | ||
|
||
### UPCs | ||
|
||
Below are a few usage examples. For other uses, please refer to `lib/upc.rb`. | ||
|
||
Will retrieve many UPCs based on a filter from Spire | ||
|
||
```ruby | ||
Spire::Upc.filter('{"partNo":"ABCD-0001", "whse":"00"}') | ||
``` | ||
|
||
Will retrieve one UPC from Spire | ||
|
||
```ruby | ||
Spire::Upc.find(upcId) | ||
``` | ||
|
||
Will create a new UPC on Spire | ||
|
||
```ruby | ||
Spire::Upc.create(upc: "12345678901", uomCode: "EA", inventory: {id: 1}) | ||
``` | ||
|
||
Will delete a UPC from Spire | ||
|
||
```ruby | ||
Spire::Upc.find(upcId).delete | ||
``` | ||
|
||
Updates a UPC on Spire | ||
|
||
```ruby | ||
upc = Spire::Upc.find(1) | ||
upc.upc = '12345678902' | ||
upc.save | ||
``` | ||
|
||
### Customers | ||
|
||
Below are a few usage examples. For other uses, please refer to `lib/customer.rb`. | ||
|
||
Will retrieve one customer from Spire | ||
|
||
```ruby | ||
Spire::Customer.find(customerId) | ||
``` | ||
|
||
Will search Spire for a customer that matches the given query | ||
|
||
```ruby | ||
Spire::Customer.search('[email protected]') | ||
``` | ||
|
||
### Orders | ||
|
||
The syntax for orders is very similar to items. For additional information please refer to `lib/order.rb`. | ||
|
||
Will retrieve one order from Spire | ||
|
||
```ruby | ||
Spire::Order.find(orderId) | ||
``` | ||
|
||
Will search Spire for any order that match the given query | ||
|
||
```ruby | ||
Spire::Order.search('[email protected]') | ||
``` | ||
|
||
Will create order in Spire | ||
|
||
```ruby | ||
Spire::Order.create({ | ||
'customer' => {'id': 'customer id'}, | ||
|
@@ -167,12 +204,15 @@ Spire::Order.create({ | |
'freight': '14' | ||
}) | ||
``` | ||
*Above is the minimum param to create an order in Spire* | ||
|
||
_Above is the minimum param to create an order in Spire_ | ||
|
||
### Vendors | ||
|
||
The syntax for vendors is very similar to items. For additional information please refer to `lib/vendor.rb`. | ||
|
||
Will retrieve one vendor from Spire | ||
|
||
```ruby | ||
Spire::Vendor.find(vendorId) | ||
``` | ||
|
@@ -193,23 +233,23 @@ To install this gem onto your local machine, run `bundle exec rake install`. | |
4. ~~Build the gem `gem build spire.gemspec`~~ | ||
5. ~~Publish to BiteSite's RubyGems account `gem push spire-2.4.1.gem`~~ | ||
|
||
After trying to publish to rubygems.org, we realized we had a name conflict. If we changed the name of the gem, | ||
After trying to publish to rubygems.org, we realized we had a name conflict. If we changed the name of the gem, | ||
that would also affect the code that requires the top-level package. Until we're willing to release a Major version | ||
upgrade with breaking changes, we'll just have to publish via GitHub. | ||
upgrade with breaking changes, we'll just have to publish via GitHub. | ||
|
||
Until then, when we're ready to release a new version: | ||
|
||
1. On master, `git checkout master` | ||
2. Make sure you have the latest changes `git pull` | ||
2. Update `spire/version.rb` with a new version number following Semantic Versioning Rules. | ||
3. Commit the change `git add .` and `git commit -m "Updated version number for release."` | ||
4. Push changes `git push origin master` | ||
5. Tag the commit `git tag 'vX.X.X'` | ||
6. Push tags `git push origin --tags` | ||
3. Update `spire/version.rb` with a new version number following Semantic Versioning Rules. | ||
4. Commit the change `git add .` and `git commit -m "Updated version number for release."` | ||
5. Push changes `git push origin master` | ||
6. Tag the commit `git tag 'vX.X.X'` | ||
7. Push tags `git push origin --tags` | ||
|
||
## Contributing | ||
|
||
Bug reports and pull requests are welcome on GitHub at https://github.com/bitesite/spire. | ||
Bug reports and pull requests are welcome on GitHub at https://github.com/bitesite/spire-ruby. | ||
|
||
We do not currently support the entire [Spire](http://www.spiresystems.com/) api. | ||
Any pull requests adding CRUD resources to this gem are appreciated. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caseyli I went lower with rails 4 but can put this to whatever we want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@7chris71000 so I like this functionality, but at the same time I don't want to restrict non-rails programs from using this gem. Would you mind researching how to make this optional? "Like if Rails is installed, run the generator. If Rails isn't installed, don't run it." I think that would be the best option.