osc_ruby 0.7.1 → 1.0.2

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +25 -25
  3. data/.gitignore +15 -15
  4. data/.rspec +1 -1
  5. data/.rubocop.yml +1156 -1156
  6. data/.travis.yml +9 -9
  7. data/Gemfile +3 -3
  8. data/License.txt +21 -0
  9. data/README.md +95 -242
  10. data/Rakefile +2 -2
  11. data/lib/ext/string.rb +18 -18
  12. data/lib/osc_ruby/classes/query_results.rb +40 -60
  13. data/lib/osc_ruby/client.rb +40 -40
  14. data/lib/osc_ruby/configuration.rb +14 -13
  15. data/lib/osc_ruby/connect.rb +218 -209
  16. data/lib/osc_ruby/modules/normalize_module.rb +121 -121
  17. data/lib/osc_ruby/modules/query_module.rb +69 -69
  18. data/lib/osc_ruby/modules/validations_module.rb +168 -168
  19. data/lib/osc_ruby/version.rb +2 -2
  20. data/lib/osc_ruby.rb +4 -10
  21. data/osc_ruby.gemspec +28 -29
  22. data/spec/core/client_spec.rb +96 -96
  23. data/spec/core/configuration_spec.rb +4 -4
  24. data/spec/core/connect_spec.rb +366 -364
  25. data/spec/core/query_results_spec.rb +107 -133
  26. data/spec/core/spec_helper.rb +25 -25
  27. data/tasks/rspec.rake +2 -2
  28. metadata +23 -22
  29. data/LICENSE.txt +0 -22
  30. data/lib/osc_ruby/classes/account.rb +0 -75
  31. data/lib/osc_ruby/classes/answer.rb +0 -117
  32. data/lib/osc_ruby/classes/incident.rb +0 -13
  33. data/lib/osc_ruby/classes/product_category_shared.rb +0 -118
  34. data/lib/osc_ruby/classes/service_category.rb +0 -6
  35. data/lib/osc_ruby/classes/service_class.rb +0 -66
  36. data/lib/osc_ruby/classes/service_product.rb +0 -6
  37. data/lib/osc_ruby/modules/class_factory_module.rb +0 -165
  38. data/lib/osc_ruby/modules/nested_resource_module.rb +0 -10
  39. data/spec/core/account_spec.rb +0 -497
  40. data/spec/core/answer_spec.rb +0 -545
  41. data/spec/core/service_category_spec.rb +0 -445
  42. data/spec/core/service_product_spec.rb +0 -443
