puzzle 0.2.2 → 0.3.0
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/VERSION +1 -1
- data/lib/puzzle/configuration.rb +12 -0
- data/lib/puzzle/request.rb +4 -1
- data/puzzle.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/puzzle/configuration.rb
CHANGED
@@ -13,11 +13,23 @@ module Puzzle
|
|
13
13
|
# @return [String] The API token for your user.
|
14
14
|
attr_accessor :token
|
15
15
|
|
16
|
+
# @return [String] The path to the certificate
|
17
|
+
attr_accessor :ca_path
|
18
|
+
|
19
|
+
# @return [String] The path to the certificate
|
20
|
+
attr_accessor :ca_file
|
21
|
+
|
22
|
+
# @return [String] The verification method used by ssl
|
23
|
+
attr_accessor :verify_mode
|
24
|
+
|
16
25
|
# Instantiated from {Puzzle.configuration}. Sets defaults.
|
17
26
|
def initialize
|
18
27
|
self.host = "www.jigsaw.com"
|
19
28
|
self.port = 443
|
20
29
|
self.format = "json"
|
30
|
+
self.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
31
|
+
self.ca_path = '/etc/ssl/certs' if File.exists?('/etc/ssl/certs') # Ubuntu
|
32
|
+
self.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt') # Mac OS X
|
21
33
|
end
|
22
34
|
end
|
23
35
|
end
|
data/lib/puzzle/request.rb
CHANGED
@@ -39,13 +39,16 @@ module Puzzle
|
|
39
39
|
|
40
40
|
def self.request
|
41
41
|
http = Net::HTTP.new(Puzzle.configuration.host, Puzzle.configuration.port)
|
42
|
+
http.verify_mode = Puzzle.configuration.verify_mode
|
43
|
+
http.ca_path = Puzzle.configuration.ca_path
|
44
|
+
http.ca_file = Puzzle.configuration.ca_file
|
42
45
|
http.use_ssl = true
|
43
46
|
http
|
44
47
|
end
|
45
48
|
|
46
49
|
def self.uri(path, options = {})
|
47
50
|
format = Puzzle.configuration.format
|
48
|
-
"/rest
|
51
|
+
"/rest#{path}.#{format}?#{hash_to_query_string(options)}"
|
49
52
|
end
|
50
53
|
|
51
54
|
def self.hash_to_query_string(hash)
|
data/puzzle.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "puzzle"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Simon Gingras"]
|
12
|
-
s.date = "2011-12-
|
12
|
+
s.date = "2011-12-13"
|
13
13
|
s.description = "Puzzle makes it easy to acces the jigsaw REST api"
|
14
14
|
s.email = "thegingman@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: puzzle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Simon Gingras
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-12-
|
13
|
+
date: 2011-12-13 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
hash:
|
110
|
+
hash: 1916436741450112247
|
111
111
|
segments:
|
112
112
|
- 0
|
113
113
|
version: "0"
|