Skip to content
No description, website, or topics provided.
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
data
docs
exe
lib
spec
.gitignore
.rspec
.ruby-version
.travis.yml
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
Zendesk Coding Challenge.pdf
zendesk.gemspec

README.md

Zendesk

Build Status Gem Version

Install

gem install zendesk-james-moriarty

Usage

$ zendesk 
usage: zendesk [options]
    -f, --files     "path/to/file.json"
    -c, --command   "<FIELD>=<VALUE>"
    -s, --strategy  "ruby", "sqlite3" supported
    -p, --printer   "table", "json" supported
    -h, --help      
    --version       print the version

examples:

  # search field "_id" for value equal to "101" in "organizations.json".
  zendesk --command _id=101 --files data/organizations.json

  # search field "domain_names" for value equal to "zentix.com" using default fixtures.
  zendesk --command domain_names=zentix.com

  # search with multiple command expressions.
  zendesk --command "_id=101 _id=102" --files data/organizations.json

  # search with multiple file paths.
  zendesk --command "_id=101" --files data/organizations.json --files data/users.json

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]
...

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 functionality is interchangeable.

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.

You can’t perform that action at this time.