pactas_itero 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +39 -0
- data/.hound.yml +14 -0
- data/.rubocop.yml +2 -0
- data/.ruby-style.yml +268 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +16 -0
- data/lib/pactas_itero/api/contracts.rb +30 -0
- data/lib/pactas_itero/api/customers.rb +20 -0
- data/lib/pactas_itero/api/invoices.rb +25 -0
- data/lib/pactas_itero/api/oauth.rb +12 -0
- data/lib/pactas_itero/api/orders.rb +19 -0
- data/lib/pactas_itero/api/rated_items.rb +16 -0
- data/lib/pactas_itero/api.rb +18 -0
- data/lib/pactas_itero/client.rb +108 -0
- data/lib/pactas_itero/configurable.rb +59 -0
- data/lib/pactas_itero/default.rb +77 -0
- data/lib/pactas_itero/error.rb +217 -0
- data/lib/pactas_itero/ext/hash/camelize_keys.rb +32 -0
- data/lib/pactas_itero/response/raise_error.rb +21 -0
- data/lib/pactas_itero/version.rb +3 -0
- data/lib/pactas_itero.rb +31 -0
- data/pactas_itero.gemspec +32 -0
- data/spec/fixtures/bearer_token.json +5 -0
- data/spec/fixtures/commit_order_response.json +50 -0
- data/spec/fixtures/contract.json +46 -0
- data/spec/fixtures/contract_cancellation_preview_response.json +73 -0
- data/spec/fixtures/contracts.json +48 -0
- data/spec/fixtures/create_order_response.json +17 -0
- data/spec/fixtures/create_rated_item.json +8 -0
- data/spec/fixtures/customer.json +23 -0
- data/spec/fixtures/customers.json +40 -0
- data/spec/fixtures/invoice.json +22 -0
- data/spec/fixtures/invoices.json +46 -0
- data/spec/fixtures/order.json +15 -0
- data/spec/pactas_itero/api/contracts_spec.rb +118 -0
- data/spec/pactas_itero/api/customers_spec.rb +188 -0
- data/spec/pactas_itero/api/invoices_spec.rb +87 -0
- data/spec/pactas_itero/api/oauth_spec.rb +40 -0
- data/spec/pactas_itero/api/orders_spec.rb +102 -0
- data/spec/pactas_itero/api/rated_items_spec.rb +74 -0
- data/spec/pactas_itero/client_spec.rb +316 -0
- data/spec/pactas_itero_spec.rb +32 -0
- data/spec/spec_helper.rb +100 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef8629b8209731a92d22ab6f26b5551ab30c3939
|
4
|
+
data.tar.gz: 538e0b3664be929ed9d2a54decfe736878207e63
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a3a65f0f08d41f1828b7afa65972f88091d356c01232d71c7ef2760632e6fdd43bfb0103f97c810ab0967caed0700fb3089326c82fd110687e91ba054ce919d
|
7
|
+
data.tar.gz: 71176e3d72be35e24cc83f15f90cc50afeaa94d2714c5e31f6dc37194456569e395227bb953809fab46a9e5e5484cc53adde43e84ca64496ad68958237534ec8
|
data/.gitignore
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Created by https://www.gitignore.io/api/ruby
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
|
21
|
+
## Documentation cache and generated files:
|
22
|
+
/.yardoc/
|
23
|
+
/_yardoc/
|
24
|
+
/doc/
|
25
|
+
/rdoc/
|
26
|
+
|
27
|
+
## Environment normalisation:
|
28
|
+
/.bundle/
|
29
|
+
/vendor/bundle
|
30
|
+
/lib/bundler/man/
|
31
|
+
|
32
|
+
# for a library or gem, you might want to ignore these files since the code is
|
33
|
+
# intended to run in multiple environments; otherwise, check them in:
|
34
|
+
Gemfile.lock
|
35
|
+
.ruby-version
|
36
|
+
.ruby-gemset
|
37
|
+
|
38
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
39
|
+
.rvmrc
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
data/.ruby-style.yml
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.1
|
3
|
+
Exclude:
|
4
|
+
- "vendor/**/*"
|
5
|
+
- "db/schema.rb"
|
6
|
+
UseCache: false
|
7
|
+
Rails:
|
8
|
+
Enabled: true
|
9
|
+
Rails/FindBy:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 100
|
13
|
+
Style/CollectionMethods:
|
14
|
+
Description: Preferred collection methods.
|
15
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
|
16
|
+
Enabled: true
|
17
|
+
PreferredMethods:
|
18
|
+
collect: map
|
19
|
+
collect!: map!
|
20
|
+
find: detect
|
21
|
+
find_all: select
|
22
|
+
reduce: inject
|
23
|
+
Style/DotPosition:
|
24
|
+
Description: Checks the position of the dot in multi-line method calls.
|
25
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
26
|
+
Enabled: true
|
27
|
+
EnforcedStyle: trailing
|
28
|
+
SupportedStyles:
|
29
|
+
- trailing
|
30
|
+
Style/FileName:
|
31
|
+
Description: Use snake_case for source file names.
|
32
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
33
|
+
Enabled: false
|
34
|
+
Exclude: []
|
35
|
+
Style/FirstArrayElementLineBreak:
|
36
|
+
Description: >-
|
37
|
+
Checks for a line break before the first element in a
|
38
|
+
multi-line array.
|
39
|
+
Enabled: true
|
40
|
+
Style/FirstHashElementLineBreak:
|
41
|
+
Description: >-
|
42
|
+
Checks for a line break before the first element in a
|
43
|
+
multi-line hash.
|
44
|
+
Enabled: true
|
45
|
+
Style/FirstMethodArgumentLineBreak:
|
46
|
+
Description: >-
|
47
|
+
Checks for a line break before the first argument in a
|
48
|
+
multi-line method call.
|
49
|
+
Enabled: true
|
50
|
+
Style/GuardClause:
|
51
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
52
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
53
|
+
Enabled: false
|
54
|
+
MinBodyLength: 1
|
55
|
+
Style/IfUnlessModifier:
|
56
|
+
Description: Favor modifier if/unless usage when you have a single-line body.
|
57
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
58
|
+
Enabled: false
|
59
|
+
MaxLineLength: 80
|
60
|
+
Style/OptionHash:
|
61
|
+
Description: Don't use option hashes when you can use keyword arguments.
|
62
|
+
Enabled: false
|
63
|
+
Style/PercentLiteralDelimiters:
|
64
|
+
Description: Use `%`-literal delimiters consistently
|
65
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
66
|
+
Enabled: false
|
67
|
+
PreferredDelimiters:
|
68
|
+
"%": "()"
|
69
|
+
"%i": "()"
|
70
|
+
"%q": "()"
|
71
|
+
"%Q": "()"
|
72
|
+
"%r": "{}"
|
73
|
+
"%s": "()"
|
74
|
+
"%w": "()"
|
75
|
+
"%W": "()"
|
76
|
+
"%x": "()"
|
77
|
+
Style/PredicateName:
|
78
|
+
Description: Check the names of predicate methods.
|
79
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
80
|
+
Enabled: true
|
81
|
+
NamePrefix:
|
82
|
+
- is_
|
83
|
+
- has_
|
84
|
+
- have_
|
85
|
+
NamePrefixBlacklist:
|
86
|
+
- is_
|
87
|
+
Exclude:
|
88
|
+
- spec/**/*
|
89
|
+
Style/RaiseArgs:
|
90
|
+
Description: Checks the arguments passed to raise/fail.
|
91
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
|
92
|
+
Enabled: false
|
93
|
+
EnforcedStyle: exploded
|
94
|
+
SupportedStyles:
|
95
|
+
- compact
|
96
|
+
- exploded
|
97
|
+
Style/SignalException:
|
98
|
+
Description: Checks for proper usage of fail and raise.
|
99
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
100
|
+
Enabled: false
|
101
|
+
EnforcedStyle: semantic
|
102
|
+
SupportedStyles:
|
103
|
+
- only_raise
|
104
|
+
- only_fail
|
105
|
+
- semantic
|
106
|
+
Style/SingleLineBlockParams:
|
107
|
+
Description: Enforces the names of some block params.
|
108
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
|
109
|
+
Enabled: false
|
110
|
+
Methods:
|
111
|
+
- reduce:
|
112
|
+
- a
|
113
|
+
- e
|
114
|
+
- inject:
|
115
|
+
- a
|
116
|
+
- e
|
117
|
+
Style/SingleLineMethods:
|
118
|
+
Description: Avoid single-line methods.
|
119
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
|
120
|
+
Enabled: false
|
121
|
+
AllowIfMethodIsEmpty: true
|
122
|
+
Style/StringLiterals:
|
123
|
+
Description: Checks if uses of quotes match the configured preference.
|
124
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
125
|
+
Enabled: true
|
126
|
+
EnforcedStyle: double_quotes
|
127
|
+
SupportedStyles:
|
128
|
+
- single_quotes
|
129
|
+
- double_quotes
|
130
|
+
Style/StringLiteralsInInterpolation:
|
131
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
132
|
+
match the configured preference.
|
133
|
+
Enabled: true
|
134
|
+
EnforcedStyle: single_quotes
|
135
|
+
SupportedStyles:
|
136
|
+
- single_quotes
|
137
|
+
- double_quotes
|
138
|
+
Style/TrailingCommaInArguments:
|
139
|
+
Description: 'Checks for trailing comma in argument lists.'
|
140
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
141
|
+
Enabled: true
|
142
|
+
EnforcedStyleForMultiline: comma
|
143
|
+
SupportedStyles:
|
144
|
+
- comma
|
145
|
+
- consistent_comma
|
146
|
+
- no_comma
|
147
|
+
Style/TrailingCommaInLiteral:
|
148
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
149
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
150
|
+
Enabled: true
|
151
|
+
EnforcedStyleForMultiline: comma
|
152
|
+
SupportedStyles:
|
153
|
+
- comma
|
154
|
+
- consistent_comma
|
155
|
+
- no_comma
|
156
|
+
Metrics/AbcSize:
|
157
|
+
Description: A calculated magnitude based on number of assignments, branches, and
|
158
|
+
conditions.
|
159
|
+
Enabled: false
|
160
|
+
Max: 15
|
161
|
+
Metrics/ClassLength:
|
162
|
+
Description: Avoid classes longer than 100 lines of code.
|
163
|
+
Enabled: false
|
164
|
+
CountComments: false
|
165
|
+
Max: 100
|
166
|
+
Metrics/ModuleLength:
|
167
|
+
CountComments: false
|
168
|
+
Max: 100
|
169
|
+
Description: Avoid modules longer than 100 lines of code.
|
170
|
+
Enabled: false
|
171
|
+
Metrics/CyclomaticComplexity:
|
172
|
+
Description: A complexity metric that is strongly correlated to the number of test
|
173
|
+
cases needed to validate a method.
|
174
|
+
Enabled: false
|
175
|
+
Max: 6
|
176
|
+
Metrics/MethodLength:
|
177
|
+
Description: Avoid methods longer than 10 lines of code.
|
178
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
179
|
+
Enabled: false
|
180
|
+
CountComments: false
|
181
|
+
Max: 10
|
182
|
+
Metrics/ParameterLists:
|
183
|
+
Description: Avoid parameter lists longer than three or four parameters.
|
184
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
|
185
|
+
Enabled: false
|
186
|
+
Max: 5
|
187
|
+
CountKeywordArgs: true
|
188
|
+
Metrics/PerceivedComplexity:
|
189
|
+
Description: A complexity metric geared towards measuring complexity for a human
|
190
|
+
reader.
|
191
|
+
Enabled: false
|
192
|
+
Max: 7
|
193
|
+
Lint/AssignmentInCondition:
|
194
|
+
Description: Don't use assignment in conditions.
|
195
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
|
196
|
+
Enabled: false
|
197
|
+
AllowSafeAssignment: true
|
198
|
+
Style/InlineComment:
|
199
|
+
Description: Avoid inline comments.
|
200
|
+
Enabled: false
|
201
|
+
Style/AccessorMethodName:
|
202
|
+
Description: Check the naming of accessor methods for get_/set_.
|
203
|
+
Enabled: false
|
204
|
+
Style/Alias:
|
205
|
+
Description: Use alias_method instead of alias.
|
206
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
|
207
|
+
Enabled: false
|
208
|
+
Style/Documentation:
|
209
|
+
Description: Document classes and non-namespace modules.
|
210
|
+
Enabled: false
|
211
|
+
Style/DoubleNegation:
|
212
|
+
Description: Checks for uses of double negation (!!).
|
213
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
|
214
|
+
Enabled: false
|
215
|
+
Style/EachWithObject:
|
216
|
+
Description: Prefer `each_with_object` over `inject` or `reduce`.
|
217
|
+
Enabled: false
|
218
|
+
Style/EmptyLiteral:
|
219
|
+
Description: Prefer literals to Array.new/Hash.new/String.new.
|
220
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
|
221
|
+
Enabled: false
|
222
|
+
Style/ModuleFunction:
|
223
|
+
Description: Checks for usage of `extend self` in modules.
|
224
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
|
225
|
+
Enabled: false
|
226
|
+
Style/OneLineConditional:
|
227
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
228
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
229
|
+
Enabled: false
|
230
|
+
Style/PerlBackrefs:
|
231
|
+
Description: Avoid Perl-style regex back references.
|
232
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
|
233
|
+
Enabled: false
|
234
|
+
Style/Send:
|
235
|
+
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
236
|
+
may overlap with existing methods.
|
237
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
|
238
|
+
Enabled: false
|
239
|
+
Style/SpecialGlobalVars:
|
240
|
+
Description: Avoid Perl-style global variables.
|
241
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
|
242
|
+
Enabled: false
|
243
|
+
Style/VariableInterpolation:
|
244
|
+
Description: Don't interpolate global, instance and class variables directly in
|
245
|
+
strings.
|
246
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
|
247
|
+
Enabled: false
|
248
|
+
Style/WhenThen:
|
249
|
+
Description: Use when x then ... for one-line cases.
|
250
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
|
251
|
+
Enabled: false
|
252
|
+
Lint/EachWithObjectArgument:
|
253
|
+
Description: Check for immutable argument given to each_with_object.
|
254
|
+
Enabled: true
|
255
|
+
Lint/EndAlignment:
|
256
|
+
Description: This cop checks whether the end keywords are aligned properly.
|
257
|
+
AlignWith: variable
|
258
|
+
Enabled: true
|
259
|
+
Lint/HandleExceptions:
|
260
|
+
Description: Don't suppress exception.
|
261
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
262
|
+
Enabled: false
|
263
|
+
Lint/LiteralInCondition:
|
264
|
+
Description: Checks of literals used in conditions.
|
265
|
+
Enabled: false
|
266
|
+
Lint/LiteralInInterpolation:
|
267
|
+
Description: Checks for literals used in interpolation.
|
268
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.2.3
|
6
|
+
- 2.1.7
|
7
|
+
- 2.0.0
|
8
|
+
- 1.9.3
|
9
|
+
- jruby
|
10
|
+
- rbx-2
|
11
|
+
notifications:
|
12
|
+
flowdock:
|
13
|
+
secure: fSZxX5z3bHWT8aCFKBFrDDt5o3Jb6EFWcm+pAcMabpfDHc4iktWuCUlSM405798TRdKdws1A2RncQGYiQyLbqNvtLz48dvj4BxgYW7P/vg0koN+I/H2MjpZeuIQ7BRSEJIq2sAYNVya+hSil+SPEBMTngJiP6VYG0dm6fFnRkyk=
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
## [UNRELEASED]
|
2
|
+
### Added
|
3
|
+
|
4
|
+
### Changed
|
5
|
+
|
6
|
+
### Deprecated
|
7
|
+
|
8
|
+
### Removed
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
### Security
|
13
|
+
|
14
|
+
## [0.2.0] - 2016-02-04
|
15
|
+
### Added
|
16
|
+
- a changelog
|
17
|
+
- get operation for orders
|
18
|
+
- create_customer method
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- create orders without a contract_id
|
22
|
+
- changes sandbox url from sandbox.pactas.com to sandbox.billwerk.com
|
23
|
+
|
24
|
+
-----------------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
Template:
|
27
|
+
## [0.0.0] - 2014-05-31
|
28
|
+
### Added
|
29
|
+
- something was added
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
- something changed
|
33
|
+
|
34
|
+
### Deprecated
|
35
|
+
- something is deprecated
|
36
|
+
|
37
|
+
### Removed
|
38
|
+
- something was removed
|
39
|
+
|
40
|
+
### Fixed
|
41
|
+
- something was fixed
|
42
|
+
|
43
|
+
### Security
|
44
|
+
- a security fix
|
45
|
+
|
46
|
+
Following "[Keep a CHANGELOG](http://keepachangelog.com/)"
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 sthollmann
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
[](https://travis-ci.org/shipcloud/pactas_itero)
|
2
|
+
|
3
|
+
# PactasItero
|
4
|
+
|
5
|
+
TODO: Write a gem description
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'pactas_itero'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install pactas_itero
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it ( https://github.com/[my-github-username]/pactas_itero/fork )
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
5
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
6
|
+
end
|
7
|
+
|
8
|
+
task :console do
|
9
|
+
require 'irb'
|
10
|
+
require 'irb/completion'
|
11
|
+
require 'pactas_itero'
|
12
|
+
ARGV.clear
|
13
|
+
IRB.start
|
14
|
+
end
|
15
|
+
|
16
|
+
task default: :spec
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module PactasItero
|
2
|
+
module Api
|
3
|
+
module Contracts
|
4
|
+
def customer_contracts(customer_id, options = {})
|
5
|
+
options = options.camelize_keys
|
6
|
+
get "api/v1/customers/#{customer_id}/contracts", options
|
7
|
+
end
|
8
|
+
|
9
|
+
def contracts(options = {})
|
10
|
+
options = options.camelize_keys
|
11
|
+
get "api/v1/contracts", options
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_contract(contract_id, options = {})
|
15
|
+
options = options.camelize_keys
|
16
|
+
patch "api/v1/contracts/#{contract_id}", options
|
17
|
+
end
|
18
|
+
|
19
|
+
def contract(contract_id, options = {})
|
20
|
+
options = options.camelize_keys
|
21
|
+
get "api/v1/contracts/#{contract_id}", options
|
22
|
+
end
|
23
|
+
|
24
|
+
def contract_cancellation_preview(contract_id, options = {})
|
25
|
+
options = options.camelize_keys
|
26
|
+
get "api/v1/contracts/#{contract_id}/cancellationPreview", options
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PactasItero
|
2
|
+
module Api
|
3
|
+
module Customers
|
4
|
+
def create_customer(options= {})
|
5
|
+
options = options.camelize_keys
|
6
|
+
post "api/v1/customers", options
|
7
|
+
end
|
8
|
+
|
9
|
+
def customers(options = {})
|
10
|
+
options = options.camelize_keys
|
11
|
+
get "api/v1/customers", options
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_customer(customer_id, options = {})
|
15
|
+
options = options.camelize_keys
|
16
|
+
patch "api/v1/customers/#{customer_id}", options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module PactasItero
|
2
|
+
module Api
|
3
|
+
module Invoices
|
4
|
+
|
5
|
+
def invoices(options = {})
|
6
|
+
options = options.camelize_keys
|
7
|
+
get "api/v1/invoices", options
|
8
|
+
end
|
9
|
+
|
10
|
+
def invoices_from(from_id=nil, options = {})
|
11
|
+
if from_id
|
12
|
+
options = options.camelize_keys
|
13
|
+
get "api/v1/invoices?from=#{from_id}", options
|
14
|
+
else
|
15
|
+
invoices(options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def invoice(invoice_id, options = {})
|
20
|
+
options = options.camelize_keys
|
21
|
+
get "api/v1/invoices/#{invoice_id}", options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PactasItero
|
2
|
+
module Api
|
3
|
+
module Orders
|
4
|
+
def create_order(options = {})
|
5
|
+
options = options.camelize_keys
|
6
|
+
post "api/v1/orders", options
|
7
|
+
end
|
8
|
+
|
9
|
+
def order(order_id, options = {})
|
10
|
+
get "api/v1/orders/#{order_id}", options
|
11
|
+
end
|
12
|
+
|
13
|
+
def commit_order(order_id, options = {})
|
14
|
+
options = options.camelize_keys
|
15
|
+
post "api/v1/orders/#{order_id}/commit", options
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PactasItero
|
2
|
+
module Api
|
3
|
+
module RatedItems
|
4
|
+
def create_rated_item(contract_id, quantity, description, price_per_unit, tax_policy_id, options = {})
|
5
|
+
options.merge!(
|
6
|
+
quantity: quantity,
|
7
|
+
description: description,
|
8
|
+
price_per_unit: price_per_unit,
|
9
|
+
tax_policy_id: tax_policy_id
|
10
|
+
)
|
11
|
+
options = options.camelize_keys
|
12
|
+
post "api/v1/contracts/#{contract_id}/ratedItems", options
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'pactas_itero/ext/hash/camelize_keys'
|
2
|
+
require 'pactas_itero/api/oauth'
|
3
|
+
require 'pactas_itero/api/rated_items'
|
4
|
+
require 'pactas_itero/api/customers'
|
5
|
+
require 'pactas_itero/api/contracts'
|
6
|
+
require 'pactas_itero/api/orders'
|
7
|
+
require 'pactas_itero/api/invoices'
|
8
|
+
|
9
|
+
module PactasItero
|
10
|
+
module Api
|
11
|
+
include PactasItero::Api::OAuth
|
12
|
+
include PactasItero::Api::RatedItems
|
13
|
+
include PactasItero::Api::Customers
|
14
|
+
include PactasItero::Api::Contracts
|
15
|
+
include PactasItero::Api::Orders
|
16
|
+
include PactasItero::Api::Invoices
|
17
|
+
end
|
18
|
+
end
|