beanie 0.1.4 → 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 +5 -5
- data/Gemfile +4 -0
- data/README.md +79 -16
- data/Rakefile +8 -1
- data/beanie.gemspec +44 -25
- data/docs/BankAccount.md +24 -0
- data/docs/BankAccountApi.md +154 -0
- data/docs/BankAccountInput.md +24 -0
- data/docs/ErrorModel.md +9 -0
- data/git_push.sh +55 -0
- data/lib/beanie/api/bank_account_api.rb +183 -0
- data/lib/beanie/api_client.rb +388 -0
- data/lib/beanie/api_error.rb +38 -0
- data/lib/beanie/configuration.rb +202 -0
- data/lib/beanie/models/bank_account.rb +358 -0
- data/lib/beanie/models/bank_account_input.rb +357 -0
- data/lib/beanie/models/error_model.rb +202 -0
- data/lib/beanie/version.rb +13 -30
- data/lib/beanie.rb +32 -115
- data/spec/api/bank_account_api_spec.rb +71 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/bank_account_input_spec.rb +137 -0
- data/spec/models/bank_account_spec.rb +137 -0
- data/spec/models/error_model_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +174 -71
- data/.gitignore +0 -17
- data/VERSION +0 -1
- data/lib/beanie/api.rb +0 -182
- data/lib/beanie/bank_account.rb +0 -44
- data/lib/beanie/bank_statement.rb +0 -45
- data/lib/beanie/bank_statement_data.rb +0 -51
- data/lib/beanie/beanie_alert.rb +0 -66
- data/lib/beanie/bill_of_material.rb +0 -44
- data/lib/beanie/billable.rb +0 -46
- data/lib/beanie/bom_item.rb +0 -44
- data/lib/beanie/company.rb +0 -66
- data/lib/beanie/company_member.rb +0 -43
- data/lib/beanie/config_type.rb +0 -62
- data/lib/beanie/config_value.rb +0 -42
- data/lib/beanie/customer.rb +0 -51
- data/lib/beanie/customer_address.rb +0 -63
- data/lib/beanie/customer_note.rb +0 -42
- data/lib/beanie/document.rb +0 -71
- data/lib/beanie/fixed_asset.rb +0 -45
- data/lib/beanie/journal.rb +0 -44
- data/lib/beanie/journal_item.rb +0 -44
- data/lib/beanie/nominal_account.rb +0 -73
- data/lib/beanie/nominal_account_category.rb +0 -49
- data/lib/beanie/product.rb +0 -52
- data/lib/beanie/product_category.rb +0 -43
- data/lib/beanie/product_price.rb +0 -44
- data/lib/beanie/production_order.rb +0 -76
- data/lib/beanie/purchase_invoice.rb +0 -55
- data/lib/beanie/purchase_order.rb +0 -46
- data/lib/beanie/purchase_order_item.rb +0 -60
- data/lib/beanie/sales_invoice.rb +0 -83
- data/lib/beanie/sales_invoice_item.rb +0 -50
- data/lib/beanie/sales_order.rb +0 -74
- data/lib/beanie/sales_order_item.rb +0 -126
- data/lib/beanie/stock_adjustment.rb +0 -70
- data/lib/beanie/stock_category.rb +0 -44
- data/lib/beanie/stock_item.rb +0 -58
- data/lib/beanie/stock_location.rb +0 -42
- data/lib/beanie/stock_supplier.rb +0 -48
- data/lib/beanie/supplier.rb +0 -48
- data/lib/beanie/supplier_address.rb +0 -53
- data/lib/beanie/supplier_note.rb +0 -42
- data/lib/beanie/tax_registration.rb +0 -59
- data/lib/beanie/vat_record.rb +0 -66
- data/lib/beanie/vat_return.rb +0 -60
- data/lib/beanie/work_centre.rb +0 -99
- data/lib/beanie/work_centre_group.rb +0 -50
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
=begin
|
2
|
+
#Beanie ERP API
|
3
|
+
|
4
|
+
#An API specification for interacting with the Beanie ERP system
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.1
|
7
|
+
Contact: dev@bean.ie
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# load the gem
|
14
|
+
require 'beanie'
|
15
|
+
|
16
|
+
# The following was generated by the `rspec --init` command. Conventionally, all
|
17
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
18
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
19
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
20
|
+
# files.
|
21
|
+
#
|
22
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
23
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
24
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
25
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
26
|
+
# a separate helper file that requires the additional dependencies and performs
|
27
|
+
# the additional setup, and require it from the spec files that actually need
|
28
|
+
# it.
|
29
|
+
#
|
30
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
31
|
+
# users commonly want.
|
32
|
+
#
|
33
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
34
|
+
RSpec.configure do |config|
|
35
|
+
# rspec-expectations config goes here. You can use an alternate
|
36
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
37
|
+
# assertions if you prefer.
|
38
|
+
config.expect_with :rspec do |expectations|
|
39
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
40
|
+
# and `failure_message` of custom matchers include text for helper methods
|
41
|
+
# defined using `chain`, e.g.:
|
42
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
43
|
+
# # => "be bigger than 2 and smaller than 4"
|
44
|
+
# ...rather than:
|
45
|
+
# # => "be bigger than 2"
|
46
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
47
|
+
end
|
48
|
+
|
49
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
50
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
51
|
+
config.mock_with :rspec do |mocks|
|
52
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
53
|
+
# a real object. This is generally recommended, and will default to
|
54
|
+
# `true` in RSpec 4.
|
55
|
+
mocks.verify_partial_doubles = true
|
56
|
+
end
|
57
|
+
|
58
|
+
# The settings below are suggested to provide a good initial experience
|
59
|
+
# with RSpec, but feel free to customize to your heart's content.
|
60
|
+
=begin
|
61
|
+
# These two settings work together to allow you to limit a spec run
|
62
|
+
# to individual examples or groups you care about by tagging them with
|
63
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
64
|
+
# get run.
|
65
|
+
config.filter_run :focus
|
66
|
+
config.run_all_when_everything_filtered = true
|
67
|
+
|
68
|
+
# Allows RSpec to persist some state between runs in order to support
|
69
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
70
|
+
# you configure your source control system to ignore this file.
|
71
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
72
|
+
|
73
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
74
|
+
# recommended. For more details, see:
|
75
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
76
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
78
|
+
config.disable_monkey_patching!
|
79
|
+
|
80
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
81
|
+
# be too noisy due to issues in dependencies.
|
82
|
+
config.warnings = true
|
83
|
+
|
84
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
85
|
+
# file, and it's useful to allow more verbose output when running an
|
86
|
+
# individual spec file.
|
87
|
+
if config.files_to_run.one?
|
88
|
+
# Use the documentation formatter for detailed output,
|
89
|
+
# unless a formatter has already been configured
|
90
|
+
# (e.g. via a command-line flag).
|
91
|
+
config.default_formatter = 'doc'
|
92
|
+
end
|
93
|
+
|
94
|
+
# Print the 10 slowest examples and example groups at the
|
95
|
+
# end of the spec run, to help surface which specs are running
|
96
|
+
# particularly slow.
|
97
|
+
config.profile_examples = 10
|
98
|
+
|
99
|
+
# Run specs in random order to surface order dependencies. If you find an
|
100
|
+
# order dependency and want to debug it, you can fix the order by providing
|
101
|
+
# the seed, which is printed after each run.
|
102
|
+
# --seed 1234
|
103
|
+
config.order = :random
|
104
|
+
|
105
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
106
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
107
|
+
# test failures related to randomization by passing the same `--seed` value
|
108
|
+
# as the one that triggered the failure.
|
109
|
+
Kernel.srand config.seed
|
110
|
+
=end
|
111
|
+
end
|
metadata
CHANGED
@@ -1,134 +1,230 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beanie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Beanie Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: typhoeus
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.1'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.1.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.1'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.1.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3.6'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.6.0
|
20
63
|
type: :development
|
21
64
|
prerelease: false
|
22
65
|
version_requirements: !ruby/object:Gem::Requirement
|
23
66
|
requirements:
|
24
67
|
- - "~>"
|
25
68
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
69
|
+
version: '3.6'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 3.6.0
|
27
73
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
74
|
+
name: vcr
|
29
75
|
requirement: !ruby/object:Gem::Requirement
|
30
76
|
requirements:
|
31
77
|
- - "~>"
|
32
78
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
79
|
+
version: '3.0'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.0.1
|
34
83
|
type: :development
|
35
84
|
prerelease: false
|
36
85
|
version_requirements: !ruby/object:Gem::Requirement
|
37
86
|
requirements:
|
38
87
|
- - "~>"
|
39
88
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
89
|
+
version: '3.0'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 3.0.1
|
41
93
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
94
|
+
name: webmock
|
43
95
|
requirement: !ruby/object:Gem::Requirement
|
44
96
|
requirements:
|
45
97
|
- - "~>"
|
46
98
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
|
99
|
+
version: '1.24'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.24.3
|
103
|
+
type: :development
|
49
104
|
prerelease: false
|
50
105
|
version_requirements: !ruby/object:Gem::Requirement
|
51
106
|
requirements:
|
52
107
|
- - "~>"
|
53
108
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
109
|
+
version: '1.24'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.24.3
|
55
113
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
114
|
+
name: autotest
|
57
115
|
requirement: !ruby/object:Gem::Requirement
|
58
116
|
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '4.4'
|
59
120
|
- - ">="
|
60
121
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :
|
122
|
+
version: 4.4.6
|
123
|
+
type: :development
|
63
124
|
prerelease: false
|
64
125
|
version_requirements: !ruby/object:Gem::Requirement
|
65
126
|
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '4.4'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 4.4.6
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: autotest-rails-pure
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '4.1'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 4.1.2
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '4.1'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 4.1.2
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: autotest-growl
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.2'
|
66
160
|
- - ">="
|
67
161
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
|
162
|
+
version: 0.2.16
|
163
|
+
type: :development
|
164
|
+
prerelease: false
|
165
|
+
version_requirements: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0.2'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 0.2.16
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: autotest-fsevent
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0.2'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 0.2.12
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0.2'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 0.2.12
|
193
|
+
description: An API specification for interacting with the Beanie ERP system
|
70
194
|
email:
|
71
|
-
-
|
195
|
+
- dev@bean.ie
|
72
196
|
executables: []
|
73
197
|
extensions: []
|
74
198
|
extra_rdoc_files: []
|
75
199
|
files:
|
76
|
-
- ".gitignore"
|
77
200
|
- CONTRIBUTORS
|
78
201
|
- Gemfile
|
79
202
|
- LICENSE
|
80
203
|
- README.md
|
81
204
|
- Rakefile
|
82
|
-
- VERSION
|
83
205
|
- beanie.gemspec
|
206
|
+
- docs/BankAccount.md
|
207
|
+
- docs/BankAccountApi.md
|
208
|
+
- docs/BankAccountInput.md
|
209
|
+
- docs/ErrorModel.md
|
210
|
+
- git_push.sh
|
84
211
|
- lib/beanie.rb
|
85
|
-
- lib/beanie/api.rb
|
86
|
-
- lib/beanie/
|
87
|
-
- lib/beanie/
|
88
|
-
- lib/beanie/
|
89
|
-
- lib/beanie/
|
90
|
-
- lib/beanie/
|
91
|
-
- lib/beanie/
|
92
|
-
- lib/beanie/bom_item.rb
|
93
|
-
- lib/beanie/company.rb
|
94
|
-
- lib/beanie/company_member.rb
|
95
|
-
- lib/beanie/config_type.rb
|
96
|
-
- lib/beanie/config_value.rb
|
97
|
-
- lib/beanie/customer.rb
|
98
|
-
- lib/beanie/customer_address.rb
|
99
|
-
- lib/beanie/customer_note.rb
|
100
|
-
- lib/beanie/document.rb
|
101
|
-
- lib/beanie/fixed_asset.rb
|
102
|
-
- lib/beanie/journal.rb
|
103
|
-
- lib/beanie/journal_item.rb
|
104
|
-
- lib/beanie/nominal_account.rb
|
105
|
-
- lib/beanie/nominal_account_category.rb
|
106
|
-
- lib/beanie/product.rb
|
107
|
-
- lib/beanie/product_category.rb
|
108
|
-
- lib/beanie/product_price.rb
|
109
|
-
- lib/beanie/production_order.rb
|
110
|
-
- lib/beanie/purchase_invoice.rb
|
111
|
-
- lib/beanie/purchase_order.rb
|
112
|
-
- lib/beanie/purchase_order_item.rb
|
113
|
-
- lib/beanie/sales_invoice.rb
|
114
|
-
- lib/beanie/sales_invoice_item.rb
|
115
|
-
- lib/beanie/sales_order.rb
|
116
|
-
- lib/beanie/sales_order_item.rb
|
117
|
-
- lib/beanie/stock_adjustment.rb
|
118
|
-
- lib/beanie/stock_category.rb
|
119
|
-
- lib/beanie/stock_item.rb
|
120
|
-
- lib/beanie/stock_location.rb
|
121
|
-
- lib/beanie/stock_supplier.rb
|
122
|
-
- lib/beanie/supplier.rb
|
123
|
-
- lib/beanie/supplier_address.rb
|
124
|
-
- lib/beanie/supplier_note.rb
|
125
|
-
- lib/beanie/tax_registration.rb
|
126
|
-
- lib/beanie/vat_record.rb
|
127
|
-
- lib/beanie/vat_return.rb
|
212
|
+
- lib/beanie/api/bank_account_api.rb
|
213
|
+
- lib/beanie/api_client.rb
|
214
|
+
- lib/beanie/api_error.rb
|
215
|
+
- lib/beanie/configuration.rb
|
216
|
+
- lib/beanie/models/bank_account.rb
|
217
|
+
- lib/beanie/models/bank_account_input.rb
|
218
|
+
- lib/beanie/models/error_model.rb
|
128
219
|
- lib/beanie/version.rb
|
129
|
-
-
|
130
|
-
-
|
131
|
-
|
220
|
+
- spec/api/bank_account_api_spec.rb
|
221
|
+
- spec/api_client_spec.rb
|
222
|
+
- spec/configuration_spec.rb
|
223
|
+
- spec/models/bank_account_input_spec.rb
|
224
|
+
- spec/models/bank_account_spec.rb
|
225
|
+
- spec/models/error_model_spec.rb
|
226
|
+
- spec/spec_helper.rb
|
227
|
+
homepage: https://rubygems.org/gems/beanie
|
132
228
|
licenses:
|
133
229
|
- MIT
|
134
230
|
metadata: {}
|
@@ -140,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
236
|
requirements:
|
141
237
|
- - ">="
|
142
238
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
239
|
+
version: '1.9'
|
144
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
241
|
requirements:
|
146
242
|
- - ">="
|
@@ -148,8 +244,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
244
|
version: '0'
|
149
245
|
requirements: []
|
150
246
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
247
|
+
rubygems_version: 2.7.6
|
152
248
|
signing_key:
|
153
249
|
specification_version: 4
|
154
|
-
summary:
|
155
|
-
test_files:
|
250
|
+
summary: Beanie ERP API Ruby Gem
|
251
|
+
test_files:
|
252
|
+
- spec/api/bank_account_api_spec.rb
|
253
|
+
- spec/api_client_spec.rb
|
254
|
+
- spec/configuration_spec.rb
|
255
|
+
- spec/models/bank_account_input_spec.rb
|
256
|
+
- spec/models/bank_account_spec.rb
|
257
|
+
- spec/models/error_model_spec.rb
|
258
|
+
- spec/spec_helper.rb
|
data/.gitignore
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.4
|
data/lib/beanie/api.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2017-2018, AltoYield Limited. All rights reserved.
|
3
|
-
#
|
4
|
-
# This is free software; you can redistribute it and/or modify it
|
5
|
-
# under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; either version 2, or (at your option)
|
7
|
-
# any later version.
|
8
|
-
#
|
9
|
-
# It is distributed in the hope that it will be useful, but WITHOUT
|
10
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
11
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12
|
-
# for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License along
|
15
|
-
# with this product; see the file COPYING. If not, write to the Free
|
16
|
-
# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
17
|
-
#
|
18
|
-
# THIS SOFTWARE IS PROVIDED BY ALTOYIELD LIMITED "AS IS" AND ANY EXPRESS
|
19
|
-
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL ALTOYIELD LIMITED BE LIABLE FOR
|
22
|
-
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
-
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
-
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
26
|
-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
27
|
-
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
#
|
30
|
-
require 'active_support/inflector'
|
31
|
-
|
32
|
-
module Beanie
|
33
|
-
class Api
|
34
|
-
#
|
35
|
-
# Find all the objects
|
36
|
-
def self.all(opts = {})
|
37
|
-
data = get(opts)
|
38
|
-
objlist = []
|
39
|
-
data[new.object_name.pluralize].each do |objdata|
|
40
|
-
objlist << new.populate(objdata)
|
41
|
-
end
|
42
|
-
objlist
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Find an object based on its ID
|
47
|
-
def self.find(id)
|
48
|
-
data = get(:id => id)
|
49
|
-
obj = new
|
50
|
-
obj.populate(data[obj.object_name])
|
51
|
-
end
|
52
|
-
|
53
|
-
#
|
54
|
-
# Save the customer data
|
55
|
-
def save!(opts = {})
|
56
|
-
data = extract()
|
57
|
-
data.delete("id")
|
58
|
-
objdata = {object_name => data}
|
59
|
-
if @id
|
60
|
-
#
|
61
|
-
# Needs an update...
|
62
|
-
opts[:id] = @id
|
63
|
-
response = self.class.put(objdata, opts)
|
64
|
-
else
|
65
|
-
#
|
66
|
-
# Needs a create!
|
67
|
-
response = self.class.post(objdata, opts)
|
68
|
-
end
|
69
|
-
self.populate(response[self.object_name])
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Populate the instance variables from the provided hash.
|
74
|
-
def populate(data)
|
75
|
-
self.instance_variables.each do |var|
|
76
|
-
self.instance_variable_set(var, data[field_name(var)])
|
77
|
-
end
|
78
|
-
self
|
79
|
-
end
|
80
|
-
|
81
|
-
#
|
82
|
-
# Populate the instance variables from the provided hash.
|
83
|
-
def extract
|
84
|
-
data = {}
|
85
|
-
self.instance_variables.each do |var|
|
86
|
-
data[field_name(var)] = self.instance_variable_get(var)
|
87
|
-
end
|
88
|
-
data
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# Determine the field name
|
93
|
-
def field_name(var)
|
94
|
-
var.to_s.gsub(/^@/, '')
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# Run a REST GET against the Beanie API.
|
99
|
-
def self.get(opts = {})
|
100
|
-
response = RestClient.get(build_url(opts), headers=set_headers)
|
101
|
-
JSON.parse(response.body)
|
102
|
-
end
|
103
|
-
|
104
|
-
#
|
105
|
-
# Run a REST PUT against the Beanie API.
|
106
|
-
def self.put(data, opts = {})
|
107
|
-
response = RestClient.put(build_url(opts), data, headers=set_headers)
|
108
|
-
if response.body and response.body.length > 0
|
109
|
-
JSON.parse(response.body)
|
110
|
-
else
|
111
|
-
""
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
#
|
116
|
-
# Run a REST POST against the Beanie API.
|
117
|
-
def self.post(data, opts = {})
|
118
|
-
response = RestClient.post(build_url(opts), data.to_json, headers=set_headers)
|
119
|
-
JSON.parse(response.body)
|
120
|
-
end
|
121
|
-
|
122
|
-
#
|
123
|
-
# Run a REST DELETE against the Beanie API.
|
124
|
-
def self.delete(data, opts = {})
|
125
|
-
response = RestClient.delete(build_url(opts), headers=set_headers)
|
126
|
-
JSON.parse(response.body)
|
127
|
-
end
|
128
|
-
|
129
|
-
#
|
130
|
-
#
|
131
|
-
def self.build_url(opts = {})
|
132
|
-
if opts[:url]
|
133
|
-
url = "#{Beanie.base_uri}#{opts[:url]}"
|
134
|
-
opts.delete(:url)
|
135
|
-
else
|
136
|
-
url = "#{Beanie.base_uri}/#{new.construct_path(opts)}"
|
137
|
-
end
|
138
|
-
if opts[:id]
|
139
|
-
url += "/#{opts[:id]}"
|
140
|
-
opts.delete(:id)
|
141
|
-
end
|
142
|
-
if opts[:extension]
|
143
|
-
url += "/#{opts[:extension]}"
|
144
|
-
opts.delete(:extension)
|
145
|
-
end
|
146
|
-
url += ".json"
|
147
|
-
optstr = ""
|
148
|
-
opts.each_key do |key|
|
149
|
-
optstr += (optstr.length == 0) ? "?" : "&"
|
150
|
-
optstr += "#{key.to_s}=#{opts[key]}"
|
151
|
-
end
|
152
|
-
url + optstr
|
153
|
-
end
|
154
|
-
|
155
|
-
#
|
156
|
-
# Set the default API headers.
|
157
|
-
def self.set_headers
|
158
|
-
#
|
159
|
-
# Make sure we have a token for this.
|
160
|
-
headers = {:content_type => :json, :accept => :json}
|
161
|
-
headers[:x_auth_token] = Beanie.get_token
|
162
|
-
headers
|
163
|
-
end
|
164
|
-
|
165
|
-
#
|
166
|
-
# Default mechanism for constructing a path
|
167
|
-
def construct_path(opts = {})
|
168
|
-
object_name.pluralize
|
169
|
-
end
|
170
|
-
|
171
|
-
#
|
172
|
-
# Compute a Beanie object name from the class name.
|
173
|
-
def object_name
|
174
|
-
object_name = self.class.name.
|
175
|
-
gsub(/.*::/, '').
|
176
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
177
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
178
|
-
tr("-", "_").
|
179
|
-
downcase
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
data/lib/beanie/bank_account.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2017-2018, AltoYield Limited. All rights reserved.
|
3
|
-
#
|
4
|
-
# This is free software; you can redistribute it and/or modify it
|
5
|
-
# under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; either version 2, or (at your option)
|
7
|
-
# any later version.
|
8
|
-
#
|
9
|
-
# It is distributed in the hope that it will be useful, but WITHOUT
|
10
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
11
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12
|
-
# for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License along
|
15
|
-
# with this product; see the file COPYING. If not, write to the Free
|
16
|
-
# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
17
|
-
#
|
18
|
-
# THIS SOFTWARE IS PROVIDED BY ALTOYIELD LIMITED "AS IS" AND ANY EXPRESS
|
19
|
-
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL ALTOYIELD LIMITED BE LIABLE FOR
|
22
|
-
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
24
|
-
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
25
|
-
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
26
|
-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
27
|
-
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
#
|
30
|
-
module Beanie
|
31
|
-
class BankAccount < Api
|
32
|
-
attr_accessor :id, :iban, :name, :swift, :nominal_account_id
|
33
|
-
|
34
|
-
#
|
35
|
-
# Initialize instance variables
|
36
|
-
def initialize
|
37
|
-
@id = nil
|
38
|
-
@iban = nil
|
39
|
-
@name = nil
|
40
|
-
@swift = nil
|
41
|
-
@nominal_account_id = nil
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|