Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elisa SOAP updates & additional documentation #145

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.22.1
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt', '3.1.15'

# Use Unicorn as the app server
# gem 'unicorn'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GEM
backburner (1.3.0)
beaneater (~> 1.0)
dante (> 0.1.5)
bcrypt (3.1.11)
bcrypt (3.1.15)
beaneater (1.0.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -237,7 +237,7 @@ PLATFORMS
DEPENDENCIES
angular-rails-templates
backburner
bcrypt (~> 3.1.7)
bcrypt (= 3.1.15)
bootstrap
byebug
codeclimate-test-reporter
Expand Down
38 changes: 9 additions & 29 deletions app/services/backend_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,38 +172,18 @@ def check_if_data_exists(data)
data
end

# Map only the necessary fields for Contacts model, comments after are the Elisa column #
def map_contacts_data(data)
data.map do |attrs|
{
ticket_id: attrs[:string][0],
arrived: with_utc_offset(attrs[:string][1]),
time_in_queue: attrs[:string][2],
forwarded_to_agent: with_utc_offset(attrs[:string][3]),
answered: with_utc_offset(attrs[:string][4]),
call_ended: with_utc_offset(attrs[:string][5]),
after_call_ended: with_utc_offset(attrs[:string][6]),
total_response_time: attrs[:string][7],
total_handle_time: attrs[:string][8],
service_name: attrs[:string][9],
direction: attrs[:string][10],
contact_type: attrs[:string][11],
contact_information: attrs[:string][12],
agent_name: attrs[:string][13],
customer_id: attrs[:string][14],
contact_reason: attrs[:string][15],
information: attrs[:string][16],
ivr_feedback: attrs[:string][17],
category_of_recording: attrs[:string][18],
recorded: attrs[:string][19],
inserted_to_db: with_utc_offset(attrs[:string][20]),
task_count: attrs[:string][21],
task_time: attrs[:string][22],
processing_total_sum: attrs[:string][23],
subject: attrs[:string][24],
outbound_campaign_name: attrs[:string][25],
outbound_campaign_id: attrs[:string][26],
additional_info: attrs[:string][27],
destination: attrs[:string][28]
ticket_id: attrs[:string][0], # 21100
arrived: with_utc_offset(attrs[:string][1]), # 21101
forwarded_to_agent: with_utc_offset(attrs[:string][5]), # 21103
answered: with_utc_offset(attrs[:string][6]), # 21102
call_ended: with_utc_offset(attrs[:string][7]), # 21104
after_call_ended: with_utc_offset(attrs[:string][8]), # 21105
direction: attrs[:string][15], # 21108
contact_type: attrs[:string][16], #21109
}
end
end
Expand Down
74 changes: 74 additions & 0 deletions docs/additional_documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Documentation

Additional documentation to support the `OCWEBGUI` documentation in helsinkifi wiki.

## Ruby 2.3.0 requirements

For newer Ubuntu versions, you might need libssl1.0-dev to compile Ruby 2.3.0

```
sudo apt update && apt-cache policy libssl1.0-dev
sudo apt-get install libssl1.0-dev
```

## Rbenv installation

Ruby-build needed and `rbenv rehash` is the key here.

```
rbenv install 2.3.0
rbenv global 2.3.0
rbenv rehash
```

**NB!** If error when installing that can't write shim, might help:
```
cd ~/.rbenv/shims/
mv .rbenv-shim .rbenv-shim-old.
rbenv rehash
rbenv install --list
rbenv global 2.3.0
which ruby
```

## If using NVM

```
nvm use (12)
npm install
```

## Installation history command for production

Best to run commands always with `bundle exec` prefix.

```
gem install bundler -v 1.12.5
bundle install
sudo apt-get install beanstalkd
sudo systemctl start beanstalkd.socket
sudo apt install ruby-god
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production OC_WEBGUI_PASSWORD=<password> bundle exec rake db:seed
RAILS_ENV=production bundle exec rake assets:precompile
```

`config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?`

Remember to set to `true`, if running locally a production environment and can't find assets, http 404, even though they are in public/assets

## Creating the admin user

Admin user login is needed so that the user interface looks pretty,
to create the first admin user as local production env run:
```
RAILS_ENV=production rails c
User.create(username: 'admin', password: 'admin', is_admin: true)
```

## Logging when god running

tail -f log/production.log
tail -f log/clockwork.log
tail -f log/backburner.log
53 changes: 53 additions & 0 deletions docs/soap_return
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
CURRENT RETURN ENDPOINT 26.10.2021
<GetContactsResponse xmlns="http://elisa.ccreport.fi/">
<GetContactsResult>
<ArrayOfString>
x<string>21100</string> ticket_id 0
x<string>21101</string> arrived 1
x<string>21102</string> time_in_queue 2
x<string>40026</string> PreparationTimeBeforeCall 3
x<string>21136</string> TimeInQueueServiceTime 4
x<string>21103</string> forwarded_to_agent 5
x<string>21120</string> answered 6
x<string>21104</string> call_ended 7
x<string>21105</string> after_call_ended 8
x<string>21106</string> total_response_time 9
x<string>40027</string> CallLength 10
x<string>20113</string> total_handle_time 11
x<string>40028</string> WrapupTime 12
x<string>21137</string> LengthAndConsultationCalls 13
x<string>21107</string> service_name 14
x<string>21108</string> direction 15
x<string>21109</string> contact_type 16
x<string>21110</string> contact_information 17
x<string>21111</string> agent_name 18
x<string>21221</string> OtherAgents 19
x<string>21112</string> customer_id 20
x<string>21113</string> contact_reason 21
x<string>21114</string> information 22
x<string>21115</string> ivr_feedback 23
x<string>21116</string> category_of_recording 24
x<string>21117</string> recorded 25
x<string>21126</string> inserted_to_db 26
x<string>20115</string> task_count 27
x<string>20116</string> TaskHandlingTime 28
x<string>20117</string> TotalHandlingTime 29
x<string>20126</string> TotalResponseTime 30
x<string>21119</string> Subject 31
x<string>21998</string> OutboundCampaignName 32
x<string>21999</string> OutboundCampaignId 33
x<string>21997</string> AdditionalInformation 34
x<string>21118</string> Destination 35
x<string>21127</string> ReturnCode
x<string>21128</string> OriginalServiceID
x<string>21129</string> ServiceID
x<string>21130</string> TransferHistory
x<string>21131</string> LengthAndConsultationCalls
x<string>AGENT_ID</string> AgentID
x<string>21135</string> AdditionalChannels
x<string>21138</string> CallReason
x<string>21139</string> CallType
</ArrayOfString>
</GetContactsResult>
</GetContactsResponse>

21 changes: 21 additions & 0 deletions docs/soap_spec_mock_return
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SPEC RETURN MOCK
<ArrayOfString>
<string>21100</string> ticket_id 0
<string>21101</string> arrived 1
<string>21102</string> time_in_queue 2
<string>21103</string> forwarded_to_agent 3
<string>21120</string> answered 4
<string>21104</string> call_ended 5
<string>21105</string> after_call_ended 6
<string>21106</string> total_response_time 7
<string>20113</string> total_handle_time 8
<string>21107</string> service_name 9
<string>21108</string> direction 10
<string>21109</string> contact_type 11
<string>21110</string> contact_information 12
<string>21111</string> agent_name 13
<string>21112</string> customer_id 14
<string>21113</string> contact_reason 15
<string>21114</string> information 16
<string>21115</string> ivr_feedback 17
</ArrayOfString>
14 changes: 13 additions & 1 deletion spec/fixtures/backend_service/get_agent_contacts_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,49 @@
<string>21100</string>
<string>21101</string>
<string>21102</string>
<string>40026</string>
<string>21136</string>
<string>21103</string>
<string>21120</string>
<string>21104</string>
<string>21105</string>
<string>21106</string>
<string>40027</string>
<string>20113</string>
<string>40028</string>
<string>21137</string>
<string>21107</string>
<string>21108</string>
<string>21109</string>
<string>21110</string>
<string>21111</string>
<string>21221</string>
<string>21112</string>
<string>21113</string>
<string>21114</string>
<string>21115</string>
</ArrayOfString>
</ArrayOfString>
<ArrayOfString>
<string>20160614091049336435</string>
<string>14.6.2016 9:11:43</string>
<string>1</string>
<string>nil</string>
<string>nil</string>
<string>14.6.2016 9:11:44</string>
<string>14.6.2016 9:11:57</string>
<string>14.6.2016 9:13:59</string>
<string>14.6.2016 9:21:41</string>
<string>598</string>
<string>nil</string>
<string>597</string>
<string>nil</string>
<string>nil</string>
<string>Neuvonta Fin</string>
<string>I</string>
<string>PBX</string>
<string>0405882759</string>
<string>Seppänen Pekka</string>
<string>nil</string>
<string>-1</string>
<string>Onnistunut kontakti</string>
<string>nil</string>
Expand Down
23 changes: 1 addition & 22 deletions spec/services/backend_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,12 @@ def with_utc_offset(timestamp)
expected = [
{:ticket_id=>"20160614091049336435",
:arrived=>with_utc_offset("14.6.2016 9:11:43"),
:time_in_queue=>"1",
:forwarded_to_agent=>with_utc_offset("14.6.2016 9:11:44"),
:answered=>with_utc_offset("14.6.2016 9:11:57"),
:call_ended=>with_utc_offset("14.6.2016 9:13:59"),
:after_call_ended=>with_utc_offset("14.6.2016 9:21:41"),
:total_response_time=>"598",
:total_handle_time=>"597",
:service_name=>"Neuvonta Fin",
:direction=>"I",
:contact_type=>"PBX",
:contact_information=>"0405882759",
:agent_name=>"Seppänen Pekka",
:customer_id=>"-1",
:contact_reason=>"Onnistunut kontakti",
:information=>"nil",
:ivr_feedback=>"-1",
:category_of_recording=>nil,
:recorded=>nil,
:inserted_to_db=>nil,
:task_count=>nil,
:task_time=>nil,
:processing_total_sum=>nil,
:subject=>nil,
:outbound_campaign_name=>nil,
:outbound_campaign_id=>nil,
:additional_info=>nil,
:destination=>nil}
:contact_type=>"PBX"}
]

savon.expects(:get_contacts).with(message: message).returns(fixture)
Expand Down