Class: Cfan122::Operation

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

Defined Under Namespace

Classes: Request, Response, ResponseError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Operation

Returns a new instance of Operation.



8
9
10
# File 'lib/cfan122/operation.rb', line 8

def initialize options = {}
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/cfan122/operation.rb', line 6

def options
  @options
end

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/cfan122/operation.rb', line 6

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/cfan122/operation.rb', line 6

def response
  @response
end

Class Method Details

.execute(options = {}) ⇒ Object



12
13
14
# File 'lib/cfan122/operation.rb', line 12

def self.execute options = {}
  self.new(options).execute
end

Instance Method Details

#executeObject



16
17
18
19
20
# File 'lib/cfan122/operation.rb', line 16

def execute
  @request = self.class::Request.new(options)
  @response = self.class::Response.new(@request)
  @response.body
end