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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adad69958898d5b19f028c4dda90c2a927ff9d129ee0240fc5e916c2fe6632cd
4
- data.tar.gz: 9894c3757b455c4dcc7025988a8cd87a94ef80fce5cc520a881b9c0124db925e
3
+ metadata.gz: 54bdb65b9781cf6257d6d994ad99a9ae9b3831093c5e473baa663cac43a8293a
4
+ data.tar.gz: 419a20db82910f817f1eacfcfcc73899feae88703feac0bfb8bc42efcd0d4ed5
5
5
  SHA512:
6
- metadata.gz: 55278fb493ee5c3aff3e0413097eadbe0e6a857f8feeebf26565dd76f16d2e71c67222978abf092b21fc4b865f840be462b3db12d8c94b6422510e30f7216380
7
- data.tar.gz: 6f7e9addf3046979ed337ae8ab245e0728bdb80e5caabf955da4a3e44dadcf0f754c4f92123ef5cdc22867917254b5d4f522fed74fd52375e3958caae1ee1595
6
+ metadata.gz: 4eab31b3599574e562b769980505dc79e9850500d7e00612a27577eb4a561da788f86a9a9d374c0d9029410dce657cab6cb3afb923aa071e25f070514ee0851e
7
+ data.tar.gz: af69156f6d44b15d23fb148a28fadcd3b611fdd52d153601782e99cf3095b681b1ade6092dec6c320504d2ed8616ff80199122024fbe4f8350552b83ccc39d91
@@ -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: "#{Parsec.configuration.host}/NewAvailabilityServlet/#{RESOURCES[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 || Parsec.configuration.username
51
+ @integration&.parsec_username.presence || ParsecClient.configuration.username
50
52
  end
51
53
 
52
54
  def password
53
- @integration&.parsec_password.presence || Parsec.configuration.password
55
+ @integration&.parsec_password.presence || ParsecClient.configuration.password
54
56
  end
55
57
 
56
58
  def context
57
- Parsec.configuration.context
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
@@ -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.10
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/parsec/version.rb
50
+ - lib/parsec_client.rb
52
51
  homepage:
53
52
  licenses: []
54
53
  metadata: {}
@@ -1,15 +0,0 @@
1
- require 'parsec/configuration'
2
-
3
- class Parsec
4
- def self.configuration
5
- @configuration ||= Configuration.new
6
- end
7
-
8
- def self.reset
9
- @configuration = Configuration.new
10
- end
11
-
12
- def self.configure
13
- yield configuration
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- module Parsec
2
- class Version
3
- VERSION = '0.0.10'.freeze
4
- end
5
- end