melipayamak 1.0.0

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.
@@ -0,0 +1,58 @@
1
+ require 'savon'
2
+
3
+ class Ticket
4
+ def initialize(username, password)
5
+ @username = username
6
+ @password = password
7
+ @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/Tickets.asmx?wsdl")
8
+ end
9
+ def get_data
10
+ {
11
+ :username => @username,
12
+ :password => @password
13
+ }
14
+ end
15
+ def execute(method,data)
16
+ response = @client.call(method, message:data.merge(get_data))
17
+ response.body
18
+ end
19
+ def add(title, content, aws=true)
20
+ execute(:add_ticket,{
21
+ :title => title,
22
+ :content => content,
23
+ :alertWithSms => alertWithSms
24
+ })
25
+ end
26
+ def get_received(ticketOwner, ticketType, keyword)
27
+ execute(:get_received_tickets,{
28
+ :ticketOwner => ticketOwner,
29
+ :ticketType => ticketType,
30
+ :keyword => keyword
31
+ })
32
+ end
33
+ def get_received_count(ticketType)
34
+ execute(:get_received_tickets_count,{
35
+ :ticketType => ticketType
36
+ })
37
+ end
38
+ def get_sent(ticketOwner, ticketType, keyword)
39
+ execute(:get_sent_tickets,{
40
+ :ticketOwner => ticketOwner,
41
+ :ticketType => ticketType,
42
+ :keyword => keyword
43
+ })
44
+ end
45
+ def get_sent_count(ticketType)
46
+ execute(:get_sent_tickets_count,{
47
+ :ticketType => ticketType
48
+ })
49
+ end
50
+ def response(ticketId, type, content, alertWithSms=true)
51
+ execute(:response_ticket,{
52
+ :ticketId => ticketId,
53
+ :content => content,
54
+ :alertWithSms => alertWithSms,
55
+ :type => type
56
+ })
57
+ end
58
+ end
@@ -0,0 +1,60 @@
1
+ require 'savon'
2
+
3
+ class TicketAsync
4
+ def initialize(username, password)
5
+ @username = username
6
+ @password = password
7
+ @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/Tickets.asmx?wsdl")
8
+ end
9
+ def get_data
10
+ {
11
+ :username => @username,
12
+ :password => @password
13
+ }
14
+ end
15
+ def execute(method,data)
16
+ response = nil
17
+ t = Thread.new{response = @client.call(method, message:data.merge(get_data))}
18
+ t.join
19
+ response.body
20
+ end
21
+ def add(title, content, aws=true)
22
+ execute(:add_ticket,{
23
+ :title => title,
24
+ :content => content,
25
+ :alertWithSms => alertWithSms
26
+ })
27
+ end
28
+ def get_received(ticketOwner, ticketType, keyword)
29
+ execute(:get_received_tickets,{
30
+ :ticketOwner => ticketOwner,
31
+ :ticketType => ticketType,
32
+ :keyword => keyword
33
+ })
34
+ end
35
+ def get_received_count(ticketType)
36
+ execute(:get_received_tickets_count,{
37
+ :ticketType => ticketType
38
+ })
39
+ end
40
+ def get_sent(ticketOwner, ticketType, keyword)
41
+ execute(:get_sent_tickets,{
42
+ :ticketOwner => ticketOwner,
43
+ :ticketType => ticketType,
44
+ :keyword => keyword
45
+ })
46
+ end
47
+ def get_sent_count(ticketType)
48
+ execute(:get_sent_tickets_count,{
49
+ :ticketType => ticketType
50
+ })
51
+ end
52
+ def response(ticketId, type, content, alertWithSms=true)
53
+ execute(:response_ticket,{
54
+ :ticketId => ticketId,
55
+ :content => content,
56
+ :alertWithSms => alertWithSms,
57
+ :type => type
58
+ })
59
+ end
60
+ end
@@ -0,0 +1,101 @@
1
+ require 'savon'
2
+
3
+ class Users
4
+ def initialize(username, password)
5
+ @username = username
6
+ @password = password
7
+ @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/users.asmx?wsdl")
8
+ end
9
+ def get_data
10
+ {
11
+ :username => @username,
12
+ :password => @password
13
+ }
14
+ end
15
+ def execute(method,data)
16
+ response = @client.call(method, message:data.merge(get_data))
17
+ response.body
18
+ end
19
+ def add_payment(options)
20
+ execute(:add_payment,options)
21
+ end
22
+ def add(options)
23
+ execute(:add_user,options)
24
+ end
25
+ def add_complete(options)
26
+ execute(:add_user_complete,options)
27
+ end
28
+ def add_with_location(options)
29
+ execute(:add_user_with_location,options)
30
+ end
31
+ def authenticate
32
+ execute(:authenticate_user,{})
33
+ end
34
+ def change_credit(amount, description, targetUsername, getTax)
35
+ execute(:change_user_credit,{
36
+ :amount => amount,
37
+ :description => description,
38
+ :targetUsername => targetUsername,
39
+ :GetTax => getTax
40
+
41
+ })
42
+ end
43
+ def forgot_password(mobileNumber, emailAddress, targetUsername)
44
+ execute(:forgot_password,{
45
+ :mobileNumber => mobileNumber,
46
+ :emailAddress => emailAddress,
47
+ :targetUsername => targetUsername
48
+ })
49
+ end
50
+ def get_base_price(targetUsername)
51
+ execute(:get_user_base_price,{
52
+ :targetUsername => targetUsername
53
+ })
54
+ end
55
+ def remove(targetUsername)
56
+ execute(:remove_user,{
57
+ :targetUsername => targetUsername
58
+ })
59
+ end
60
+ def get_credit(targetUsername)
61
+ execute(:get_user_credit,{
62
+ :targetUsername => targetUsername
63
+ })
64
+ end
65
+ def get_details(targetUsername)
66
+ execute(:get_user_details,{
67
+ :targetUsername => targetUsername
68
+ })
69
+ end
70
+ def get_numbers
71
+ execute(:get_user_numbers,{})
72
+ end
73
+ def get_provinces
74
+ execute(:get_provinces,{})
75
+ end
76
+ def get_cities(provinceId)
77
+ execute(:get_cities,{
78
+ :provinceId => provinceId
79
+ })
80
+ end
81
+ def get_expire_date
82
+ execute(:get_expire_date,{})
83
+ end
84
+ def get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword)
85
+ execute(:get_user_transactions,{
86
+ :creditType => creditType,
87
+ :dateFrom => dateFrom,
88
+ :targetUsername => targetUsername,
89
+ :dateTo => dateTo,
90
+ :keyword => keyword
91
+ })
92
+ end
93
+ def get
94
+ execute(:get_users,{})
95
+ end
96
+ def has_filter(text)
97
+ execute(:has_filter,{
98
+ :text => text
99
+ })
100
+ end
101
+ end
@@ -0,0 +1,103 @@
1
+ require 'savon'
2
+
3
+ class UsersAsync
4
+ def initialize(username, password)
5
+ @username = username
6
+ @password = password
7
+ @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/users.asmx?wsdl")
8
+ end
9
+ def get_data
10
+ {
11
+ :username => @username,
12
+ :password => @password
13
+ }
14
+ end
15
+ def execute(method,data)
16
+ response = nil
17
+ t = Thread.new{response = @client.call(method, message:data.merge(get_data))}
18
+ t.join
19
+ response.body
20
+ end
21
+ def add_payment(options)
22
+ execute(:add_payment,options)
23
+ end
24
+ def add(options)
25
+ execute(:add_user,options)
26
+ end
27
+ def add_complete(options)
28
+ execute(:add_user_complete,options)
29
+ end
30
+ def add_with_location(options)
31
+ execute(:add_user_with_location,options)
32
+ end
33
+ def authenticate
34
+ execute(:authenticate_user,{})
35
+ end
36
+ def change_credit(amount, description, targetUsername, getTax)
37
+ execute(:change_user_credit,{
38
+ :amount => amount,
39
+ :description => description,
40
+ :targetUsername => targetUsername,
41
+ :GetTax => getTax
42
+
43
+ })
44
+ end
45
+ def forgot_password(mobileNumber, emailAddress, targetUsername)
46
+ execute(:forgot_password,{
47
+ :mobileNumber => mobileNumber,
48
+ :emailAddress => emailAddress,
49
+ :targetUsername => targetUsername
50
+ })
51
+ end
52
+ def get_base_price(targetUsername)
53
+ execute(:get_user_base_price,{
54
+ :targetUsername => targetUsername
55
+ })
56
+ end
57
+ def remove(targetUsername)
58
+ execute(:remove_user,{
59
+ :targetUsername => targetUsername
60
+ })
61
+ end
62
+ def get_credit(targetUsername)
63
+ execute(:get_user_credit,{
64
+ :targetUsername => targetUsername
65
+ })
66
+ end
67
+ def get_details(targetUsername)
68
+ execute(:get_user_details,{
69
+ :targetUsername => targetUsername
70
+ })
71
+ end
72
+ def get_numbers
73
+ execute(:get_user_numbers,{})
74
+ end
75
+ def get_provinces
76
+ execute(:get_provinces,{})
77
+ end
78
+ def get_cities(provinceId)
79
+ execute(:get_cities,{
80
+ :provinceId => provinceId
81
+ })
82
+ end
83
+ def get_expire_date
84
+ execute(:get_expire_date,{})
85
+ end
86
+ def get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword)
87
+ execute(:get_user_transactions,{
88
+ :creditType => creditType,
89
+ :dateFrom => dateFrom,
90
+ :targetUsername => targetUsername,
91
+ :dateTo => dateTo,
92
+ :keyword => keyword
93
+ })
94
+ end
95
+ def get
96
+ execute(:get_users,{})
97
+ end
98
+ def has_filter(text)
99
+ execute(:has_filter,{
100
+ :text => text
101
+ })
102
+ end
103
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: melipayamak
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Amirhossein Mehrvarzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Melipayamak WebService Wrapper
14
+ email: melipayamak@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/branch.rb
20
+ - lib/branchAsync.rb
21
+ - lib/contacts.rb
22
+ - lib/contactsAsync.rb
23
+ - lib/melipayamakapi.rb
24
+ - lib/rest.rb
25
+ - lib/restAsync.rb
26
+ - lib/soap.rb
27
+ - lib/soapAsync.rb
28
+ - lib/ticket.rb
29
+ - lib/ticketAsync.rb
30
+ - lib/users.rb
31
+ - lib/usersAsync.rb
32
+ homepage: https://rubygems.org/gems/melipayamak
33
+ licenses:
34
+ - MIT
35
+ metadata: {}
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.0.3
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Melipayamak WebService
55
+ test_files: []