monetra 0.1.16 → 0.1.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.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'psych'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
  YAML::ENGINE.yamler = 'syck'
6
- Echoe.new('monetra', '0.1.16') do |p|
6
+ Echoe.new('monetra', '0.1.17') do |p|
7
7
  p.description = "A gem that uses the Monetra API to perform actions"
8
8
  p.url = "http://github.com/winelibrary/monetra"
9
9
  p.author = ["Dan Ahern", "John Kassimatis", "Brian Woolley"]
@@ -4,52 +4,52 @@ module Monetra
4
4
  def options(options_or_path_to=nil)
5
5
  @options ||= case options_or_path_to.class.to_s
6
6
  when "String"
7
- YAML::load_file(options_or_path_to).stringify_keys
7
+ YAML::load_file(options_or_path_to).symbolize_keys
8
8
  when "Hash"
9
- options_or_path_to.stringify_keys
9
+ options_or_path_to.symbolize_keys
10
10
  when "NilClass"
11
- YAML::load_file(File.join(Rails.root, 'config', 'monetra.yml'))[Rails.env].stringify_keys if defined?(Rails)
11
+ YAML::load_file(File.join(Rails.root, 'config', 'monetra.yml'))[Rails.env].symbolize_keys if defined?(Rails)
12
12
  end
13
13
  end
14
14
 
15
15
  def user_name
16
- Monetra::Configuration.options["user_name"]
16
+ Monetra::Configuration.options[:user_name]
17
17
  end
18
18
 
19
19
  def user_name=(value)
20
- Monetra::Configuration.options["user_name"] = value
20
+ Monetra::Configuration.options[:user_name] = value
21
21
  end
22
22
 
23
23
  def password
24
- Monetra::Configuration.options["password"]
24
+ Monetra::Configuration.options[:password]
25
25
  end
26
26
 
27
27
  def password=(value)
28
- Monetra::Configuration.options["password"] = value
28
+ Monetra::Configuration.options[:password] = value
29
29
  end
30
30
 
31
31
  def host
32
- Monetra::Configuration.options["host"]
32
+ Monetra::Configuration.options[:host]
33
33
  end
34
34
 
35
35
  def host=(value)
36
- Monetra::Configuration.options["host"] = value
36
+ Monetra::Configuration.options[:host] = value
37
37
  end
38
38
 
39
39
  def port
40
- Monetra::Configuration.options["port"]
40
+ Monetra::Configuration.options[:port]
41
41
  end
42
42
 
43
43
  def port=(value)
44
- Monetra::Configuration.options["port"] = value
44
+ Monetra::Configuration.options[:port] = value
45
45
  end
46
46
 
47
47
  def use_ssl?
48
- Monetra::Configuration.options["use_ssl"]
48
+ Monetra::Configuration.options[:use_ssl]
49
49
  end
50
50
 
51
51
  def use_ssl=(value)
52
- Monetra::Configuration.options["use_ssl"] = value
52
+ Monetra::Configuration.options[:use_ssl] = value
53
53
  end
54
54
  end
55
55
  end
@@ -7,17 +7,27 @@ module Monetra
7
7
 
8
8
  def post(data)
9
9
  base.use_ssl = Monetra::Configuration.use_ssl?
10
- if Monetra::Configuration.use_ssl?
11
- if RUBY_VERSION.to_f == 1.9
12
- # base.verify_mode = OpenSSL::SSL::VERIFY_PEER
13
- base.ca_file = '/usr/lib/ssl/certs/ca-certificates.crt' if File.exists?('/usr/lib/ssl/certs/ca-certificates.crt') # Ubuntu
14
- base.ca_path = '/etc/ssl/certs' if File.exists?('/etc/ssl/certs') # Ubuntu
15
- base.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt') # Mac OS X
16
- end
17
- end
10
+ ssl_certificate if Monetra::Configuration.use_ssl?
18
11
  request = base.post("/", data)
19
12
  request.body
20
13
  end
14
+
15
+ private
16
+ def ssl_certificate
17
+ if RUBY_VERSION.to_f == 1.9
18
+ # base.verify_mode = OpenSSL::SSL::VERIFY_PEER
19
+ case
20
+ when ENV["SSL_CERT_FILE"]
21
+ base.ca_file = ENV["SSL_CERT_FILE"]
22
+ when File.exists?('/usr/lib/ssl/certs/ca-certificates.crt') # heroku
23
+ base.ca_file = '/usr/lib/ssl/certs/ca-certificates.crt'
24
+ when File.exists?('/etc/ssl/certs') # Ubuntu
25
+ base.ca_path = '/etc/ssl/certs'
26
+ when File.exists?('/opt/local/share/curl/curl-ca-bundle.crt') # Mac OS X
27
+ base.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt'
28
+ end
29
+ end
30
+ end
21
31
  end
22
32
  end
23
33
  end
data/monetra.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "monetra"
5
- s.version = "0.1.16"
5
+ s.version = "0.1.17"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Dan Ahern, John Kassimatis, Brian Woolley"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: monetra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.16
5
+ version: 0.1.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Ahern, John Kassimatis, Brian Woolley