imperituroard 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80e97d149199ca8d19d1f44fd7efa93c83fb3735
4
- data.tar.gz: c3fb37c6327ba5f80409e8a1de60eacef665b16d
3
+ metadata.gz: 77b3e174ab86faf541db078e594c9a5910a3ccb1
4
+ data.tar.gz: ba7fa9723abb400f77b7ae99b43313514fc72e62
5
5
  SHA512:
6
- metadata.gz: 76330a50f5c3e066b16374ce5ec656c855bb6988987d608f3d42ff0cbf1e7677562c071ca4ccf3b693affa51d517710f874d0dadac3d9f93e7f4a6212d96ea17
7
- data.tar.gz: 8f71b08f56d0cc2134048be60d81eb42f73d5f6fc8e2a5b909d876cf398be587f774407603b0beb77fc1c6951037734211482da73a3740c7ae5b2881c94c5f7a
6
+ metadata.gz: 60e8fe64d72851a8a09ba3fd74a5a8917587e09fb03cf427289aa543237f5c9e7e8e6162c6f405ea93220d48044d40b619fbaa6d1f73c46c337c5cdb39757863
7
+ data.tar.gz: 9939203fac5d5fc902a9c1abf361a02d3bccb883d3442bf7117d1d3198d6b21fd7d6eeba532b0c01df3803d576c2790bf849b63fe9f580a2911bbe457b41e11b
@@ -46,31 +46,81 @@ class InternalFunc
46
46
 
47
47
  def if_digit_or_string(data)
48
48
 
49
+
49
50
  input_params = {:data => data}
50
51
  output_params = {}
52
+
53
+ data = data.to_s
51
54
  str_incr = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
52
55
  'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
53
56
  ]
54
57
  d_a_t_a = data.split('')
55
-
56
58
  is_string = 0
57
-
58
59
  for ddd in d_a_t_a
59
60
  if str_incr.include?(ddd)
60
61
  is_string = 1
61
62
  end
62
63
  end
63
-
64
64
  if is_string == 0
65
65
  output_params = {:code => 200, :result => "if_digit_or_string: Request processed", :body => {:string => false}}
66
66
  else
67
67
  output_params = {:code => 200, :result => "if_digit_or_string: Request processed", :body => {:string => true}}
68
68
  end
69
-
70
69
  output_params
71
70
 
72
71
  end
73
72
 
73
+ #make answer in format that soapgw receive
74
+ def iot_create_dev_soapgw_answer(input_params, output_answer)
75
+
76
+ output_info = {}
77
+ begin
78
+
79
+ if output_answer[:code] != 200
80
+ deviceserr = []
81
+ failednum = input_params[:imei_list].length
82
+ for gg in input_params[:imei_list]
83
+ deviceserr.append({:failedimei => gg["imei"]})
84
+ end
85
+ output_info = { :code => output_answer[:code],
86
+ :result => output_answer[:result],
87
+ :processednum => 0,
88
+ :failednum => failednum,
89
+ :deviceserr => deviceserr
90
+ }
91
+
92
+ else
93
+ deviceserr = []
94
+ failednum = output_answer[:body][:error_list].length
95
+ processednum = output_answer[:body][:imei_processed].length
96
+ for gg in output_answer[:body][:error_list]
97
+ deviceserr.append({:failedimei => gg["imei"]})
98
+ end
99
+ output_info = { :code => output_answer[:code],
100
+ :result => output_answer[:result],
101
+ :processednum => processednum,
102
+ :failednum => failednum,
103
+ :deviceserr => deviceserr
104
+ }
105
+ end
106
+
107
+ rescue
108
+ output_info = { :code => 500,
109
+ :result => "iot_create_dev_soapgw_answer: Unknown SDK error",
110
+ :processednum => 0,
111
+ :failednum => 0,
112
+ :deviceserr => []
113
+ }
114
+ end
115
+
116
+ # example = { :code => :integer,
117
+ # :result => :string,
118
+ # :processednum => :integer,
119
+ # :failednum => :integer,
120
+ # :deviceserr => [{:failedimei=>:integer}]
121
+ # }
122
+ output_info
123
+ end
74
124
 
75
125
 
76
126
  def test()
@@ -4,8 +4,8 @@ require 'imperituroard/projects/iot/mongoconnector'
4
4
  require 'imperituroard/projects/iot/hua_oceanconnect_adapter'
5
5
  require 'imperituroard/projects/iot/add_functions'
6
6
  require 'imperituroard/projects/iot/internal_functions'
7
- require "imperituroard/phpipamdb"
8
- require "imperituroard/phpipamcps"
7
+ require "imperituroard/projects/wttx/phpipamdb"
8
+ require "imperituroard/projects/wttx/phpipamcps"
9
9
  require 'json'
