Class: Cupid::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/cupid/server.rb

Constant Summary collapse

INPUT_NAMES =
{
  :version_info       => 'VersionInfoRequestMsg',
  :get_system_status  => 'SystemStatusRequestMsg',
  :retrieve           => 'RetrieveRequestMsg',
  :schedule           => 'ScheduleRequestMsg',
  :create             => 'CreateRequest',
  :delete             => 'DeleteRequest',
  :update             => 'UpdateRequest'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account) ⇒ Server

Returns a new instance of Server.



15
16
17
# File 'lib/cupid/server.rb', line 15

def initialize()
  @account = 
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



13
14
15
# File 'lib/cupid/server.rb', line 13

def 
  @account
end

Instance Method Details

#emails(ids) ⇒ Object



54
55
56
# File 'lib/cupid/server.rb', line 54

def emails(ids)
  objects 'Email', ids.map {|it| { 'ID' => it }}
end

#filter(field, operator, value) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cupid/server.rb', line 23

def filter(field, operator, value)
  return {} unless value
  {
    :filter => {
      :property => field,
      :simple_operator => operator,
      :value => value
    },
    :attributes! => {
      :filter => { 'xsi:type' => 'SimpleFilterPart' }
    }
  }
end

#folders(ids) ⇒ Object



58
59
60
# File 'lib/cupid/server.rb', line 58

def folders(ids)
  objects 'DataFolder', ids.map {|it| { 'ID' => it }}
end

#input(action) ⇒ Object



19
20
21
# File 'lib/cupid/server.rb', line 19

def input(action)
  [INPUT_NAMES.fetch(action), { :xmlns => Cupid::NAMESPACE }]
end

#object(type, options) ⇒ Object



50
51
52
# File 'lib/cupid/server.rb', line 50

def object(type, options)
  objects type, [options]
end

#objects(type, objects) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cupid/server.rb', line 37

def objects(type, objects)
  {
    :objects => objects.map {|object|
      {
        :client => { 'ID' =>  },
      }.merge(object)
    },
    :attributes! => {
      :objects => { 'xsi:type' => type }
    }
  }
end