kojn 0.2.6 → 0.2.7
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/kojn.gemspec +2 -2
- data/lib/kojn.rb +6 -0
- data/lib/kojn/net.rb +7 -10
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.7
|
data/kojn.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "kojn"
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.7"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Jeffrey Wilcke", "Maran Hidskes"]
|
|
12
|
-
s.date = "2013-06-
|
|
12
|
+
s.date = "2013-06-12"
|
|
13
13
|
s.description = "Ruby gem for communicating with the kojn.nl API. Allows you to create and managed invoices."
|
|
14
14
|
s.email = ["maran.hidskes@gmail.com", "jeff.wilcke@gmail.com"]
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/kojn.rb
CHANGED
|
@@ -43,6 +43,12 @@ module Kojn
|
|
|
43
43
|
# SSL
|
|
44
44
|
mattr_accessor :ssl
|
|
45
45
|
@@ssl = true
|
|
46
|
+
# Verbose libcurl
|
|
47
|
+
mattr_accessor :verbose
|
|
48
|
+
@@verbose = false
|
|
49
|
+
# Disable host & peer checking (change at your own risk)
|
|
50
|
+
mattr_accessor :verify_peer_and_host
|
|
51
|
+
@@verify_peer_and_host = true
|
|
46
52
|
|
|
47
53
|
def self.crypto
|
|
48
54
|
raise MissingConfigExecption.new("API key not set") unless self.api_key
|
data/lib/kojn/net.rb
CHANGED
|
@@ -8,8 +8,10 @@ module Kojn
|
|
|
8
8
|
verb = verb.upcase.to_sym
|
|
9
9
|
|
|
10
10
|
c = Curl::Easy.new(self.to_uri(path))
|
|
11
|
-
|
|
12
|
-
c.
|
|
11
|
+
|
|
12
|
+
c.verbose = Kojn.verbose
|
|
13
|
+
c.ssl_verify_peer = Kojn.verify_peer_and_host
|
|
14
|
+
c.ssl_verify_host = Kojn.verify_peer_and_host
|
|
13
15
|
|
|
14
16
|
if verb != :GET
|
|
15
17
|
c.post_body = options.to_json
|
|
@@ -18,6 +20,9 @@ module Kojn
|
|
|
18
20
|
c.headers['Content-Type'] = 'application/json'
|
|
19
21
|
c.http_auth_types = :basic
|
|
20
22
|
c.username = Kojn.api_key
|
|
23
|
+
c.password = ''
|
|
24
|
+
|
|
25
|
+
c.http(verb)
|
|
21
26
|
|
|
22
27
|
return c
|
|
23
28
|
end
|
|
@@ -25,32 +30,24 @@ module Kojn
|
|
|
25
30
|
def self.get(path, options={})
|
|
26
31
|
request = self.curl(:GET, path, options)
|
|
27
32
|
|
|
28
|
-
request.perform
|
|
29
|
-
|
|
30
33
|
return request
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
def self.post(path, options={})
|
|
34
37
|
request = self.curl(:POST, path, options)
|
|
35
38
|
|
|
36
|
-
request.perform
|
|
37
|
-
|
|
38
39
|
return request
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def self.patch(path, options={})
|
|
42
43
|
request = self.curl(:PATCH, path, options)
|
|
43
44
|
|
|
44
|
-
request.perform
|
|
45
|
-
|
|
46
45
|
return request
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def self.delete(path, options={})
|
|
50
49
|
request = self.curl(:DELETE, path, options)
|
|
51
50
|
|
|
52
|
-
request.perform
|
|
53
|
-
|
|
54
51
|
return request
|
|
55
52
|
end
|
|
56
53
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kojn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-06-
|
|
13
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activemodel
|
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
172
172
|
version: '0'
|
|
173
173
|
segments:
|
|
174
174
|
- 0
|
|
175
|
-
hash: -
|
|
175
|
+
hash: -169175154166651822
|
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
none: false
|
|
178
178
|
requirements:
|