megam_api 0.16 → 0.17
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.
- checksums.yaml +4 -4
- data/lib/megam/api.rb +11 -9
- data/lib/megam/api/version.rb +1 -1
- data/test/test_accounts.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 049495e50148060c8b58f16100dff5a6232aa63e
|
4
|
+
data.tar.gz: 6c3a829fd7baa2121e70eaeae72e8dce1fbbc4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f87e02f88e6d63c5ad4fe63f40c3a67ec1842e45946ce6dedf68cf888143cbbabef538a2fbee4047c1e460eea7a9f24eda6eb8faff534d2768823b2dc17ff77d
|
7
|
+
data.tar.gz: 82742a4c9a346161c626e082791d15861f7b55c45a5fb1f63bdcbe3f322c59daa85bcd6d0d8cc3e092cb6f7ae29b7dcad07bf4ad8a0bfdf26a2bb937b4ac1134
|
data/lib/megam/api.rb
CHANGED
@@ -219,21 +219,22 @@ module Megam
|
|
219
219
|
X_Megam_HMAC => encoded_api_header[:hmac],
|
220
220
|
X_Megam_DATE => encoded_api_header[:date],
|
221
221
|
}).merge(@options[:headers])
|
222
|
-
#COMMON YML
|
223
|
-
if @options[:scheme] == "https"
|
224
|
-
Excon.defaults[:ssl_ca_file] = File.expand_path(File.join("#{ENV['MEGAM_HOME']}", "#{@common["api"]["pub_key"]}")) || File.expand_path(File.join(File.dirname(__FILE__), "..", "certs", "cacert.pem")) #COMMON YML
|
225
222
|
|
223
|
+
if @options[:scheme] == "https"
|
226
224
|
if !File.exist?(File.expand_path(File.join("#{ENV['MEGAM_HOME']}", "#{@common["api"]["pub_key"]}")))
|
227
225
|
text.warn("Certificate file does not exist. SSL_VERIFY_PEER set as false")
|
228
226
|
Excon.defaults[:ssl_verify_peer] = false
|
227
|
+
@options[:scheme] == "http"
|
229
228
|
elsif !File.exist?(File.expand_path(File.join(File.dirname(__FILE__), "..", "certs", "cacert.pem")))
|
230
229
|
text.warn("Certificate file does not exist. SSL_VERIFY_PEER set as false")
|
231
230
|
Excon.defaults[:ssl_verify_peer] = false
|
231
|
+
@options[:scheme] == "http"
|
232
232
|
else
|
233
233
|
Megam::Log.debug("Certificate found")
|
234
234
|
Excon.defaults[:ssl_verify_peer] = true
|
235
|
+
Excon.defaults[:ssl_ca_file] = File.expand_path(File.join("#{ENV['MEGAM_HOME']}", "#{@common["api"]["pub_key"]}")) || File.expand_path(File.join(File.dirname(__FILE__), "..", "certs", "cacert.pem"))
|
236
|
+
end
|
235
237
|
end
|
236
|
-
end
|
237
238
|
|
238
239
|
Megam::Log.debug("HTTP Request Data:")
|
239
240
|
Megam::Log.debug("> HTTP #{@options[:scheme]}://#{@options[:host]}")
|
@@ -241,13 +242,13 @@ module Megam
|
|
241
242
|
Megam::Log.debug("> #{key}: #{value}")
|
242
243
|
end
|
243
244
|
Megam::Log.debug("End HTTP Request Data.")
|
244
|
-
|
245
|
+
if @options[:scheme] == "https"
|
245
246
|
@connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}",@options)
|
246
|
-
|
247
|
+
else
|
247
248
|
Excon.defaults[:ssl_verify_peer] = false
|
248
249
|
@connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}:9000",@options)
|
249
|
-
|
250
|
-
|
250
|
+
end
|
251
|
+
@connection
|
251
252
|
end
|
252
253
|
|
253
254
|
## encode header as per rules.
|
@@ -272,6 +273,7 @@ module Megam
|
|
272
273
|
final_hmac = @email+':' + hash
|
273
274
|
header_params = { :hmac => final_hmac, :date => current_date}
|
274
275
|
end
|
275
|
-
|
276
|
+
|
277
|
+
end
|
276
278
|
|
277
279
|
end
|
data/lib/megam/api/version.rb
CHANGED
data/test/test_accounts.rb
CHANGED
@@ -12,7 +12,7 @@ class TestAccounts < MiniTest::Unit::TestCase
|
|
12
12
|
response.body.to_s
|
13
13
|
assert_equal(200, response.status)
|
14
14
|
end
|
15
|
-
|
15
|
+
=begin
|
16
16
|
def test_get_accounts_bad
|
17
17
|
assert_raises(Megam::API::Errors::NotFound) do
|
18
18
|
response =megams.get_accounts(sandbox_email+"_bad")
|
@@ -42,4 +42,5 @@ class TestAccounts < MiniTest::Unit::TestCase
|
|
42
42
|
response.body.to_s
|
43
43
|
end
|
44
44
|
end
|
45
|
+
=end
|
45
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.17'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kishorekumar Neelamegam, Thomas Alrin, Subash Sethurajan, Rajthilak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|