10
10
  require 'ipaddr'
11
11
  require 'date'
@@ -120,10 +120,16 @@ class IotFunctions_2
120
120
  model_data[:body]["model"]
121
121
  )
122
122
  if resss[:code]=="200"
123
- s1 = aaa
124
- s1[:huadata] = resss
125
- s1[:created] = DateTime.now
126
- added_on_iot_platf.append(s1)
123
+
124
+ if resss[:body].key?("error_code") && resss[:body]["error_code"] != 200
125
+ not_processed_list.append({:imei => aaa["imei"], :error => resss})
126
+ else
127
+ s1 = aaa
128
+ s1[:huadata] = resss
129
+ s1[:created] = DateTime.now
130
+ added_on_iot_platf.append(s1)
131
+ end
132
+
127
133
  else
128
134
  not_processed_list.append({:imei => aaa["imei"], :error => resss})
129
135
  end
@@ -158,6 +164,9 @@ class IotFunctions_2
158
164
  end
159
165
  thr1.join
160
166
 
167
+
168
+ resp_out[:body][:tosoapgw] = internal_func.iot_create_dev_soapgw_answer(input_json, resp_out)
169
+
161
170
  mongo_client.audit_logger("add_device_to_profile", remote_ip, input_json, resp_out, real_ip)
162
171
  resp_out
163
172
  end
@@ -802,12 +811,9 @@ class IotFunctions_2
802
811
  else
803
812
  output_answ = {:code => 505, :result => "Unknown SDK error"}
804
813
  end
805
-
806
814
  rescue
807
-
808
815
  output_answ = {:code => 507, :result => "Unknown SDK error"}
809
816
  end
810
-
811
817
  mongo_client.audit_logger("get_info_data_profile_2", remote_ip, input_params, output_answ, real_ip)
812
818
  output_answ
813
819
 
@@ -1,3 +1,3 @@
1
1
  module Imperituroard
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
data/lib/imperituroard.rb CHANGED
@@ -3,10 +3,11 @@ $LOAD_PATH.unshift File.expand_path("../projects/wttx", __dir__)
3
3
  $LOAD_PATH.unshift File.expand_path("../projects/mhub", __dir__)
4
4
  $LOAD_PATH.unshift File.expand_path("../projects/mhub/subs/dabrab", __dir__)
5
5
  $LOAD_PATH.unshift File.expand_path("../platforms/cps", __dir__)
6
+ $LOAD_PATH.unshift File.expand_path("../projects", __dir__)
6
7
 
7
8
  require "imperituroard/version"
8
- require "imperituroard/phpipamdb"
9
- require "imperituroard/phpipamcps"
9
+ require "imperituroard/projects/wttx/phpipamdb"
10
+ require "imperituroard/projects/wttx/phpipamcps"
10
11
  require "imperituroard/projects/iot/mongoconnector"
11
12
  require "imperituroard/projects/iot/hua_oceanconnect_adapter"
12
13
  require "imperituroard/projects/iot/add_functions"
@@ -15,7 +16,7 @@ require 'imperituroard/projects/mhub/infobip'
15
16
  require 'imperituroard/projects/mhub/sk'
16
17
  require 'imperituroard/projects/mhub/subs/dabrab/dabrab_proced'
17
18
  require 'imperituroard/projects/mhub/subs/dabrab/dabrab_platform'
18
- require 'imperituroard/iot'
19
+ require 'imperituroard/projects/iot'
19
20
  require 'imperituroard/platforms/cps/qps_connector'
20
21
  require 'json'
21
22
  require 'ipaddr'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imperituroard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-08 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,11 +159,9 @@ files:
159
159
  - lib/.DS_Store
160
160
  - lib/imperituroard.rb
161
161
  - lib/imperituroard/.DS_Store
162
- - lib/imperituroard/iot.rb
163
- - lib/imperituroard/phpipamcps.rb
164
- - lib/imperituroard/phpipamdb.rb
165
162
  - lib/imperituroard/platforms/cps/qps_connector.rb
166
163
  - lib/imperituroard/platforms/cps/request_formatter.rb
164
+ - lib/imperituroard/projects/iot.rb
167
165
  - lib/imperituroard/projects/iot/add_functions.rb
168
166
  - lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb
169
167
  - lib/imperituroard/projects/iot/internal_functions.rb
@@ -172,6 +170,8 @@ files:
172
170
  - lib/imperituroard/projects/mhub/sk.rb
173
171
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb
174
172
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb
173
+ - lib/imperituroard/projects/wttx/phpipamcps.rb
174
+ - lib/imperituroard/projects/wttx/phpipamdb.rb
175
175
  - lib/imperituroard/projects/wttx/updatepostcps.rb
176
176
  - lib/imperituroard/version.rb
177
177
  homepage: https://rubygems.org/