parsec_client 0.0.10 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parsec/request/base.rb +6 -8
- data/lib/parsec/request/order.rb +0 -4
- data/lib/parsec_client.rb +19 -0
- metadata +2 -3
- data/lib/parsec.rb +0 -15
- data/lib/parsec/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54bdb65b9781cf6257d6d994ad99a9ae9b3831093c5e473baa663cac43a8293a
|
4
|
+
data.tar.gz: 419a20db82910f817f1eacfcfcc73899feae88703feac0bfb8bc42efcd0d4ed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eab31b3599574e562b769980505dc79e9850500d7e00612a27577eb4a561da788f86a9a9d374c0d9029410dce657cab6cb3afb923aa071e25f070514ee0851e
|
7
|
+
data.tar.gz: af69156f6d44b15d23fb148a28fadcd3b611fdd52d153601782e99cf3095b681b1ade6092dec6c320504d2ed8616ff80199122024fbe4f8350552b83ccc39d91
|
data/lib/parsec/request/base.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'savon'
|
4
|
+
|
3
5
|
module Parsec
|
4
6
|
module Request
|
5
7
|
class Base
|
@@ -22,7 +24,7 @@ module Parsec
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def client(endpoint)
|
25
|
-
Savon.client endpoint: "#{
|
27
|
+
Savon.client endpoint: "#{ParsecClient.configuration.host}/NewAvailabilityServlet/#{RESOURCES[endpoint]}",
|
26
28
|
namespace: NAMESPACE,
|
27
29
|
convert_request_keys_to: :camelcase,
|
28
30
|
soap_header: security_tag
|
@@ -46,19 +48,15 @@ module Parsec
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def username
|
49
|
-
@integration&.parsec_username.presence ||
|
51
|
+
@integration&.parsec_username.presence || ParsecClient.configuration.username
|
50
52
|
end
|
51
53
|
|
52
54
|
def password
|
53
|
-
@integration&.parsec_password.presence ||
|
55
|
+
@integration&.parsec_password.presence || ParsecClient.configuration.password
|
54
56
|
end
|
55
57
|
|
56
58
|
def context
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
def logger
|
61
|
-
@my_logger ||= Logger.new("#{Rails.root}/log/parsec.log")
|
59
|
+
ParsecClient.configuration.context
|
62
60
|
end
|
63
61
|
end
|
64
62
|
end
|
data/lib/parsec/request/order.rb
CHANGED
@@ -72,8 +72,6 @@ module Parsec
|
|
72
72
|
response = client(:reservation).call('OTA_HotelResRQ', attributes: attributes, message: message)
|
73
73
|
if type == 'Booking'
|
74
74
|
request = client(:reservation).build_request('OTA_HotelResRQ', attributes: attributes, message: message)
|
75
|
-
logger.info('BOOKING REQUEST') { request }
|
76
|
-
logger.info('BOOKING RESPONSE') { response.http.body }
|
77
75
|
end
|
78
76
|
|
79
77
|
response.body
|
@@ -87,8 +85,6 @@ module Parsec
|
|
87
85
|
response = client(:cancel).call('OTA_CancelRQ', attributes: attributes, message: message)
|
88
86
|
if type == 'Cancel'
|
89
87
|
request = client(:reservation).build_request('OTA_HotelResRQ', attributes: attributes, message: message)
|
90
|
-
logger.info('CANCEL REQUEST') { request }
|
91
|
-
logger.info('CANCEL RESPONSE') { response.http.body }
|
92
88
|
end
|
93
89
|
|
94
90
|
response.body
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'parsec/configuration'
|
2
|
+
|
3
|
+
class ParsecClient
|
4
|
+
class << self
|
5
|
+
attr_accessor :configuration
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.configuration
|
9
|
+
@configuration ||= Parsec::Configuration.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.reset
|
13
|
+
@configuration = Parsec::Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configure
|
17
|
+
yield configuration
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsec_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kniazevych
|
@@ -30,7 +30,6 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- lib/parsec.rb
|
34
33
|
- lib/parsec/availability.rb
|
35
34
|
- lib/parsec/base.rb
|
36
35
|
- lib/parsec/city.rb
|
@@ -48,7 +47,7 @@ files:
|
|
48
47
|
- lib/parsec/request/location.rb
|
49
48
|
- lib/parsec/request/order.rb
|
50
49
|
- lib/parsec/request/region.rb
|
51
|
-
- lib/
|
50
|
+
- lib/parsec_client.rb
|
52
51
|
homepage:
|
53
52
|
licenses: []
|
54
53
|
metadata: {}
|
data/lib/parsec.rb
DELETED