kalixa_api 0.1.0 → 0.1.1

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: 7985a7d78b8a39c8ed95369189a78fa251be3868
4
- data.tar.gz: 811dc5e30757d6c16ea1409ad068dee794013c82
3
+ metadata.gz: 2ba2e88ce0dbe8fdb2d1ed4a34eb04f76f1d5ad9
4
+ data.tar.gz: af004ad760d7bceace9e4cc0a9b51671e042650a
5
5
  SHA512:
6
- metadata.gz: 3e60cab933becc72427629baf0e0195ff914dfc7128b7ed0050e3f01bf5ed38e5193757f9187eb65b98d8b422329c5be9dc48969385a9128f4c4b10d7c8dbf06
7
- data.tar.gz: 06d83bf0a671f2916a7ae6a7f23664ec91704617275914491cf1ae803993f63936f31779909b975d5bc994c3ced1c0161f93b257724eb696b403f73bb50bd443
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['KALIXA_API_TEST_MODE'] # If is true all requests will use test user / password and the test api url.
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
- @api_test_mode = api_test_mode || KalixaApi.api_test_mode
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 @api_test_mode
36
- test_conection.post do |req|
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
- connection.post do |req|
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 @api_test_mode
53
- test_conection.get do |req|
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
- connection.get do |req|
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, :api_test_mode
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
- @api_test_mode = api_test_mode || KalixaApi.api_test_mode
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 @api_test_mode
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 @api_test_mode
53
+ if @api_mode
54
54
  test_conection.get do |req|
55
55
  req.url url
56
56
  req.headers['Content-Type'] = 'application/json'
@@ -1,3 +1,3 @@
1
1
  module KalixaApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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, :api_test_mode
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.api_test_mode ||= ENV['KALIXA_API_TEST_MODE']
23
+ self.api_mode ||= (ENV['KALIXA_API_MODE'].downcase == 'production')
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalixa_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugeniu Tambur