vtikit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bf70a197b77dd2c05f728e8a086e6daf4f7e5a0efde541ab9f0e31abaab10ab0
4
+ data.tar.gz: 05323e7300e9cdba5cce31a24540568ad2c6d8a7d620fa6474cd3b6e7d31be53
5
+ SHA512:
6
+ metadata.gz: 9e124c6f10928d50e72c750ad93b9ada420fea5a7c421b5c741dbf80400e4ef02bdb20dd0173ef128b51b11d326471d3227945704336dcc67112f7e59dbb47c7
7
+ data.tar.gz: 3258502248c7ae1183c4723375818965d1a03029e0e14fee8b434a5958e753a4cd5006fd8e826750431540ab61d04afd18a0a35e4b4c63e7c762a78b09be19b1
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-12-09
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at jose.perez@vertilux.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in vtikit.gemspec
6
+ gemspec
7
+ gem "rake", "~> 13.0"
8
+ gem "rspec", "~> 3.0"
9
+ gem 'irb', '~> 1.3', '>= 1.3.5', require: false
10
+ gem 'dotenv', '~> 2.7', '>= 2.7.6'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Jose Perez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.org ADDED
@@ -0,0 +1,110 @@
1
+ #+TITLE: Vtikit
2
+ #+AUTHOR: Jose Perez
3
+ #+EMAIL: jose.perez@vertilux.com
4
+ #+EXPORT_FILE_NAME: ./docs/index.html
5
+ #+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup
6
+ #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css">
7
+ #+OPTIONS: num:nil
8
+
9
+ Vtikit is the official Ruby library for Vertilux's API. It supports everything the API can do with simple interface written in Ruby.
10
+
11
+ [[https://badge.fury.io/rb/vtikit.svg]]
12
+
13
+
14
+ ** Installation
15
+ Add this line to your application's Gemfile:
16
+
17
+ #+begin_src ruby
18
+ gem 'vtikit'
19
+ #+end_src
20
+
21
+ And then execute:
22
+
23
+ #+begin_src bash
24
+ $ bundle install
25
+ #+end_src
26
+
27
+ Or install it yourself as:
28
+
29
+ #+begin_src bash
30
+ $ gem install vtikit
31
+ #+end_src
32
+
33
+ ** Usage
34
+ You'll need to generate an access key in Vertilux's application. If you already have an account in Vertilux's app you can get your key by simply visit =https://erp.vertilux.com/api_key.json= or run from your terminal:
35
+ #+begin_src bash
36
+ curl --request GET \
37
+ --url https://erp.vertilux.com/api_key \
38
+ --header 'Content-Type: application/json' \
39
+ --user 'YOUR_EMAIL_ADDRESS'
40
+ #+end_src
41
+
42
+ *Output*
43
+ #+begin_example
44
+ {
45
+ "first_name": "Jose",
46
+ "last_name": "Perez",
47
+ "email": "jose.perez@example.com",
48
+ "api_key": "YOUR_API_KEY",
49
+ "your_ip_addr": "127.0.0.1"
50
+ }
51
+ #+end_example
52
+
53
+
54
+ ** Resources and actions
55
+
56
+ *** Inventory
57
+ #+begin_src ruby
58
+ client.inventory.catalog
59
+ client.inventory.uoms
60
+ client.inventory.uom(item)
61
+ #+end_src
62
+
63
+ *** Items
64
+ #+begin_src ruby
65
+ client.items.list
66
+ client.items.retreive(id)
67
+ client.items.label(barcode)
68
+ #+end_src
69
+
70
+ *** Orders
71
+ #+begin_src ruby
72
+ client.orders.create()
73
+ #+end_src
74
+
75
+ *Payload*
76
+ #+begin_example
77
+ {
78
+ "name": "Jose Perez",
79
+ "address": "7290 NW 35th Terrace , Miami, Florida 33122",
80
+ "shipvia": "Delivery",
81
+ "description": "Your order description",
82
+ "po_number": "PO666",
83
+ "line_items_attributes": [
84
+ {
85
+ "itemno": "00053900100",
86
+ "quantity": 5,
87
+ "uom": "ROLL"
88
+ },
89
+ {
90
+ "itemno": "00053900200",
91
+ "quantity": 5,
92
+ "uom": "ROLL"
93
+ }
94
+ ]
95
+ }
96
+ #+end_example
97
+
98
+ *** Sales
99
+ #+begin_src ruby
100
+ client.sales.history
101
+ #+end_src
102
+
103
+ ** Contributing
104
+
105
+ Everyone is encouraged to help improve this project. Bug reports and pull requests are welcome at [[https://github.com/vertilux/vtikit/pulls]].
106
+ Feel free to open an [[https://github.com/vertilux/vtikit/issues][issues]] to get feedback on your idea before spending too much time on it.
107
+
108
+ ** License
109
+
110
+ The gem is available as open source under the terms of the [[https://opensource.org/licenses/MIT][MIT License]].
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "vtikit"
6
+ require 'dotenv/load'
7
+ Dotenv.load
8
+
9
+ # You can add fixtures and/or initialization code here to make experimenting
10
+ # with your gem easier. You can also use a different console, if you like.
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+
16
+ client = Vtikit::Client.new(api_key: ENV['API_KEY'])
17
+
18
+ require "irb"
19
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docs/index.html ADDED
@@ -0,0 +1,394 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
+ <head>
6
+ <!-- 2021-12-10 Fri 11:16 -->
7
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
9
+ <title>Vtikit</title>
10
+ <meta name="author" content="Jose Perez" />
11
+ <meta name="generator" content="Org Mode" />
12
+ <style>
13
+ #content { max-width: 60em; margin: auto; }
14
+ .title { text-align: center;
15
+ margin-bottom: .2em; }
16
+ .subtitle { text-align: center;
17
+ font-size: medium;
18
+ font-weight: bold;
19
+ margin-top:0; }
20
+ .todo { font-family: monospace; color: red; }
21
+ .done { font-family: monospace; color: green; }
22
+ .priority { font-family: monospace; color: orange; }
23
+ .tag { background-color: #eee; font-family: monospace;
24
+ padding: 2px; font-size: 80%; font-weight: normal; }
25
+ .timestamp { color: #bebebe; }
26
+ .timestamp-kwd { color: #5f9ea0; }
27
+ .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
28
+ .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
29
+ .org-center { margin-left: auto; margin-right: auto; text-align: center; }
30
+ .underline { text-decoration: underline; }
31
+ #postamble p, #preamble p { font-size: 90%; margin: .2em; }
32
+ p.verse { margin-left: 3%; }
33
+ pre {
34
+ border: 1px solid #e6e6e6;
35
+ border-radius: 3px;
36
+ background-color: #f2f2f2;
37
+ padding: 8pt;
38
+ font-family: monospace;
39
+ overflow: auto;
40
+ margin: 1.2em;
41
+ }
42
+ pre.src {
43
+ position: relative;
44
+ overflow: auto;
45
+ }
46
+ pre.src:before {
47
+ display: none;
48
+ position: absolute;
49
+ top: -8px;
50
+ right: 12px;
51
+ padding: 3px;
52
+ color: #555;
53
+ background-color: #f2f2f299;
54
+ }
55
+ pre.src:hover:before { display: inline; margin-top: 14px;}
56
+ /* Languages per Org manual */
57
+ pre.src-asymptote:before { content: 'Asymptote'; }
58
+ pre.src-awk:before { content: 'Awk'; }
59
+ pre.src-authinfo::before { content: 'Authinfo'; }
60
+ pre.src-C:before { content: 'C'; }
61
+ /* pre.src-C++ doesn't work in CSS */
62
+ pre.src-clojure:before { content: 'Clojure'; }
63
+ pre.src-css:before { content: 'CSS'; }
64
+ pre.src-D:before { content: 'D'; }
65
+ pre.src-ditaa:before { content: 'ditaa'; }
66
+ pre.src-dot:before { content: 'Graphviz'; }
67
+ pre.src-calc:before { content: 'Emacs Calc'; }
68
+ pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
69
+ pre.src-fortran:before { content: 'Fortran'; }
70
+ pre.src-gnuplot:before { content: 'gnuplot'; }
71
+ pre.src-haskell:before { content: 'Haskell'; }
72
+ pre.src-hledger:before { content: 'hledger'; }
73
+ pre.src-java:before { content: 'Java'; }
74
+ pre.src-js:before { content: 'Javascript'; }
75
+ pre.src-latex:before { content: 'LaTeX'; }
76
+ pre.src-ledger:before { content: 'Ledger'; }
77
+ pre.src-lisp:before { content: 'Lisp'; }
78
+ pre.src-lilypond:before { content: 'Lilypond'; }
79
+ pre.src-lua:before { content: 'Lua'; }
80
+ pre.src-matlab:before { content: 'MATLAB'; }
81
+ pre.src-mscgen:before { content: 'Mscgen'; }
82
+ pre.src-ocaml:before { content: 'Objective Caml'; }
83
+ pre.src-octave:before { content: 'Octave'; }
84
+ pre.src-org:before { content: 'Org mode'; }
85
+ pre.src-oz:before { content: 'OZ'; }
86
+ pre.src-plantuml:before { content: 'Plantuml'; }
87
+ pre.src-processing:before { content: 'Processing.js'; }
88
+ pre.src-python:before { content: 'Python'; }
89
+ pre.src-R:before { content: 'R'; }
90
+ pre.src-ruby:before { content: 'Ruby'; }
91
+ pre.src-sass:before { content: 'Sass'; }
92
+ pre.src-scheme:before { content: 'Scheme'; }
93
+ pre.src-screen:before { content: 'Gnu Screen'; }
94
+ pre.src-sed:before { content: 'Sed'; }
95
+ pre.src-sh:before { content: 'shell'; }
96
+ pre.src-sql:before { content: 'SQL'; }
97
+ pre.src-sqlite:before { content: 'SQLite'; }
98
+ /* additional languages in org.el's org-babel-load-languages alist */
99
+ pre.src-forth:before { content: 'Forth'; }
100
+ pre.src-io:before { content: 'IO'; }
101
+ pre.src-J:before { content: 'J'; }
102
+ pre.src-makefile:before { content: 'Makefile'; }
103
+ pre.src-maxima:before { content: 'Maxima'; }
104
+ pre.src-perl:before { content: 'Perl'; }
105
+ pre.src-picolisp:before { content: 'Pico Lisp'; }
106
+ pre.src-scala:before { content: 'Scala'; }
107
+ pre.src-shell:before { content: 'Shell Script'; }
108
+ pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
109
+ /* additional language identifiers per "defun org-babel-execute"
110
+ in ob-*.el */
111
+ pre.src-cpp:before { content: 'C++'; }
112
+ pre.src-abc:before { content: 'ABC'; }
113
+ pre.src-coq:before { content: 'Coq'; }
114
+ pre.src-groovy:before { content: 'Groovy'; }
115
+ /* additional language identifiers from org-babel-shell-names in
116
+ ob-shell.el: ob-shell is the only babel language using a lambda to put
117
+ the execution function name together. */
118
+ pre.src-bash:before { content: 'bash'; }
119
+ pre.src-csh:before { content: 'csh'; }
120
+ pre.src-ash:before { content: 'ash'; }
121
+ pre.src-dash:before { content: 'dash'; }
122
+ pre.src-ksh:before { content: 'ksh'; }
123
+ pre.src-mksh:before { content: 'mksh'; }
124
+ pre.src-posh:before { content: 'posh'; }
125
+ /* Additional Emacs modes also supported by the LaTeX listings package */
126
+ pre.src-ada:before { content: 'Ada'; }
127
+ pre.src-asm:before { content: 'Assembler'; }
128
+ pre.src-caml:before { content: 'Caml'; }
129
+ pre.src-delphi:before { content: 'Delphi'; }
130
+ pre.src-html:before { content: 'HTML'; }
131
+ pre.src-idl:before { content: 'IDL'; }
132
+ pre.src-mercury:before { content: 'Mercury'; }
133
+ pre.src-metapost:before { content: 'MetaPost'; }
134
+ pre.src-modula-2:before { content: 'Modula-2'; }
135
+ pre.src-pascal:before { content: 'Pascal'; }
136
+ pre.src-ps:before { content: 'PostScript'; }
137
+ pre.src-prolog:before { content: 'Prolog'; }
138
+ pre.src-simula:before { content: 'Simula'; }
139
+ pre.src-tcl:before { content: 'tcl'; }
140
+ pre.src-tex:before { content: 'TeX'; }
141
+ pre.src-plain-tex:before { content: 'Plain TeX'; }
142
+ pre.src-verilog:before { content: 'Verilog'; }
143
+ pre.src-vhdl:before { content: 'VHDL'; }
144
+ pre.src-xml:before { content: 'XML'; }
145
+ pre.src-nxml:before { content: 'XML'; }
146
+ /* add a generic configuration mode; LaTeX export needs an additional
147
+ (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
148
+ pre.src-conf:before { content: 'Configuration File'; }
149
+
150
+ table { border-collapse:collapse; }
151
+ caption.t-above { caption-side: top; }
152
+ caption.t-bottom { caption-side: bottom; }
153
+ td, th { vertical-align:top; }
154
+ th.org-right { text-align: center; }
155
+ th.org-left { text-align: center; }
156
+ th.org-center { text-align: center; }
157
+ td.org-right { text-align: right; }
158
+ td.org-left { text-align: left; }
159
+ td.org-center { text-align: center; }
160
+ dt { font-weight: bold; }
161
+ .footpara { display: inline; }
162
+ .footdef { margin-bottom: 1em; }
163
+ .figure { padding: 1em; }
164
+ .figure p { text-align: center; }
165
+ .equation-container {
166
+ display: table;
167
+ text-align: center;
168
+ width: 100%;
169
+ }
170
+ .equation {
171
+ vertical-align: middle;
172
+ }
173
+ .equation-label {
174
+ display: table-cell;
175
+ text-align: right;
176
+ vertical-align: middle;
177
+ }
178
+ .inlinetask {
179
+ padding: 10px;
180
+ border: 2px solid gray;
181
+ margin: 10px;
182
+ background: #ffffcc;
183
+ }
184
+ #org-div-home-and-up
185
+ { text-align: right; font-size: 70%; white-space: nowrap; }
186
+ textarea { overflow-x: auto; }
187
+ .linenr { font-size: smaller }
188
+ .code-highlighted { background-color: #ffff00; }
189
+ .org-info-js_info-navigation { border-style: none; }
190
+ #org-info-js_console-label
191
+ { font-size: 10px; font-weight: bold; white-space: nowrap; }
192
+ .org-info-js_search-highlight
193
+ { background-color: #ffff00; color: #000000; font-weight: bold; }
194
+ .org-svg { width: 90%; }
195
+ </style>
196
+ <link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
197
+ <link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
198
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
199
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
200
+ <script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
201
+ <script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
202
+ <link rel="stylesheet" type="text/css" href="style.css">
203
+ </head>
204
+ <body>
205
+ <div id="content" class="content">
206
+ <h1 class="title">Vtikit</h1>
207
+ <div id="table-of-contents" role="doc-toc">
208
+ <h2>Table of Contents</h2>
209
+ <div id="text-table-of-contents" role="doc-toc">
210
+ <ul>
211
+ <li><a href="#org2f73898">Installation</a></li>
212
+ <li><a href="#org3594377">Usage</a></li>
213
+ <li><a href="#org30f275b">Resources and actions</a>
214
+ <ul>
215
+ <li><a href="#orgef516b6">Inventory</a></li>
216
+ <li><a href="#org29c450a">Items</a></li>
217
+ <li><a href="#org9405619">Orders</a></li>
218
+ <li><a href="#orgdc54a23">Sales</a></li>
219
+ </ul>
220
+ </li>
221
+ <li><a href="#org99a48b3">Contributing</a></li>
222
+ <li><a href="#orgf7f2d32">License</a></li>
223
+ </ul>
224
+ </div>
225
+ </div>
226
+ <p>
227
+ Vtikit is the official Ruby library for Vertilux&rsquo;s API. It supports everything the API can do with simple interface written in Ruby.
228
+ </p>
229
+
230
+
231
+ <div id="org64df933" class="figure">
232
+ <p><img src="https://badge.fury.io/rb/vtikit.svg" alt="vtikit.svg" />
233
+ </p>
234
+ </div>
235
+
236
+
237
+ <div id="outline-container-org2f73898" class="outline-2">
238
+ <h2 id="org2f73898">Installation</h2>
239
+ <div class="outline-text-2" id="text-org2f73898">
240
+ <p>
241
+ Add this line to your application&rsquo;s Gemfile:
242
+ </p>
243
+ <div class="org-src-container">
244
+ <pre class="src src-ruby">gem <span style="color: #f1fa8c;">'vtikit'</span>
245
+ </pre>
246
+ </div>
247
+
248
+ <p>
249
+ And then execute:
250
+ </p>
251
+ <div class="org-src-container">
252
+ <pre class="src src-bash">$ bundle install
253
+ </pre>
254
+ </div>
255
+
256
+ <p>
257
+ Or install it yourself as:
258
+ </p>
259
+ <div class="org-src-container">
260
+ <pre class="src src-bash">$ gem install vtikit
261
+ </pre>
262
+ </div>
263
+ </div>
264
+ </div>
265
+
266
+ <div id="outline-container-org3594377" class="outline-2">
267
+ <h2 id="org3594377">Usage</h2>
268
+ <div class="outline-text-2" id="text-org3594377">
269
+ <p>
270
+ You&rsquo;ll need to generate an access key in Vertilux&rsquo;s application. If you already have an account in Vertilux&rsquo;s app you can get your key by simply visit <code>https://erp.vertilux.com/api_key.json</code> or run from your terminal:
271
+ </p>
272
+ <div class="org-src-container">
273
+ <pre class="src src-bash"><span style="color: #bd93f9;">curl</span> --request GET <span style="color: #f1fa8c;">\</span>
274
+ --url https://erp.vertilux.com/api_key <span style="color: #f1fa8c;">\</span>
275
+ --header <span style="color: #f1fa8c;">'Content-Type: application/json'</span> <span style="color: #f1fa8c;">\</span>
276
+ --user <span style="color: #f1fa8c;">'YOUR_EMAIL_ADDRESS'</span>
277
+ </pre>
278
+ </div>
279
+
280
+ <p>
281
+ <b>Output</b>
282
+ </p>
283
+ <pre class="example" id="org311f8c7">
284
+ {
285
+ "first_name": "Jose",
286
+ "last_name": "Perez",
287
+ "email": "jose.perez@example.com",
288
+ "api_key": "YOUR_API_KEY",
289
+ "your_ip_addr": "127.0.0.1"
290
+ }
291
+ </pre>
292
+ </div>
293
+ </div>
294
+
295
+
296
+ <div id="outline-container-org30f275b" class="outline-2">
297
+ <h2 id="org30f275b">Resources and actions</h2>
298
+ <div class="outline-text-2" id="text-org30f275b">
299
+ </div>
300
+ <div id="outline-container-orgef516b6" class="outline-3">
301
+ <h3 id="orgef516b6">Inventory</h3>
302
+ <div class="outline-text-3" id="text-orgef516b6">
303
+ <div class="org-src-container">
304
+ <pre class="src src-ruby">client.inventory.catalog
305
+ client.inventory.uoms
306
+ client.inventory.uom(item)
307
+ </pre>
308
+ </div>
309
+ </div>
310
+ </div>
311
+
312
+ <div id="outline-container-org29c450a" class="outline-3">
313
+ <h3 id="org29c450a">Items</h3>
314
+ <div class="outline-text-3" id="text-org29c450a">
315
+ <div class="org-src-container">
316
+ <pre class="src src-ruby">client.items.list
317
+ client.items.retreive(id)
318
+ client.items.label(barcode)
319
+ </pre>
320
+ </div>
321
+ </div>
322
+ </div>
323
+
324
+ <div id="outline-container-org9405619" class="outline-3">
325
+ <h3 id="org9405619">Orders</h3>
326
+ <div class="outline-text-3" id="text-org9405619">
327
+ <div class="org-src-container">
328
+ <pre class="src src-ruby">client.orders.create()
329
+ </pre>
330
+ </div>
331
+
332
+ <p>
333
+ <b>Payload</b>
334
+ </p>
335
+ <pre class="example" id="org0b274e8">
336
+ {
337
+ "name": "Jose Perez",
338
+ "address": "7290 NW 35th Terrace , Miami, Florida 33122",
339
+ "shipvia": "Delivery",
340
+ "description": "Your order description",
341
+ "po_number": "PO666",
342
+ "line_items_attributes": [
343
+ {
344
+ "itemno": "00053900100",
345
+ "quantity": 5,
346
+ "uom": "ROLL"
347
+ },
348
+ {
349
+ "itemno": "00053900200",
350
+ "quantity": 5,
351
+ "uom": "ROLL"
352
+ }
353
+ ]
354
+ }
355
+ </pre>
356
+ </div>
357
+ </div>
358
+
359
+ <div id="outline-container-orgdc54a23" class="outline-3">
360
+ <h3 id="orgdc54a23">Sales</h3>
361
+ <div class="outline-text-3" id="text-orgdc54a23">
362
+ <div class="org-src-container">
363
+ <pre class="src src-ruby">client.sales.history
364
+ </pre>
365
+ </div>
366
+ </div>
367
+ </div>
368
+ </div>
369
+
370
+ <div id="outline-container-org99a48b3" class="outline-2">
371
+ <h2 id="org99a48b3">Contributing</h2>
372
+ <div class="outline-text-2" id="text-org99a48b3">
373
+ <p>
374
+ Everyone is encouraged to help improve this project. Bug reports and pull requests are welcome at <a href="https://github.com/vertilux/vtikit/pulls">https://github.com/vertilux/vtikit/pulls</a>.
375
+ Feel free to open an <a href="https://github.com/vertilux/vtikit/issues">issues</a> to get feedback on your idea before spending too much time on it.
376
+ </p>
377
+ </div>
378
+ </div>
379
+
380
+ <div id="outline-container-orgf7f2d32" class="outline-2">
381
+ <h2 id="orgf7f2d32">License</h2>
382
+ <div class="outline-text-2" id="text-orgf7f2d32">
383
+ <p>
384
+ The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.
385
+ </p>
386
+ </div>
387
+ </div>
388
+ </div>
389
+ <div id="postamble" class="status">
390
+ <p class="author">Author: Jose Perez</p>
391
+ <p class="date">Created: 2021-12-10 Fri 11:16</p>
392
+ </div>
393
+ </body>
394
+ </html>
data/docs/style.css ADDED
@@ -0,0 +1,92 @@
1
+
2
+ /* Read the Org custom CSS */
3
+
4
+ /* Body andHeaders */
5
+ h4,h5,h6 {
6
+ color:#6272a4;
7
+ font-weight:300;
8
+ }
9
+
10
+ body{
11
+ background:#282A36;
12
+ color:#404040;
13
+ font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
14
+ font-weight:normal;
15
+ margin:0;
16
+ min-height:100%;
17
+ overflow-x:hidden;
18
+ }
19
+
20
+ /* Code block */
21
+ .codeblock,pre.src,#content .literal-block{
22
+ border:1px solid #e1e4e5;
23
+ padding:12px;
24
+ overflow-x:auto;
25
+ background:#282A36;
26
+ margin:1px 0 24px 0;
27
+ color: #F8F8F2;
28
+ }
29
+
30
+ /* Links */
31
+ a{
32
+ color:#6272a4;
33
+ text-decoration:none;
34
+ cursor:pointer}
35
+
36
+ a:hover,a:active{
37
+ outline:0;
38
+ }
39
+
40
+ a:hover{
41
+ color:#bd93f9}
42
+
43
+ a:visited{
44
+ color:#9B59B6}
45
+
46
+ /* Table of Content */
47
+ #table-of-contents{
48
+ position:fixed;
49
+ top:0;
50
+ left:0;
51
+ width:300px;
52
+ overflow-x:hidden;
53
+ overflow-y:scroll;
54
+ height:100%;
55
+ background:#44475A;
56
+ z-index:200;
57
+ scrollbar-base-color: #1F1D1D;
58
+ scrollbar-arrow-color: #b3b3b3;
59
+ scrollbar-shadow-color: #1F1D1D;
60
+ scrollbar-track-color : #343131;
61
+ }
62
+
63
+ #table-of-contents h2{
64
+ z-index:200;
65
+ background-color:#282A36;
66
+ text-align:center;
67
+ padding:0.809em;
68
+ display:block;
69
+ color:#fcfcfc;
70
+ font-size: 100%;
71
+ margin-bottom:0.809em}
72
+
73
+ /* Footer */
74
+ #postamble .author {
75
+ font-size: 100%;
76
+ margin-bottom: 0px;
77
+ }
78
+
79
+ #postamble .date {
80
+ font-size: 90%;
81
+ margin-bottom: 0px;
82
+ color: #00f769;
83
+ }
84
+
85
+ .figure {
86
+ padding: 0;
87
+ }
88
+
89
+ .figure p {
90
+ text-align: left;
91
+ padding: 0;
92
+ }
@@ -0,0 +1,43 @@
1
+ require "faraday"
2
+ require "faraday_middleware"
3
+
4
+ module Vtikit
5
+ class Client
6
+
7
+ DEFAULT_TIMEOUT = 120
8
+ BASE_URL = "https://api.vertilux.com/api/v1"
9
+
10
+ attr_reader :api_key, :adapter
11
+
12
+ def initialize(api_key:, adapter: Faraday.default_adapter)
13
+ @api_key = api_key
14
+ @adapter = adapter
15
+ end
16
+
17
+ def inventory
18
+ InventoryResource.new(self)
19
+ end
20
+
21
+ def items
22
+ ItemsResource.new(self)
23
+ end
24
+
25
+ def orders
26
+ OrdersResource.new(self)
27
+ end
28
+
29
+ def sales
30
+ SalesResource.new(self)
31
+ end
32
+
33
+ def connection
34
+ @connection ||= Faraday.new do |con|
35
+ con.url_prefix = BASE_URL
36
+ con.request :json
37
+ con.response :json, content_type: "application/json"
38
+ con.adapter adapter
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ module Vtikit
2
+ class Collection
3
+ attr_reader :data
4
+
5
+ def self.from_response(response, type:)
6
+ body = response.body
7
+ new(
8
+ data: body.map{ |attrs| type.new(attrs) }
9
+ )
10
+ end
11
+
12
+ def initialize(data:)
13
+ @data = data
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module Vtikit
2
+ class Error < StandardError; end
3
+ end
@@ -0,0 +1,18 @@
1
+ require "ostruct"
2
+
3
+ module Vtikit
4
+ class Object
5
+ def initialize(attributes)
6
+ @attributes = OpenStruct.new(attributes)
7
+ end
8
+
9
+ def method_missing(method, *args, &block)
10
+ attribute = @attributes.send(method, *args, &block)
11
+ attribute.is_a?(Hash) ? Object.new(attribute) : attribute
12
+ end
13
+
14
+ def respond_to_missing?(method, inlcude_private = false)
15
+ true
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ module Vtikit
2
+ class Inventory < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Vtikit
2
+ class Item < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Vtikit
2
+ class Order < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Vtikit
2
+ class Sales < Object
3
+ end
4
+ end
@@ -0,0 +1,51 @@
1
+ module Vtikit
2
+ class Resource
3
+ attr_reader :client
4
+
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def get_request(url, params: {}, headers: {})
10
+ handle_response client.connection.get(url, params, default_headers.merge(headers))
11
+ end
12
+
13
+ def post_request(url, body:, headers: {})
14
+ handle_response client.connection.post(url, body, default_headers.merge(headers))
15
+ end
16
+
17
+ def patch_request(url, body:, headers: {})
18
+ handle_response client.connection.patch(url, body, default_headers.merge(headers))
19
+ end
20
+
21
+ def put_request(url, body:, headers: {})
22
+ handle_response client.connection.put(url, body, default_headers.merge(headers))
23
+ end
24
+
25
+ def delete_request(url, params: {}, headers: {})
26
+ handle_response client.connection.delete(url, params, default_headers.merge(headers))
27
+ end
28
+
29
+ def default_headers
30
+ { "X-Api-Key": client.api_key }
31
+ end
32
+
33
+ def handle_response(response)
34
+ #message = response.body["message"]
35
+
36
+ case response.status
37
+ when 401
38
+ raise Error, "#{response.body}"
39
+ when 404
40
+ raise Error, "#{response.body}"
41
+ when 429
42
+ raise Error, "#{response.body}"
43
+ when 500
44
+ raise Error, "#{response.body}"
45
+ end
46
+
47
+ response
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,17 @@
1
+ module Vtikit
2
+ class InventoryResource < Resource
3
+
4
+ def catalog(**params)
5
+ Collection.from_response get_request("inventory/catalog", params: params), type: Inventory
6
+ end
7
+
8
+ def uoms(**params)
9
+ Collection.from_response get_request("inventory/uom", params: params), type: Inventory
10
+ end
11
+
12
+ def uom(item, **params)
13
+ Inventory.new get_request("inventory/uom/#{item}", params: params).body
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Vtikit
2
+ class ItemsResource < Resource
3
+
4
+ def list(**params)
5
+ Collection.from_response get_request("customers/items", params: params), type: Item
6
+ end
7
+
8
+ def retreive(id, **params)
9
+ Item.new get_request("customers/items/#{id}", params: params).body
10
+ end
11
+
12
+ def label(tracking, **params)
13
+ Item.new get_request("customers/labels/#{tracking}", params: params).body
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ module Vtikit
2
+ class OrdersResource < Resource
3
+
4
+ # New order payload
5
+ #{
6
+ # "name": "Jose Perez",
7
+ # "address": "7290 NW 35th Terrace , Miami, Florida 33122",
8
+ # "shipvia": "Delivery",
9
+ # "description": "Your order description",
10
+ # "po_number": "PO666",
11
+ # "line_items_attributes": [
12
+ # {
13
+ # "itemno": "00053900100",
14
+ # "quantity": 5,
15
+ # "uom": "ROLL"
16
+ # },
17
+ # {
18
+ # "itemno": "00053900200",
19
+ # "quantity": 5,
20
+ # "uom": "ROLL"
21
+ # }
22
+ # ]
23
+ #}
24
+ def create(**attributed)
25
+ Order.new post_request("customers/orders", body: attributes).body
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module Vtikit
2
+ class SalesResource < Resource
3
+
4
+ def history(**params)
5
+ Collection.from_response get_request("customers/sales_history", params: params)
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vtikit
4
+ VERSION = "0.1.0"
5
+ end
data/lib/vtikit.rb ADDED
@@ -0,0 +1,20 @@
1
+ module Vtikit
2
+ autoload :Client, "vtikit/client"
3
+
4
+ autoload :Error, "vtikit/error"
5
+ autoload :Object, "vtikit/object"
6
+ autoload :Resource, "vtikit/resource"
7
+ autoload :Collection, "vtikit/collection"
8
+
9
+ # Recources
10
+ autoload :InventoryResource, "vtikit/resources/inventory"
11
+ autoload :ItemsResource, "vtikit/resources/items"
12
+ autoload :OrdersResource, "vtikit/resources/orders"
13
+ autoload :SalesResource, "vtikit/resources/sales"
14
+
15
+ # Objects
16
+ autoload :Inventory, "vtikit/objects/inventory.rb"
17
+ autoload :Item, "vtikit/objects/item.rb"
18
+ autoload :Order, "vtikit/objects/order.rb"
19
+ autoload :Sales, "vtikit/objects/sales.rb"
20
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vtikit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jose Perez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.14.0
41
+ description: Official Ruby library for Vertilux's API
42
+ email:
43
+ - jose.perez@vertilux.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rspec"
49
+ - CHANGELOG.md
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.org
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - docs/index.html
58
+ - docs/style.css
59
+ - lib/vtikit.rb
60
+ - lib/vtikit/client.rb
61
+ - lib/vtikit/collection.rb
62
+ - lib/vtikit/error.rb
63
+ - lib/vtikit/object.rb
64
+ - lib/vtikit/objects/inventory.rb
65
+ - lib/vtikit/objects/item.rb
66
+ - lib/vtikit/objects/order.rb
67
+ - lib/vtikit/objects/sales.rb
68
+ - lib/vtikit/resource.rb
69
+ - lib/vtikit/resources/inventory.rb
70
+ - lib/vtikit/resources/items.rb
71
+ - lib/vtikit/resources/orders.rb
72
+ - lib/vtikit/resources/sales.rb
73
+ - lib/vtikit/version.rb
74
+ homepage: https://vertilux.github.io/vtikit
75
+ licenses:
76
+ - MIT
77
+ metadata:
78
+ homepage_uri: https://vertilux.github.io/vtikit
79
+ source_code_uri: https://github.com/vertilux/vtikit
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 2.4.0
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubygems_version: 3.2.29
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Official Ruby library for Vertilux's API
99
+ test_files: []