Class: Qps_2

Inherits:
Object
  • Object
show all
Defined in:
lib/imperituroard/platforms/cps/qps_connector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cps_wsdl, cps_endpoint, cps_namespace) ⇒ Qps_2

Returns a new instance of Qps_2.



9
10
11
12
13
14
15
16
17
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 9

def initialize(cps_wsdl, cps_endpoint, cps_namespace)
  @formatter_connector = CpsFormatter_2.new
  @cps_connector_client = Savon.client do
    ssl_verify_mode :none
    wsdl cps_wsdl
    endpoint cps_endpoint
    namespace cps_namespace
  end
end

Instance Attribute Details

#cps_connector_clientObject

Returns the value of attribute cps_connector_client.



7
8
9
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 7

def cps_connector_client
  @cps_connector_client
end

#formatter_connectorObject

Returns the value of attribute formatter_connector.



7
8
9
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 7

def formatter_connector
  @formatter_connector
end

Instance Method Details

#add_avp_acl(username, acl) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 45

def add_avp_acl(username, acl)
    message1 = {
        :audit => {:id => "SOAPGW", :comment => "takih ne berut v kosmonavty"},
        :networkId => username,
        :newAvp => [
            {:code =>"IN-ACL", :value => acl}
        ]
    }
    response = cps_connector_client.call(:change_subscriber_avps) do
      message(message1)
    end
    response.to_hash
end

#delete_avp_acl(username) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 59

def delete_avp_acl(username)
  mess = {
      :audit => {:id => 'SOAPGW', :comment => 'some procedure'},
      :networkId => username,
      :deletedAvp => [
          {:code => 'IN-ACL'}
      ]
  }
  response = cps_connector_client.call(:change_subscriber_avps) do
    message(mess)
  end
  response.to_hash
end

#delete_subscriber(user) ⇒ Object

final procedure



37
38
39
40
41
42
43
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 37

def delete_subscriber(user)
  mess = {:networkId => user, :hardDelete => "true"}
  response = cps_connector_client.call(:delete_subscriber) do
    message(mess)
  end
  access_interface1 = response.to_hash #[:mts_wifi_portal_get_access_int_response][:accessinterface]
end

#get_subscriber_msisdn(msisdn) ⇒ Object

final procedure



20
21
22
23
24
25
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 20

def get_subscriber_msisdn(msisdn)
  response = cps_connector_client.call(:get_subscriber) do
    message(networkId: msisdn)
  end
  answer = JSON.parse(response.to_json)
end

#query_session_username(username) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 90

def query_session_username(username)
  params = {
      audit: { id: 'SOAPGW', comment: 'query session procedure' },
      key: {
          code: 'UserIdKey',
          primary: false,
          key_field: { code: 'userId', value: username }
      }
  }
  p params
  xml =  cps_connector_client.call(:query_session) do
    message(params)
  end
  code = xml.to_hash[:query_session_response]
  p code
end

#recreate_subscriber(info_from_get_subs) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 27

def recreate_subscriber(info_from_get_subs)
  mess = formatter_connector.create_subs_for_recreate(info_from_get_subs)
  #tmp = {:subscriber=>{:credential=>[{:networkId=>"375001029830"}, {:networkId=>"Ethernet1/0/9:1933.0 Min_Ljubimova_37_2/0/0/1/0/9", :type=>"User-Name"}], :notification=>[{"destination"=>"[email protected]", "enabled"=>true, "transport"=>"EMAIL"}, {"destination"=>nil, "enabled"=>false, "transport"=>"SMS"}], :service=>[{"code"=>"FR0000", "enabled"=>true}, {"code"=>"FR10312", "enabled"=>true}, {"code"=>"FR11885", "enabled"=>true}, {"code"=>"FR11873", "enabled"=>true}]}}
  response = cps_connector_client.call(:create_subscriber) do
    message(mess)
  end
  response.to_hash
end

#stop_session_username(username) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/imperituroard/platforms/cps/qps_connector.rb', line 73

def stop_session_username(username)
  params = {
      audit: { id: 'SOAPGW', comment: 'stop session procedure' },
      key: {
          code: 'UserIdKey',
          primary: false,
          key_field: { code: 'userId', value: username }
      }
  }
  p params
  xml =  cps_connector_client.call(:stop_session) do
    message(params)
  end
  code = xml.to_hash[:stop_session_response]
  p code
end