@@ -1,134 +1,108 @@
1
- require 'core/spec_helper'
2
- require 'json'
3
- require 'uri'
4
-
5
- describe OSCRuby::QueryResults do
6
-
7
- let(:client) {
8
-
9
- OSCRuby::Client.new do |config|
10
-
11
- config.interface = ENV['OSC_TEST1_SITE']
12
-
13
- config.username = ENV['OSC_ADMIN']
14
-
15
- config.password = ENV['OSC_PASSWORD']
16
-
17
- end
18
- }
19
-
20
- let(:query_results){
21
- OSCRuby::QueryResults.new
22
- }
23
-
24
-
25
-
26
- let(:table){ "answers" }
27
- let(:nested_attributes){
28
- [ "*",
29
- "accessLevels.namedIDList.*",
30
- "answerType.*",
31
- "assignedTo.account.*",
32
- "assignedTo.staffGroup.*",
33
- "banner.*",
34
- "banner.importanceFlag.*",
35
- "banner.updatedByAccount.*",
36
- "categories.categoriesList.*",
37
- "commonAttachments.fileAttachmentList.*",
38
- "commonAttachments.fileAttachmentList.names.labelList.labelText",
39
- "commonAttachments.fileAttachmentList.names.labelList.language.*",
40
- "fileAttachments.fileAttachmentList.*",
41
- "guidedAssistance.*",
42
- "language.*",
43
- "notes.noteList.*",
44
- "positionInList.*",
45
- "products.productsList.*",
46
- "relatedAnswers.answerRelatedAnswerList.*",
47
- "relatedAnswers.answerRelatedAnswerList.toAnswer.*",
48
- "siblingAnswers.*",
49
- "statusWithType.statusType.*",
50
- "updatedByAccount.*",
51
- "customFields.c.*"
52
- ]
53
- }
54
-
55
-
56
- context "#query" do
57
-
58
- it 'should expect client is an instance of OSCRuby::Client class and raise an error if does not' do
59
-
60
- expect(client).to be_an(OSCRuby::Client)
61
-
62
- client = nil
63
-
64
- expect{query_results.query(client,'describe')}.to raise_error('Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings')
65
-
66
- end
67
-
68
- it 'should expect a query' do
69
-
70
- expect(client).to be_an(OSCRuby::Client)
71
-
72
- expect{query_results.query(client,"")}.to raise_error("A query must be specified when using the 'query' method")
73
-
74
- end
75
-
76
- it 'should put results in array of hashes',:vcr do
77
-
78
- # expect(query_results.query(client,"describe")).not_to eq(nil)
79
-
80
- expect(query_results.query(client,"describe")).to be_an(Array)
81
-
82
- # expect(query_results.query(client,"describe answers")).not_to eq(nil)
83
-
84
- expect(query_results.query(client,"describe answers;describe serviceproducts",true)).to be_an(Array)
85
-
86
- # expect(query_results.query(client,"describe answers;describe servicecategories")).not_to eq(nil)
87
-
88
- expect(query_results.query(client,"describe answers;describe servicecategories")).to be_an(Array)
89
-
90
- end
91
-
92
- it 'should be able to manipulate and assign results data',:vcr do
93
-
94
- @answers = query_results.query(client,"select * from answers where ID > 2500")
95
-
96
- @answers.each do |answer|
97
-
98
- expect(answer['id'].to_i).to be_a(Integer)
99
-
100
- expect(answer['answerType']).not_to be(nil)
101
-
102
- expect(answer['answerType']).not_to eq("\n")
103
-
104
- expect{@answer = OSCRuby::Answer.new(answer)}.not_to raise_error
105
-
106
- end
107
-
108
- end
109
-
110
- context "#nested_query" do
111
-
112
- it 'should take nested queries and return multiple objects',:vcr do
113
-
114
- query = nested_attributes.map{|q| "select #{table}.#{q} from #{table} where ID = 2222" }.join("; ")
115
-
116
-
117
- expect do
118
-
119
- results = query_results.nested_query(client,query,true)
120
- expect(results.length).to eq(nested_attributes.length)
121
-
122
- puts "Results : #{results.length} | Queries: #{nested_attributes.length}"
123
-
124
- end.not_to raise_error
125
-
126
-
127
-
128
- end
129
-
130
- end
131
-
132
- end
133
-
1
+ require 'core/spec_helper'
2
+ require 'json'
3
+ require 'uri'
4
+
5
+ describe OSCRuby::QueryResults do
6
+
7
+ let(:client) {
8
+
9
+ OSCRuby::Client.new do |config|
10
+
11
+ config.interface = ENV['OSC_SITE']
12
+
13
+ config.username = ENV['OSC_ADMIN']
14
+
15
+ config.password = ENV['OSC_PASSWORD']
16
+
17
+ config.demo_site = true
18
+
19
+ end
20
+ }
21
+
22
+ let(:query_results){
23
+ OSCRuby::QueryResults.new
24
+ }
25
+
26
+
27
+
28
+ let(:table){ "answers" }
29
+ let(:nested_attributes){
30
+ [ "*",
31
+ "accessLevels.namedIDList.*",
32
+ "answerType.*",
33
+ "assignedTo.account.*",
34
+ "assignedTo.staffGroup.*",
35
+ "banner.*",
36
+ "banner.importanceFlag.*",
37
+ "banner.updatedByAccount.*",
38
+ "categories.categoriesList.*",
39
+ "commonAttachments.fileAttachmentList.*",
40
+ "commonAttachments.fileAttachmentList.names.labelList.labelText",
41
+ "commonAttachments.fileAttachmentList.names.labelList.language.*",
42
+ "fileAttachments.fileAttachmentList.*",
43
+ "guidedAssistance.*",
44
+ "language.*",
45
+ "notes.noteList.*",
46
+ "positionInList.*",
47
+ "products.productsList.*",
48
+ "relatedAnswers.answerRelatedAnswerList.*",
49
+ "relatedAnswers.answerRelatedAnswerList.toAnswer.*",
50
+ "siblingAnswers.*",
51
+ "statusWithType.statusType.*",
52
+ "updatedByAccount.*",
53
+ "customFields.c.*"
54
+ ]
55
+ }
56
+
57
+
58
+ context "#query" do
59
+
60
+ it 'should expect client is an instance of OSCRuby::Client class and raise an error if does not' do
61
+
62
+ expect(client).to be_an(OSCRuby::Client)
63
+
64
+ client = nil
65
+
66
+ expect{query_results.query(client,'describe')}.to raise_error('Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings')
67
+
68
+ end
69
+
70
+ it 'should expect a query' do
71
+
72
+ expect(client).to be_an(OSCRuby::Client)
73
+
74
+ expect{query_results.query(client,"")}.to raise_error("A query must be specified when using the 'query' method")
75
+
76
+ end
77
+
78
+ it 'should put results in array of hashes',:vcr do
79
+
80
+ # expect(query_results.query(client,"describe")).not_to eq(nil)
81
+
82
+ expect(query_results.query(client,"describe")).to be_an(Array)
83
+
84
+ # expect(query_results.query(client,"describe answers")).not_to eq(nil)
85
+
86
+ expect(query_results.query(client,"describe answers;describe serviceproducts",true)).to be_an(Array)
87
+
88
+ # expect(query_results.query(client,"describe answers;describe servicecategories")).not_to eq(nil)
89
+
90
+ expect(query_results.query(client,"describe answers;describe servicecategories")).to be_an(Array)
91
+
92
+ end
93
+
94
+ it 'should be able to manipulate and assign results data',:vcr do
95
+
96
+ @incidents = query_results.query(client,"select * from incidents where ID > 2500 LIMIT 10")
97
+
98
+ @incidents.each do |incident|
99
+
100
+ expect(incident['id'].to_i).to be_a(Integer)
101
+
102
+ end
103
+
104
+ end
105
+
106
+ end
107
+
134
108
  end
