Class: HotelBeds::Action::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/hotel_beds/action/operation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Operation



32
33
34
# File 'lib/hotel_beds/action/operation.rb', line 32

def initialize(*args)
  self.request = self.class.request_class.new(*args)
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



29
30
31
# File 'lib/hotel_beds/action/operation.rb', line 29

def errors
  @errors
end

#requestObject

Returns the value of attribute request.



29
30
31
# File 'lib/hotel_beds/action/operation.rb', line 29

def request
  @request
end

#responseObject

Returns the value of attribute response.



29
30
31
# File 'lib/hotel_beds/action/operation.rb', line 29

def response
  @response
end

Class Method Details

.envelope_class(value = nil) ⇒ Object



24
25
26
27
# File 'lib/hotel_beds/action/operation.rb', line 24

def self.envelope_class(value = nil)
  @envelope_class = value if value
  @envelope_class
end

.remote_method(value = nil) ⇒ Object



4
5
6
7
# File 'lib/hotel_beds/action/operation.rb', line 4

def self.remote_method(value = nil)
  @remote_method = value if value
  @remote_method
end

.remote_namespace(value = nil) ⇒ Object



9
10
11
12
# File 'lib/hotel_beds/action/operation.rb', line 9

def self.remote_namespace(value = nil)
  @remote_namespace = value if value
  @remote_namespace
end

.request_class(value = nil) ⇒ Object



14
15
16
17
# File 'lib/hotel_beds/action/operation.rb', line 14

def self.request_class(value = nil)
  @request_class = value if value
  @request_class
end

.response_class(value = nil) ⇒ Object



19
20
21
22
# File 'lib/hotel_beds/action/operation.rb', line 19

def self.response_class(value = nil)
  @response_class = value if value
  @response_class
end

Instance Method Details

#perform(connection:) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/hotel_beds/action/operation.rb', line 36

def perform(connection:)
  if request.valid?
    self.response = self.class.response_class.new(request, retrieve(connection))
    self.errors = response.errors
  else
    self.errors = request.errors
  end
  freeze
  self
end