megam_api 0.16 → 0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09998b376d64a74fe84a95ed4cbb426827e7d853
4
- data.tar.gz: 6e69181f6b9a5e77358f957d37b7c011c2efddda
3
+ metadata.gz: 049495e50148060c8b58f16100dff5a6232aa63e
4
+ data.tar.gz: 6c3a829fd7baa2121e70eaeae72e8dce1fbbc4e9
5
5
  SHA512:
6
- metadata.gz: f1bd5cc89a3851223ddbb64e8a60fbda88cc68c60854f569715cd0eeb3ab10e67393697854dc9b7273e12c852385fa8e54a85794a2d356deccafcc019d6772cf
7
- data.tar.gz: 69f3175a199fc9614099969ac8150ab78f56244f0b5ca27c2bbea545a524a6183de60e5e5c4276fc5653a1823264acff36b40ebd79bc1eb4d2d13f74067d519e
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
- if @options[:scheme] == "https"
245
+ if @options[:scheme] == "https"
245
246
  @connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}",@options)
246
- else
247
+ else
247
248
  Excon.defaults[:ssl_verify_peer] = false
248
249
  @connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}:9000",@options)
249
- end
250
- @connection
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
- end
276
+
277
+ end
276
278
 
277
279
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.16"
3
+ VERSION = "0.17"
4
4
  end
5
5
  end
@@ -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.16'
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-27 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon