Class: Exchanger::Operation

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

Overview

Abstract class for operations.

Exchange Web Services provides many operations that enable you to access information from the Exchanger store.

msdn.microsoft.com/en-us/library/bb409286.aspx

Direct Known Subclasses

CreateItem, DeleteItem, ExpandDL, FindFolder, FindItem, GetFolder, GetItem, ResolveNames, UpdateItem

Defined Under Namespace

Classes: Request, Response, ResponseError

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Operation) initialize(options = {})

A new instance of Operation



11
12
13
# File 'lib/exchanger/operation.rb', line 11

def initialize(options = {})
  @options = options
end

Instance Attribute Details

- (Object) options (readonly)

Returns the value of attribute options



9
10
11
# File 'lib/exchanger/operation.rb', line 9

def options
  @options
end

- (Object) request (readonly)

Returns the value of attribute request



9
10
11
# File 'lib/exchanger/operation.rb', line 9

def request
  @request
end

- (Object) response (readonly)

Returns the value of attribute response



9
10
11
# File 'lib/exchanger/operation.rb', line 9

def response
  @response
end

Class Method Details

+ (Object) run(options = {})

Shortcut for initialize and run.



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

def self.run(options = {})
  operation = self.new(options)
  operation.run
end

Instance Method Details

- (Object) run

Returns response



22
23
24
25
26
27
# File 'lib/exchanger/operation.rb', line 22

def run
  @request = self.class::Request.new(options)
  @response = self.class::Response.new(
    Exchanger::Client.new.request(@request.body, @request.headers)
  )
end