pactas_itero 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +39 -0
  3. data/.hound.yml +14 -0
  4. data/.rubocop.yml +2 -0
  5. data/.ruby-style.yml +268 -0
  6. data/.travis.yml +13 -0
  7. data/CHANGELOG.md +46 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +33 -0
  11. data/Rakefile +16 -0
  12. data/lib/pactas_itero/api/contracts.rb +30 -0
  13. data/lib/pactas_itero/api/customers.rb +20 -0
  14. data/lib/pactas_itero/api/invoices.rb +25 -0
  15. data/lib/pactas_itero/api/oauth.rb +12 -0
  16. data/lib/pactas_itero/api/orders.rb +19 -0
  17. data/lib/pactas_itero/api/rated_items.rb +16 -0
  18. data/lib/pactas_itero/api.rb +18 -0
  19. data/lib/pactas_itero/client.rb +108 -0
  20. data/lib/pactas_itero/configurable.rb +59 -0
  21. data/lib/pactas_itero/default.rb +77 -0
  22. data/lib/pactas_itero/error.rb +217 -0
  23. data/lib/pactas_itero/ext/hash/camelize_keys.rb +32 -0
  24. data/lib/pactas_itero/response/raise_error.rb +21 -0
  25. data/lib/pactas_itero/version.rb +3 -0
  26. data/lib/pactas_itero.rb +31 -0
  27. data/pactas_itero.gemspec +32 -0
  28. data/spec/fixtures/bearer_token.json +5 -0
  29. data/spec/fixtures/commit_order_response.json +50 -0
  30. data/spec/fixtures/contract.json +46 -0
  31. data/spec/fixtures/contract_cancellation_preview_response.json +73 -0
  32. data/spec/fixtures/contracts.json +48 -0
  33. data/spec/fixtures/create_order_response.json +17 -0
  34. data/spec/fixtures/create_rated_item.json +8 -0
  35. data/spec/fixtures/customer.json +23 -0
  36. data/spec/fixtures/customers.json +40 -0
  37. data/spec/fixtures/invoice.json +22 -0
  38. data/spec/fixtures/invoices.json +46 -0
  39. data/spec/fixtures/order.json +15 -0
  40. data/spec/pactas_itero/api/contracts_spec.rb +118 -0
  41. data/spec/pactas_itero/api/customers_spec.rb +188 -0
  42. data/spec/pactas_itero/api/invoices_spec.rb +87 -0
  43. data/spec/pactas_itero/api/oauth_spec.rb +40 -0
  44. data/spec/pactas_itero/api/orders_spec.rb +102 -0
  45. data/spec/pactas_itero/api/rated_items_spec.rb +74 -0
  46. data/spec/pactas_itero/client_spec.rb +316 -0
  47. data/spec/pactas_itero_spec.rb +32 -0
  48. data/spec/spec_helper.rb +100 -0
  49. metadata +218 -0
