Zendesk

Build Status Gem Version

Install

gem install zendesk-james-moriarty

Usage

zendesk
usage: zendesk [options]
    -f, --files    json file paths to load e.g. users.json
    -c, --command  command expression e.g _id=101
    --version      print the version

A command with specific files:

zendesk -f data/organizations.json -f data/tickets.json -c "_id=101"  
+----------------+----------------------------------------------------------+
|                               Organizations                               |
+----------------+----------------------------------------------------------+
| _id            | 101                                                      |
| url            | http://initech.zendesk.com/api/v2/organizations/101.json |
| external_id    | 9270ed79-35eb-4a38-a46f-35725197ea8d                 
...

A command with the default fixtures:

zendesk -c "_id=101"  
+----------------+----------------------------------------------------------+
|                               Organizations                               |
+----------------+----------------------------------------------------------+
| _id            | 101                                                      |
| url            | http://initech.zendesk.com/api/v2/organizations/101.json |
| external_id    | 9270ed79-35eb-4a38-a46f-35725197ea8d
...

Development

Tests

rake

Usage

$ ./exe/zendesk
usage: ./exe/zendesk [options]
    -f, --files    json file paths to load e.g. users.json
    -c, --command  command expression e.g _id=101
    --version      print the version

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.

Design

Below is a diagram illustrating the transforms as vertices and the data as edges.

alt text

  • LoadFiles -> Execute have a common Strategy abstraction to allow for a different underlying implementation. This will hopefully help scale with more data.
  • ParseCommand abstracts user input and give a common command AST input across different strategies.
  • Print can be more abstracted and provide different outputs like JSON, CSV, ...
  • In an attempt to separate Behaviour and Data:
    • I've tried to write "pure functions" when possible.
    • I've been attempting to reduce side effects by making some objects immutable.
  • I've tried to incorporate things like SOLID without making the code feel anemic.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zendesk.

License

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