messagemedia_messages_sdk 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +106 -606
- data/lib/message_media_messages.rb +2 -2
- data/lib/message_media_messages/api_helper.rb +1 -2
- data/lib/message_media_messages/configuration.rb +9 -1
- data/lib/message_media_messages/controllers/base_controller.rb +18 -1
- data/lib/message_media_messages/controllers/delivery_reports_controller.rb +50 -32
- data/lib/message_media_messages/controllers/messages_controller.rb +93 -66
- data/lib/message_media_messages/controllers/replies_controller.rb +49 -32
- data/lib/message_media_messages/exceptions/api_exception.rb +2 -2
- data/lib/message_media_messages/http/auth/basic_auth.rb +1 -1
- data/lib/message_media_messages/http/auth/hmac_auth.rb +54 -0
- data/lib/message_media_messages/http/http_call_back.rb +2 -2
- data/lib/message_media_messages/http/http_client.rb +17 -16
- data/lib/message_media_messages/http/http_context.rb +2 -2
- data/lib/message_media_messages/http/http_request.rb +10 -10
- data/lib/message_media_messages/http/http_response.rb +3 -3
- data/lib/message_media_messages/message_media_messages_client.rb +8 -5
- data/test/controllers/controller_test_base.rb +4 -1
- data/test/controllers/test_delivery_reports_controller.rb +162 -129
- data/test/controllers/test_messages_controller.rb +165 -104
- data/test/controllers/test_replies_controller.rb +162 -130
- data/test/test_helper.rb +9 -21
- metadata +4 -3
data/test/test_helper.rb
CHANGED
@@ -15,7 +15,7 @@ class TestHelper
|
|
15
15
|
received_headers,
|
16
16
|
allow_extra: true)
|
17
17
|
return false if ((received_headers.length < expected_headers.length) ||
|
18
|
-
((allow_extra
|
18
|
+
((!allow_extra) && (received_headers.length > expected_headers.length)))
|
19
19
|
|
20
20
|
received_headers = Hash[received_headers.map{|k, v| [k.to_s.downcase, v]}]
|
21
21
|
expected_headers.each do |e_key, e_value|
|
@@ -40,18 +40,18 @@ class TestHelper
|
|
40
40
|
check_count: false)
|
41
41
|
if expected_body.instance_of? Hash
|
42
42
|
return false unless received_body.instance_of? Hash
|
43
|
-
|
43
|
+
expected_body.keys.each {|key|
|
44
44
|
return false unless received_body.keys.include? key
|
45
45
|
if check_values or expected_body[key].instance_of? Hash
|
46
|
-
return false unless TestHelper.match_body(expected_body[key],
|
47
|
-
received_body[key],
|
48
|
-
check_values: check_values,
|
49
|
-
check_order: check_order,
|
46
|
+
return false unless TestHelper.match_body(expected_body[key],
|
47
|
+
received_body[key],
|
48
|
+
check_values: check_values,
|
49
|
+
check_order: check_order,
|
50
50
|
check_count: check_count)
|
51
51
|
end
|
52
|
-
|
52
|
+
}
|
53
53
|
elsif expected_body.instance_of? Array
|
54
|
-
return
|
54
|
+
return false unless received_body.instance_of? Array
|
55
55
|
if check_count == true && (expected_body.length != received_body.length)
|
56
56
|
return false
|
57
57
|
else
|
@@ -65,7 +65,7 @@ class TestHelper
|
|
65
65
|
check_count: check_count)
|
66
66
|
end).compact
|
67
67
|
return false if matches.length == 0
|
68
|
-
if check_order
|
68
|
+
if check_order
|
69
69
|
return false if (i != 0 && matches.map{|x| previous_matches.map{|y| y > x}.all?}.all?)
|
70
70
|
previous_matches = matches
|
71
71
|
end
|
@@ -75,17 +75,5 @@ class TestHelper
|
|
75
75
|
return false
|
76
76
|
end
|
77
77
|
return true
|
78
|
-
end
|
79
|
-
|
80
|
-
# Class method which takes a URL, downloads the file (if not already downloaded
|
81
|
-
# for this test session) and returns the path of the file.
|
82
|
-
# @param [String] The URL of the required file.
|
83
|
-
def self.get_file(url)
|
84
|
-
unless @cache.keys.include? url
|
85
|
-
@cache[url] = Tempfile.new('APIMatic')
|
86
|
-
@cache[url].binmode
|
87
|
-
@cache[url].write(open(url, {ssl_ca_cert: Certifi.where}).read)
|
88
|
-
end
|
89
|
-
return @cache[url].path
|
90
78
|
end
|
91
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messagemedia_messages_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MessageMedia Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/message_media_messages/controllers/replies_controller.rb
|
117
117
|
- lib/message_media_messages/exceptions/api_exception.rb
|
118
118
|
- lib/message_media_messages/http/auth/basic_auth.rb
|
119
|
+
- lib/message_media_messages/http/auth/hmac_auth.rb
|
119
120
|
- lib/message_media_messages/http/faraday_client.rb
|
120
121
|
- lib/message_media_messages/http/http_call_back.rb
|
121
122
|
- lib/message_media_messages/http/http_client.rb
|
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
162
|
version: '0'
|
162
163
|
requirements: []
|
163
164
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.5.2
|
165
166
|
signing_key:
|
166
167
|
specification_version: 4
|
167
168
|
summary: MessageMedia Messages SDK
|