@@ -0,0 +1,100 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ ]
6
+
7
+ SimpleCov.start do
8
+ add_filter '/spec/'
9
+ add_filter '/vendor/bundle'
10
+ #minimum_coverage(99.15)
11
+ refuse_coverage_drop
12
+ end
13
+
14
+ require 'json'
15
+ require 'pactas_itero'
16
+ require 'rspec'
17
+ require 'webmock/rspec'
18
+
19
+ WebMock.disable_net_connect!
20
+
21
+ RSpec.configure do |config|
22
+ config.raise_errors_for_deprecations!
23
+ # Disable should syntax
24
+ # https://www.relishapp.com/rspec/rspec-expectations/docs/syntax-configuration
25
+ config.expect_with :rspec do |c|
26
+ c.syntax = :expect
27
+ end
28
+
29
+ # had to override backtrace_exclusion_patterns because of current
30
+ # directory structure. once this gem has been extracted into a separate
31
+ # respository this can be removed
32
+ config.backtrace_exclusion_patterns = [
33
+ /\/lib\d*\/ruby\//,
34
+ /org\/jruby\//,
35
+ /bin\//,
36
+ /vendor\/bundle\/(.*)\/gems\//,
37
+ /spec\/spec_helper.rb/,
38
+ /lib\/rspec\/(core|expectations|matchers|mocks)/
39
+ ]
40
+
41
+ config.after(:each) do
42
+ PactasItero.reset!
43
+ end
44
+ end
45
+
46
+ def fixture_path
47
+ File.expand_path('../fixtures', __FILE__)
48
+ end
49
+
50
+ def fixture(file)
51
+ File.new(fixture_path + '/' + file)
52
+ end
53
+
54
+ def pactas_api_endpoint
55
+ PactasItero::Default::SANDBOX_API_ENDPOINT
56
+ end
57
+
58
+ def pactas_api_url(url)
59
+ url =~ /^http/ ? url : "#{pactas_api_endpoint}#{url}"
60
+ end
61
+
62
+ def a_delete(path)
63
+ a_request(:delete, pactas_api_url(path))
64
+ end
65
+
66
+ def a_get(path)
67
+ a_request(:get, pactas_api_url(path))
68
+ end
69
+
70
+ def a_post(path)
71
+ a_request(:post, pactas_api_url(path))
72
+ end
73
+
74
+ def a_put(path)
75
+ a_request(:put, pactas_api_url(path))
76
+ end
77
+
78
+ def stub_delete(path)
79
+ stub_request(:delete, pactas_api_url(path))
80
+ end
81
+
82
+ def stub_get(path)
83
+ stub_request(:get, pactas_api_url(path))
84
+ end
85
+
86
+ def stub_head(path)
87
+ stub_request(:head, pactas_api_url(path))
88
+ end
89
+
90
+ def stub_post(path)
91
+ stub_request(:post, pactas_api_url(path))
92
+ end
93
+
94
+ def stub_put(path)
95
+ stub_request(:put, pactas_api_url(path))
96
+ end
97
+
98
+ def stub_patch(path)
99
+ stub_request(:patch, pactas_api_url(path))
100
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pactas_itero
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Simon Fröhler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday_middleware
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.1
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.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rash
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.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.4.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.18'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 1.18.0
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '1.18'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 1.18.0
117
+ description: |-
118
+ pactas_itero provides a client mapping for accessing
119
+ the Pactas Itero API, making it easy to post your data to, adn read your
120
+ data from your Pactas account.
121
+ email: simon@shipcloud.io
122
+ executables: []
123
+ extensions: []
124
+ extra_rdoc_files: []
125
+ files:
126
+ - ".gitignore"
127
+ - ".hound.yml"
128
+ - ".rubocop.yml"
129
+ - ".ruby-style.yml"
130
+ - ".travis.yml"
131
+ - CHANGELOG.md
132
+ - Gemfile
133
+ - LICENSE.txt
134
+ - README.md
135
+ - Rakefile
136
+ - lib/pactas_itero.rb
137
+ - lib/pactas_itero/api.rb
138
+ - lib/pactas_itero/api/contracts.rb
139
+ - lib/pactas_itero/api/customers.rb
140
+ - lib/pactas_itero/api/invoices.rb
141
+ - lib/pactas_itero/api/oauth.rb
142
+ - lib/pactas_itero/api/orders.rb
143
+ - lib/pactas_itero/api/rated_items.rb
144
+ - lib/pactas_itero/client.rb
145
+ - lib/pactas_itero/configurable.rb
146
+ - lib/pactas_itero/default.rb
147
+ - lib/pactas_itero/error.rb
148
+ - lib/pactas_itero/ext/hash/camelize_keys.rb
149
+ - lib/pactas_itero/response/raise_error.rb
150
+ - lib/pactas_itero/version.rb
151
+ - pactas_itero.gemspec
152
+ - spec/fixtures/bearer_token.json
153
+ - spec/fixtures/commit_order_response.json
154
+ - spec/fixtures/contract.json
155
+ - spec/fixtures/contract_cancellation_preview_response.json
156
+ - spec/fixtures/contracts.json
157
+ - spec/fixtures/create_order_response.json
158
+ - spec/fixtures/create_rated_item.json
159
+ - spec/fixtures/customer.json
160
+ - spec/fixtures/customers.json
161
+ - spec/fixtures/invoice.json
162
+ - spec/fixtures/invoices.json
163
+ - spec/fixtures/order.json
164
+ - spec/pactas_itero/api/contracts_spec.rb
165
+ - spec/pactas_itero/api/customers_spec.rb
166
+ - spec/pactas_itero/api/invoices_spec.rb
167
+ - spec/pactas_itero/api/oauth_spec.rb
168
+ - spec/pactas_itero/api/orders_spec.rb
169
+ - spec/pactas_itero/api/rated_items_spec.rb
170
+ - spec/pactas_itero/client_spec.rb
171
+ - spec/pactas_itero_spec.rb
172
+ - spec/spec_helper.rb
173
+ homepage: https://github.com/webionate/pactas_itero
174
+ licenses:
175
+ - MIT
176
+ metadata: {}
177
+ post_install_message:
178
+ rdoc_options: []
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ requirements: []
192
+ rubyforge_project:
193
+ rubygems_version: 2.5.1
194
+ signing_key:
195
+ specification_version: 4
196
+ summary: pactas_itero provides a client mapping for accessing the Pactas Itero API.
197
+ test_files:
198
+ - spec/fixtures/bearer_token.json
199
+ - spec/fixtures/commit_order_response.json
200
+ - spec/fixtures/contract.json
201
+ - spec/fixtures/contract_cancellation_preview_response.json
202
+ - spec/fixtures/contracts.json
203
+ - spec/fixtures/create_order_response.json
204
+ - spec/fixtures/create_rated_item.json
205
+ - spec/fixtures/customer.json
206
+ - spec/fixtures/customers.json
207
+ - spec/fixtures/invoice.json
208
+ - spec/fixtures/invoices.json
209
+ - spec/fixtures/order.json
210
+ - spec/pactas_itero/api/contracts_spec.rb
211
+ - spec/pactas_itero/api/customers_spec.rb
212
+ - spec/pactas_itero/api/invoices_spec.rb
213
+ - spec/pactas_itero/api/oauth_spec.rb
214
+ - spec/pactas_itero/api/orders_spec.rb
215
+ - spec/pactas_itero/api/rated_items_spec.rb
216
+ - spec/pactas_itero/client_spec.rb
217
+ - spec/pactas_itero_spec.rb
218
+ - spec/spec_helper.rb