dear-inventory-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DearInventoryRuby::CustomerApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'CustomerApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = DearInventoryRuby::CustomerApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of CustomerApi' do
30
+ it 'should create an instance of CustomerApi' do
31
+ expect(@api_instance).to be_instance_of(DearInventoryRuby::CustomerApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_customers
36
+ # Allows you to retrieve the customers
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :page Default is 1
39
+ # @option opts [String] :limit Default is 100
40
+ # @option opts [String] :id Default is null
41
+ # @option opts [String] :name Default is null
42
+ # @option opts [String] :modified_since Default is null
43
+ # @option opts [String] :include_deprecated Default is false
44
+ # @return [Customers]
45
+ describe 'get_customers test' do
46
+ it 'should work' do
47
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
48
+ end
49
+ end
50
+
51
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe DearInventoryRuby::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ DearInventoryRuby.configure { |c| c.host = 'http://example.com' }
21
+ expect(DearInventoryRuby::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ DearInventoryRuby.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(DearInventoryRuby::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ DearInventoryRuby.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(DearInventoryRuby::Configuration.default.host).to eq('hobo.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ DearInventoryRuby.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(DearInventoryRuby::Configuration.default.base_path).to eq('/v4/dog')
39
+ end
40
+
41
+ it "doesn't prepend a slash if one is already there" do
42
+ DearInventoryRuby.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(DearInventoryRuby::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ DearInventoryRuby.configure { |c| c.base_path = nil }
48
+ expect(DearInventoryRuby::Configuration.default.base_path).to eq('')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ describe '#deserialize' do
55
+ it "handles Array<Integer>" do
56
+ api_client = DearInventoryRuby::ApiClient.new
57
+ headers = { 'Content-Type' => 'application/json' }
58
+ response = double('response', headers: headers, body: '[12, 34]')
59
+ data = api_client.deserialize(response, 'Array<Integer>')
60
+ expect(data).to be_instance_of(Array)
61
+ expect(data).to eq([12, 34])
62
+ end
63
+
64
+ it 'handles Array<Array<Integer>>' do
65
+ api_client = DearInventoryRuby::ApiClient.new
66
+ headers = { 'Content-Type' => 'application/json' }
67
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
68
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
69
+ expect(data).to be_instance_of(Array)
70
+ expect(data).to eq([[12, 34], [56]])
71
+ end
72
+
73
+ it 'handles Hash<String, String>' do
74
+ api_client = DearInventoryRuby::ApiClient.new
75
+ headers = { 'Content-Type' => 'application/json' }
76
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
77
+ data = api_client.deserialize(response, 'Hash<String, String>')
78
+ expect(data).to be_instance_of(Hash)
79
+ expect(data).to eq(:message => 'Hello')
80
+ end
81
+ end
82
+
83
+ describe "#object_to_hash" do
84
+ it 'ignores nils and includes empty arrays' do
85
+ # uncomment below to test object_to_hash for model
86
+ # api_client = DearInventoryRuby::ApiClient.new
87
+ # _model = DearInventoryRuby::ModelName.new
88
+ # update the model attribute below
89
+ # _model.id = 1
90
+ # update the expected value (hash) below
91
+ # expected = {id: 1, name: '', tags: []}
92
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
93
+ end
94
+ end
95
+
96
+ describe '#build_collection_param' do
97
+ let(:param) { ['aa', 'bb', 'cc'] }
98
+ let(:api_client) { DearInventoryRuby::ApiClient.new }
99
+
100
+ it 'works for csv' do
101
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
102
+ end
103
+
104
+ it 'works for ssv' do
105
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
106
+ end
107
+
108
+ it 'works for tsv' do
109
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
110
+ end
111
+
112
+ it 'works for pipes' do
113
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
114
+ end
115
+
116
+ it 'works for multi' do
117
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
118
+ end
119
+
120
+ it 'fails for invalid collection format' do
121
+ expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
122
+ end
123
+ end
124
+
125
+ describe '#json_mime?' do
126
+ let(:api_client) { DearInventoryRuby::ApiClient.new }
127
+
128
+ it 'works' do
129
+ expect(api_client.json_mime?(nil)).to eq false
130
+ expect(api_client.json_mime?('')).to eq false
131
+
132
+ expect(api_client.json_mime?('application/json')).to eq true
133
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
134
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
135
+
136
+ expect(api_client.json_mime?('application/xml')).to eq false
137
+ expect(api_client.json_mime?('text/plain')).to eq false
138
+ expect(api_client.json_mime?('application/jsonp')).to eq false
139
+ end
140
+ end
141
+
142
+ describe '#select_header_accept' do
143
+ let(:api_client) { DearInventoryRuby::ApiClient.new }
144
+
145
+ it 'works' do
146
+ expect(api_client.select_header_accept(nil)).to be_nil
147
+ expect(api_client.select_header_accept([])).to be_nil
148
+
149
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
150
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
151
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
152
+
153
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
154
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
155
+ end
156
+ end
157
+
158
+ describe '#select_header_content_type' do
159
+ let(:api_client) { DearInventoryRuby::ApiClient.new }
160
+
161
+ it 'works' do
162
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
163
+ expect(api_client.select_header_content_type([])).to eq('application/json')
164
+
165
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
166
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
167
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
168
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
169
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
170
+ end
171
+ end
172
+
173
+ describe '#sanitize_filename' do
174
+ let(:api_client) { DearInventoryRuby::ApiClient.new }
175
+
176
+ it 'works' do
177
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
178
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
179
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
180
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
181
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
182
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
183
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
184
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
185
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe DearInventoryRuby::Configuration do
16
+ let(:config) { DearInventoryRuby::Configuration.default }
17
+
18
+ before(:each) do
19
+ # uncomment below to setup host and base_path
20
+ # require 'URI'
21
+ # uri = URI.parse("https://inventory.dearsystems.com/ExternalApi/v2")
22
+ # DearInventoryRuby.configure do |c|
23
+ # c.host = uri.host
24
+ # c.base_path = uri.path
25
+ # end
26
+ end
27
+
28
+ describe '#base_url' do
29
+ it 'should have the default value' do
30
+ # uncomment below to test default value of the base path
31
+ # expect(config.base_url).to eq("https://inventory.dearsystems.com/ExternalApi/v2")
32
+ end
33
+
34
+ it 'should remove trailing slashes' do
35
+ [nil, '', '/', '//'].each do |base_path|
36
+ config.base_path = base_path
37
+ # uncomment below to test trailing slashes
38
+ # expect(config.base_url).to eq("https://inventory.dearsystems.com/ExternalApi/v2")
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,93 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DearInventoryRuby::Address
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'Address' do
21
+ before do
22
+ # run before each test
23
+ @instance = DearInventoryRuby::Address.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of Address' do
31
+ it 'should create an instance of Address' do
32
+ expect(@instance).to be_instance_of(DearInventoryRuby::Address)
33
+ end
34
+ end
35
+ describe 'test attribute "id"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "line1"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "line2"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "city"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "state"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "post_code"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "country"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "type"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["Billing", "Business", "Shipping"])
81
+ # validator.allowable_values.each do |value|
82
+ # expect { @instance.type = value }.not_to raise_error
83
+ # end
84
+ end
85
+ end
86
+
87
+ describe 'test attribute "default_for_type"' do
88
+ it 'should work' do
89
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
90
+ end
91
+ end
92
+
93
+ end
@@ -0,0 +1,89 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for DearInventoryRuby::Contact
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'Contact' do
21
+ before do
22
+ # run before each test
23
+ @instance = DearInventoryRuby::Contact.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of Contact' do
31
+ it 'should create an instance of Contact' do
32
+ expect(@instance).to be_instance_of(DearInventoryRuby::Contact)
33
+ end
34
+ end
35
+ describe 'test attribute "id"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "name"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "phone"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "fax"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "email"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "website"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "comment"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "default"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
83
+ describe 'test attribute "include_in_email"' do
84
+ it 'should work' do
85
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
86
+ end
87
+ end
88
+
89
+ end