messagebus-sdk 5.0.2 → 5.0.3
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.
data/README.md
CHANGED
@@ -68,29 +68,32 @@ class MessagebusReportsClient < MessagebusSDK::MessagebusBase
|
|
68
68
|
return report_data
|
69
69
|
end
|
70
70
|
|
71
|
-
def create_report(report_type, start_date, end_date, scope =
|
71
|
+
def create_report(report_type, start_date, end_date, scope = nil, format = 'json', channel_key = '', session_key = '', use_send_time = true)
|
72
72
|
path = @rest_endpoints[:reports]
|
73
73
|
days = 1
|
74
74
|
end_date = set_date(end_date, 0)
|
75
75
|
start_date = set_date(start_date, days)
|
76
76
|
|
77
77
|
post_data = {:reportType => report_type,
|
78
|
-
:scope => scope,
|
79
78
|
:format => format,
|
80
79
|
:startDate => start_date,
|
81
80
|
:endDate => end_date,
|
82
81
|
:channelKey => channel_key,
|
83
82
|
:sessionKey => session_key
|
84
83
|
}
|
84
|
+
|
85
|
+
post_data[:scope] = scope if (report_type == REPORT_TYPE_FEEDBACK || report_type == REPORT_TYPE_BLOCKLIST)
|
86
|
+
post_data[:useSendTime] = use_send_time if report_type == REPORT_TYPE_FEEDBACK
|
87
|
+
|
85
88
|
make_api_request(path, HTTP_POST, post_data.to_json)
|
86
89
|
end
|
87
90
|
|
88
|
-
def create_feedback_report(start_date, end_date, scope = 'bounces', format = 'json', channel_key = '', session_key = '')
|
89
|
-
create_report(REPORT_TYPE_FEEDBACK, start_date, end_date, scope, format, channel_key, session_key)
|
91
|
+
def create_feedback_report(start_date, end_date, scope = 'bounces', format = 'json', channel_key = '', session_key = '', use_send_time = true)
|
92
|
+
create_report(REPORT_TYPE_FEEDBACK, start_date, end_date, scope, format, channel_key, session_key, use_send_time)
|
90
93
|
end
|
91
94
|
|
92
95
|
def create_stats_report(start_date, end_date, format = 'json', channel_key = '', session_key = '')
|
93
|
-
create_report(REPORT_TYPE_STATS, start_date, end_date,
|
96
|
+
create_report(REPORT_TYPE_STATS, start_date, end_date, nil, format, channel_key, session_key)
|
94
97
|
end
|
95
98
|
|
96
99
|
def create_blocklist_report(start_date, end_date, scope = 'blocks', format = 'json', channel_key = '', session_key = '')
|
@@ -51,7 +51,6 @@ describe MessagebusReportsClient do
|
|
51
51
|
format = MessagebusReportsClient::FORMAT_CSV
|
52
52
|
|
53
53
|
post_data = {:reportType => report_type,
|
54
|
-
:scope => scope,
|
55
54
|
:format => format,
|
56
55
|
:startDate => start_date_str,
|
57
56
|
:endDate => end_date_str,
|
@@ -64,6 +63,11 @@ describe MessagebusReportsClient do
|
|
64
63
|
|
65
64
|
response = client.create_report(report_type, start_date_str, end_date_str, scope, format)
|
66
65
|
FakeWeb.last_request.body.should == post_data.to_json
|
66
|
+
|
67
|
+
post_data[:channelKey] = 'A'
|
68
|
+
post_data[:sessionKey] = 'B'
|
69
|
+
response = client.create_report(report_type, start_date_str, end_date_str, scope, format, 'A', 'B')
|
70
|
+
FakeWeb.last_request.body.should == post_data.to_json
|
67
71
|
end
|
68
72
|
|
69
73
|
it "#create_feedback_report" do
|
@@ -73,18 +77,25 @@ describe MessagebusReportsClient do
|
|
73
77
|
format = MessagebusReportsClient::FORMAT_CSV
|
74
78
|
|
75
79
|
post_data = {:reportType => MessagebusReportsClient::REPORT_TYPE_FEEDBACK,
|
76
|
-
:scope => scope,
|
77
80
|
:format => format,
|
78
81
|
:startDate => start_date_str,
|
79
82
|
:endDate => end_date_str,
|
80
83
|
:channelKey => '',
|
81
|
-
:sessionKey => ''
|
84
|
+
:sessionKey => '',
|
85
|
+
:scope => scope,
|
86
|
+
:useSendTime => true
|
82
87
|
}
|
83
88
|
|
84
89
|
expected_request="#{API_URL}/reports"
|
85
90
|
FakeWeb.register_uri(:post, expected_request, :body => json_report_request_response201)
|
86
91
|
response = client.create_feedback_report(start_date_str, end_date_str, scope, format)
|
87
92
|
FakeWeb.last_request.body.should == post_data.to_json
|
93
|
+
|
94
|
+
post_data[:channelKey] = 'A'
|
95
|
+
post_data[:sessionKey] = 'B'
|
96
|
+
post_data[:useSendTime] = false
|
97
|
+
response = client.create_feedback_report(start_date_str, end_date_str, scope, format, 'A', 'B', false)
|
98
|
+
FakeWeb.last_request.body.should == post_data.to_json
|
88
99
|
end
|
89
100
|
|
90
101
|
it "#create_stats_report" do
|
@@ -93,7 +104,6 @@ describe MessagebusReportsClient do
|
|
93
104
|
format = MessagebusReportsClient::FORMAT_CSV
|
94
105
|
|
95
106
|
post_data = {:reportType => MessagebusReportsClient::REPORT_TYPE_STATS,
|
96
|
-
:scope => MessagebusReportsClient::SCOPE_ALL,
|
97
107
|
:format => format,
|
98
108
|
:startDate => start_date_str,
|
99
109
|
:endDate => end_date_str,
|
@@ -106,6 +116,10 @@ describe MessagebusReportsClient do
|
|
106
116
|
response = client.create_stats_report(start_date_str, end_date_str, format)
|
107
117
|
FakeWeb.last_request.body.should == post_data.to_json
|
108
118
|
|
119
|
+
post_data[:channelKey] = 'A'
|
120
|
+
post_data[:sessionKey] = 'B'
|
121
|
+
response = client.create_stats_report(start_date_str, end_date_str, format, 'A', 'B')
|
122
|
+
FakeWeb.last_request.body.should == post_data.to_json
|
109
123
|
end
|
110
124
|
|
111
125
|
it "#create_blocklist_report" do
|
@@ -115,18 +129,23 @@ describe MessagebusReportsClient do
|
|
115
129
|
format = MessagebusReportsClient::FORMAT_CSV
|
116
130
|
|
117
131
|
post_data = {:reportType => MessagebusReportsClient::REPORT_TYPE_BLOCKLIST,
|
118
|
-
:scope => scope,
|
119
132
|
:format => format,
|
120
133
|
:startDate => start_date_str,
|
121
134
|
:endDate => end_date_str,
|
122
135
|
:channelKey => '',
|
123
|
-
:sessionKey => ''
|
136
|
+
:sessionKey => '',
|
137
|
+
:scope => scope
|
124
138
|
}
|
125
139
|
|
126
140
|
expected_request="#{API_URL}/reports"
|
127
141
|
FakeWeb.register_uri(:post, expected_request, :body => json_report_request_response201)
|
128
142
|
response = client.create_blocklist_report(start_date_str, end_date_str, scope, format)
|
129
143
|
FakeWeb.last_request.body.should == post_data.to_json
|
144
|
+
|
145
|
+
post_data[:channelKey] = 'A'
|
146
|
+
post_data[:sessionKey] = 'B'
|
147
|
+
response = client.create_blocklist_report(start_date_str, end_date_str, scope, format, 'A', 'B')
|
148
|
+
FakeWeb.last_request.body.should == post_data.to_json
|
130
149
|
end
|
131
150
|
end
|
132
151
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagebus-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: SDK for Message Bus service
|
15
15
|
email:
|
@@ -40,7 +40,7 @@ files:
|
|
40
40
|
- Gemfile
|
41
41
|
- Rakefile
|
42
42
|
- .rvmrc
|
43
|
-
homepage:
|
43
|
+
homepage: http://developer.messagebus.com
|
44
44
|
licenses:
|
45
45
|
- APACHE2
|
46
46
|
post_install_message:
|