@@ -1,26 +1,26 @@
1
- require 'osc_ruby'
2
- require 'simplecov'
3
- require 'vcr'
4
- require 'json'
5
-
6
- VCR.configure do |c|
7
- c.cassette_library_dir = "spec/fixtures"
8
- c.hook_into :fakeweb
9
- c.allow_http_connections_when_no_cassette = true
10
- c.filter_sensitive_data('<OSC_ADMIN_USERNAME>') { ENV['OSC_ADMIN'] }
11
- c.filter_sensitive_data('<OSC_ADMIN_PASSWORD>') { ENV['OSC_PASSWORD'] }
12
- c.filter_sensitive_data('<TEST_INTERFACE>') { ENV['OSC_TEST1_SITE'] }
13
- c.filter_sensitive_data('<BASIC_AUTH>') { ENV['OSC_BASIC_64'] }
14
- end
15
-
16
- RSpec.configure do |c|
17
- c.around(:each, :vcr) do |example|
18
- class_name = example.metadata[:described_class].to_s.gsub(/OSCRuby::/,'').downcase
19
- method_name = example.metadata[:example_group][:description_args][0].gsub(/#/,'')
20
- test_name = example.metadata[:description].gsub(/ /,'_').downcase
21
- name = [class_name,method_name,test_name].join('/')[0...95]
22
- VCR.use_cassette(name) { example.call }
23
- end
24
- end
25
-
1
+ require 'osc_ruby'
2
+ require 'simplecov'
3
+ require 'vcr'
4
+ require 'json'
5
+
6
+ VCR.configure do |c|
7
+ c.cassette_library_dir = "spec/fixtures"
8
+ c.hook_into :fakeweb
9
+ c.allow_http_connections_when_no_cassette = true
10
+ c.filter_sensitive_data('<OSC_ADMIN_USERNAME>') { ENV['OSC_ADMIN'] }
11
+ c.filter_sensitive_data('<OSC_ADMIN_PASSWORD>') { ENV['OSC_PASSWORD'] }
12
+ c.filter_sensitive_data('<TEST_INTERFACE>') { ENV['OSC_TEST1_SITE'] }
13
+ c.filter_sensitive_data('<BASIC_AUTH>') { ENV['OSC_BASIC_64'] }
14
+ end
15
+
16
+ RSpec.configure do |c|
17
+ c.around(:each, :vcr) do |example|
18
+ class_name = example.metadata[:described_class].to_s.gsub(/OSCRuby::/,'').downcase
19
+ method_name = example.metadata[:example_group][:description_args][0].gsub(/#/,'')
20
+ test_name = example.metadata[:description].gsub(/ /,'_').downcase
21
+ name = [class_name,method_name,test_name].join('/')[0...95]
22
+ VCR.use_cassette(name) { example.call }
23
+ end
24
+ end
25
+
26
26
  SimpleCov.start
data/tasks/rspec.rake CHANGED
@@ -1,3 +1,3 @@
1
- require 'rspec/core/rake_task'
2
-
1
+ require 'rspec/core/rake_task'
2
+
3
3
  RSpec::Core::RakeTask.new(:spec)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osc_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Davis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -29,6 +29,9 @@ dependencies:
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ - - ">="
32
35
  - !ruby/object:Gem::Version
33
36
  version: 1.0.0
34
37
  type: :development
@@ -36,6 +39,9 @@ dependencies:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: 1.0.0
41
47
  - !ruby/object:Gem::Dependency
@@ -71,6 +77,9 @@ dependencies:
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.2'
82
+ - - ">="
74
83
  - !ruby/object:Gem::Version
75
84
  version: 3.2.0
76
85
  type: :development
@@ -78,6 +87,9 @@ dependencies:
78
87
  version_requirements: !ruby/object:Gem::Requirement
79
88
  requirements:
80
89
  - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '3.2'
92
+ - - ">="
81
93
  - !ruby/object:Gem::Version
82
94
  version: 3.2.0
83
95
  - !ruby/object:Gem::Dependency
@@ -85,6 +97,9 @@ dependencies:
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
99
  - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ - - ">="
88
103
  - !ruby/object:Gem::Version
89
104
  version: 3.0.3
90
105
  type: :development
@@ -92,6 +107,9 @@ dependencies:
92
107
  version_requirements: !ruby/object:Gem::Requirement
93
108
  requirements:
94
109
  - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.0'
112
+ - - ">="
95
113
  - !ruby/object:Gem::Version
96
114
  version: 3.0.3
97
115
  - !ruby/object:Gem::Dependency
@@ -115,7 +133,7 @@ dependencies:
115
133
  - - ">="
116
134
  - !ruby/object:Gem::Version
117
135
  version: '0'
118
- type: :runtime
136
+ type: :development
119
137
  prerelease: false
120
138
  version_requirements: !ruby/object:Gem::Requirement
121
139
  requirements:
@@ -136,37 +154,24 @@ files:
136
154
  - ".rubocop.yml"
137
155
  - ".travis.yml"
138
156
  - Gemfile
139
- - LICENSE.txt
157
+ - License.txt
140
158
  - README.md
141
159
  - Rakefile
142
160
  - lib/ext/string.rb
143
161
  - lib/osc_ruby.rb
144
- - lib/osc_ruby/classes/account.rb
145
- - lib/osc_ruby/classes/answer.rb
146
- - lib/osc_ruby/classes/incident.rb
147
- - lib/osc_ruby/classes/product_category_shared.rb
148
162
  - lib/osc_ruby/classes/query_results.rb
149
- - lib/osc_ruby/classes/service_category.rb
150
- - lib/osc_ruby/classes/service_class.rb
151
- - lib/osc_ruby/classes/service_product.rb
152
163
  - lib/osc_ruby/client.rb
153
164
  - lib/osc_ruby/configuration.rb
154
165
  - lib/osc_ruby/connect.rb
155
- - lib/osc_ruby/modules/class_factory_module.rb
156
- - lib/osc_ruby/modules/nested_resource_module.rb
157
166
  - lib/osc_ruby/modules/normalize_module.rb
158
167
  - lib/osc_ruby/modules/query_module.rb
159
168
  - lib/osc_ruby/modules/validations_module.rb
160
169
  - lib/osc_ruby/version.rb
161
170
  - osc_ruby.gemspec
162
- - spec/core/account_spec.rb
163
- - spec/core/answer_spec.rb
164
171
  - spec/core/client_spec.rb
165
172
  - spec/core/configuration_spec.rb
166
173
  - spec/core/connect_spec.rb
167
174
  - spec/core/query_results_spec.rb
168
- - spec/core/service_category_spec.rb
169
- - spec/core/service_product_spec.rb
170
175
  - spec/core/spec_helper.rb
171
176
  - tasks/rspec.rake
172
177
  homepage: https://github.com/rajangdavis/osc_ruby
@@ -189,17 +194,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
194
  version: '0'
190
195
  requirements: []
191
196
  rubyforge_project:
192
- rubygems_version: 2.6.8
197
+ rubygems_version: 2.6.12
193
198
  signing_key:
194
199
  specification_version: 4
195
200
  summary: Making the best of opensource and enterprise technology
196
201
  test_files:
197
- - spec/core/account_spec.rb
198
- - spec/core/answer_spec.rb
199
202
  - spec/core/client_spec.rb
200
203
  - spec/core/configuration_spec.rb
201
204
  - spec/core/connect_spec.rb
202
205
  - spec/core/query_results_spec.rb
203
- - spec/core/service_category_spec.rb
204
- - spec/core/service_product_spec.rb
205
206
  - spec/core/spec_helper.rb
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2016 rajangdavis
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.
@@ -1,75 +0,0 @@
1
- module OSCRuby
2
-
3
- class Account < ServiceClass
4
-
5
- attr_accessor :displayName,:login,:name,:nameFurigana,:attributes,:profile,:name,:staffGroup,:newPassword,:country,:emails
6
-
7
- def initialize(attributes = nil)
8
-
9
- @displayName = 'Display Name'
10
- @login = 'Login'
11
- @name = {}
12
- @nameFurigana = {}
13
- @attributes = {}
14
- @profile = {}
15
- @name = {}
16
- @staffGroup = {}
17
- @newPassword = 'default_password'
18
- @country = {}
19
- @emails = []
20
-
21
- end
22
-
23
- # Convenience Methods for making the CRUD operations nicer to use
24
-
25
- def set_attributes(response_body)
26
-
27
- self.id = response_body["id"]
28
-
29
- self.name = response_body["lookupName"]
30
-
31
- self.lookupName = response_body["lookupName"]
32
-
33
- self.displayOrder = response_body["displayOrder"]
34
-
35
- end
36
-
37
- def update_attributes(updated_product)
38
-
39
- self.lookupName = updated_product.lookupName
40
-
41
- self.createdTime = updated_product.createdTime
42
-
43
- self.updatedTime = updated_product.updatedTime
44
-
45
- self.name = updated_product.name
46
-
47
- self.parent = updated_product.parent
48
-
49
- end
50
-
51
- def self.check_self(obj,is_update = false)
52
-
53
- class_name = self.to_s.split('::')[1]
54
-
55
- obj_attrs = ValidationsModule::extract_attributes(obj)
56
-
57
- # if is_update == true
58
-
59
- # obj_attrs = remove_unused_new_attrs(obj_attrs)
60
-
61
- # else
62
-
63
- # obj_attrs = ValidationsModule::check_for_names(obj_attrs,class_name)
64
-
65
- # obj_attrs = ValidationsModule::check_for_parents(obj_attrs)
66
-
67
- # end
68
-
69
- obj_attrs
70
-
71
- end
72
-
73
- end
74
-
75
- end
@@ -1,117 +0,0 @@
1
- require 'osc_ruby/modules/nested_resource_module'
2
-
3
- module OSCRuby
4
-
5
- class Answer < ServiceClass
6
- include NestedResourceModule
7
-
8
- attr_accessor :answerType, :language, :summary, :id, :lookupName, :createdTime, :updatedTime, :accessLevels, :name, :adminLastAccessTime, :expiresDate, :guidedAssistance, :keywords, :lastAccessTime, :lastNotificationTime, :nextNotificationTime, :originalReferenceNumber, :positionInList,
9
- :publishOnDate, :question, :solution, :updatedByAccount, :uRL, :categories
10
-
11
- def initialize(attributes = nil)
12
-
13
- if attributes.nil?
14
-
15
- @answerType = {}
16
- @accessLevels = []
17
- @summary = "Answer summary text"
18
- @language = {}
19
- @question = nil
20
- @categories = []
21
- @id = 0
22
-
23
- else
24
-
25
- @id = attributes["id"]
26
- @lookupName = attributes["lookupName"]
27
- @createdTime = attributes["createdTime"]
28
- @updatedTime = attributes["updatedTime"]
29
- @accessLevels = attributes["accessLevels"]
30
- @name = attributes["name"]
31
- @adminLastAccessTime = attributes["adminLastAccessTime"]
32
- @answerType = attributes["answerType"]
33
- @expiresDate = attributes["expiresDate"]
34
- @guidedAssistance = attributes["guidedAssistance"]
35
- @keywords = attributes["keywords"]
36
- @language = attributes["language"]
37
- @lastAccessTime = attributes["lastAccessTime"]
38
- @lastNotificationTime = attributes["lastNotificationTime"]
39
- @nextNotificationTime = attributes["nextNotificationTime"]
40
- @originalReferenceNumber = attributes["originalReferenceNumber"]
41
- @positionInList = attributes["positionInList"]
42
- @publishOnDate = attributes["publishOnDate"]
43
- @question = attributes["question"]
44
- @solution = attributes["solution"]
45
- @summary = attributes["summary"]
46
- @updatedByAccount = attributes["updatedByAccount"]
47
- @uRL = attributes["uRL"]
48
-
49
- end
50
-
51
- end
52
-
53
-
54
- # Convenience Methods for making the CRUD operations nicer to use
55
-
56
- def self.set_attributes(response_body)
57
- id = response_body['id'].to_i
58
- lookupName = response_body['lookupName'].to_i
59
- createdTime = response_body['createdTime']
60
- updatedTime = response_body['updatedTime']
61
- accessLevels = response_body['accessLevels']
62
- adminLastAccessTime = response_body['adminLastAccessTime']
63
- answerType = response_body['answerType']
64
- expiresDate = response_body['expiresDate']
65
- guidedAssistance = response_body['guidedAssistance']
66
- keywords = response_body['keywords']
67
- language = response_body['language']
68
- lastAccessTime = response_body['lastAccessTime']
69
- lastNotificationTime = response_body['lastNotificationTime']
70
- name = response_body['name'].to_i
71
- nextNotificationTime = response_body['nextNotificationTime']
72
- originalReferenceNumber = response_body['originalReferenceNumber']
73
- positionInList = response_body['positionInList']
74
- publishOnDate = response_body['publishOnDate']
75
- question = response_body['question']
76
- solution = response_body['solution']
77
- summary = response_body['summary']
78
- updatedByAccount = response_body['updatedByAccount']
79
- uRL = response_body['uRL']
80
- end
81
-
82
- def self.check_self(obj,is_update = false)
83
-
84
- obj_attrs = ValidationsModule::extract_attributes(obj)
85
-
86
- if is_update == false
87
-
88
- obj_attrs = check_for_language_and_type(obj_attrs)
89
-
90
- end
91
-
92
- obj_attrs
93
-
94
- end
95
-
96
- def self.check_for_language_and_type(obj_attrs)
97
-
98
- if ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'language','id',Fixnum)
99
-
100
- raise ArgumentError, 'Answer should at least the language, answerType, and summary set (new_answer.language = {"id" => 1}; new_answer.answerType = {"id" => 1}}; new_answer.summary = "This is the Answer Title")'
101
-
102
- end
103
-
104
- if ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'answerType','id',Fixnum) &&
105
- ValidationsModule::attr_hash_exists_and_is_type_of(obj_attrs,'answerType','lookupName',String)
106
-
107
- raise ArgumentError, 'Answer should at least the language, answerType, and summary set (new_answer.language = {"id" => 1}; new_answer.answerType = {"id" => 1}}; new_answer.summary = "This is the Answer Title")'
108
-
109
- end
110
-
111
- obj_attrs
112
-
113
- end
114
-
115
- end
116
-
117
- end
@@ -1,13 +0,0 @@
1
- require 'osc_ruby/modules/nested_resource_module'
2
-
3
- module OSCRuby
4
-
5
- class Incident < ServiceClass
6
-
7
- # TODO BUILD CLASS
8
-
9
-
10
-
11
- end
12
-
13
- end