kalixa_api 0.1.0 → 0.1.1
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/README.md +1 -1
- data/lib/kalixa_api/v3/http_service.rb +8 -8
- data/lib/kalixa_api/v4/http_service.rb +4 -4
- data/lib/kalixa_api/version.rb +1 -1
- data/lib/kalixa_api.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba2e88ce0dbe8fdb2d1ed4a34eb04f76f1d5ad9
|
4
|
+
data.tar.gz: af004ad760d7bceace9e4cc0a9b51671e042650a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4222f0ff9b9bf4aff321a25f56ac22092da1278691e93e52536fabcced72e9bde76b2fbaf24eae9adea3a8e7ead2b60552c0fd6d4395b8b9694a2fcb2eb21e3f
|
7
|
+
data.tar.gz: 0ad4e566eb00ff88065590a3f110a7c5a9d983dac5b39dfc8a30e2e38fcc9d1c5ebab09d2a30de1f04588895aa6cc21e5776fce1002f317969e2a736d057ecab
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Create ENV variables for:
|
|
30
30
|
ENV['TEST_KALIXA_API_USER'] # Test Api User
|
31
31
|
ENV['TEST_KALIXA_API_PASSWORD'] # Test Api Password
|
32
32
|
|
33
|
-
ENV['
|
33
|
+
ENV['KALIXA_API_MODE'] # If is NOT 'production' all requests will use test user / password and the test api url.
|
34
34
|
|
35
35
|
```
|
36
36
|
|
@@ -2,7 +2,7 @@ module KalixaApi
|
|
2
2
|
module V3
|
3
3
|
class HttpService
|
4
4
|
|
5
|
-
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password
|
5
|
+
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password, :api_mode
|
6
6
|
|
7
7
|
def initialize(username: nil, password: nil)
|
8
8
|
@kalixa_api_user = kalixa_api_user || KalixaApi.kalixa_api_user
|
@@ -10,7 +10,7 @@ module KalixaApi
|
|
10
10
|
@test_kalixa_api_user = test_kalixa_api_user || KalixaApi.test_kalixa_api_user
|
11
11
|
@test_kalixa_api_password = test_kalixa_api_password || KalixaApi.test_kalixa_api_password
|
12
12
|
|
13
|
-
@
|
13
|
+
@api_mode = api_mode || KalixaApi.api_mode
|
14
14
|
end
|
15
15
|
|
16
16
|
def connection
|
@@ -32,14 +32,14 @@ module KalixaApi
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def post_request(url, data, xml_root)
|
35
|
-
if @
|
36
|
-
|
35
|
+
if @api_mode
|
36
|
+
connection.post do |req|
|
37
37
|
req.url url
|
38
38
|
req.headers['Content-Type'] = 'application/xml; charset=utf-8'
|
39
39
|
req.body = data.to_xml(:root => xml_root)
|
40
40
|
end
|
41
41
|
else
|
42
|
-
|
42
|
+
test_conection.post do |req|
|
43
43
|
req.url url
|
44
44
|
req.headers['Content-Type'] = 'application/xml; charset=utf-8'
|
45
45
|
req.body = data.to_xml(:root => xml_root)
|
@@ -49,14 +49,14 @@ module KalixaApi
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def get_request(url, data, xml_root)
|
52
|
-
if @
|
53
|
-
|
52
|
+
if @api_mode
|
53
|
+
connection.get do |req|
|
54
54
|
req.url url
|
55
55
|
req.headers['Content-Type'] = 'application/xml; charset=utf-8'
|
56
56
|
req.body = data.to_xml(:root => xml_root)
|
57
57
|
end
|
58
58
|
else
|
59
|
-
|
59
|
+
test_conection.get do |req|
|
60
60
|
req.url url
|
61
61
|
req.headers['Content-Type'] = 'application/xml; charset=utf-8'
|
62
62
|
req.body = data.to_xml(:root => xml_root)
|
@@ -2,7 +2,7 @@ module KalixaApi
|
|
2
2
|
module V4
|
3
3
|
class HttpService
|
4
4
|
|
5
|
-
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password, :
|
5
|
+
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password, :api_mode
|
6
6
|
|
7
7
|
def initialize(username: nil, password: nil)
|
8
8
|
@kalixa_api_user = kalixa_api_user || KalixaApi.kalixa_api_user
|
@@ -10,7 +10,7 @@ module KalixaApi
|
|
10
10
|
@test_kalixa_api_user = test_kalixa_api_user || KalixaApi.test_kalixa_api_user
|
11
11
|
@test_kalixa_api_password = test_kalixa_api_password || KalixaApi.test_kalixa_api_password
|
12
12
|
|
13
|
-
@
|
13
|
+
@api_mode = api_mode || KalixaApi.api_mode
|
14
14
|
end
|
15
15
|
|
16
16
|
def connection
|
@@ -34,7 +34,7 @@ module KalixaApi
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def post_request(url, data = {})
|
37
|
-
if @
|
37
|
+
if @api_mode
|
38
38
|
test_conection.post do |req|
|
39
39
|
req.url url
|
40
40
|
req.headers['Content-Type'] = 'application/json'
|
@@ -50,7 +50,7 @@ module KalixaApi
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def get_request(url, data = {})
|
53
|
-
if @
|
53
|
+
if @api_mode
|
54
54
|
test_conection.get do |req|
|
55
55
|
req.url url
|
56
56
|
req.headers['Content-Type'] = 'application/json'
|
data/lib/kalixa_api/version.rb
CHANGED
data/lib/kalixa_api.rb
CHANGED
@@ -11,7 +11,7 @@ require 'kalixa_api/v4/merchant'
|
|
11
11
|
|
12
12
|
module KalixaApi
|
13
13
|
class << self
|
14
|
-
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password, :
|
14
|
+
attr_accessor :kalixa_api_user, :kalixa_api_password, :test_kalixa_api_user, :test_kalixa_api_password, :api_mode
|
15
15
|
end
|
16
16
|
|
17
17
|
self.kalixa_api_user ||= ENV['KALIXA_API_USER']
|
@@ -20,5 +20,5 @@ module KalixaApi
|
|
20
20
|
self.test_kalixa_api_user ||= ENV['TEST_KALIXA_API_USER']
|
21
21
|
self.test_kalixa_api_password ||= ENV['TEST_KALIXA_API_PASSWORD']
|
22
22
|
|
23
|
-
self.
|
23
|
+
self.api_mode ||= (ENV['KALIXA_API_MODE'].downcase == 'production')
|
24
24
|
end
|