Class: Libis::Services::Rosetta::DepositHandler

Inherits:
Client
  • Object
show all
Defined in:
lib/libis/services/rosetta/deposit_handler.rb

Instance Attribute Summary

Attributes included from SoapClient

#client

Instance Method Summary collapse

Methods inherited from Client

#authenticate, #get_heart_bit, #pds_handle=

Methods included from SoapClient

#configure, #operations, #request

Constructor Details

#initialize(base_url = 'https://repository.teneo.libis.be', options = {}) ⇒ DepositHandler

Returns a new instance of DepositHandler.



12
13
14
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 12

def initialize(base_url = 'https://repository.teneo.libis.be', options = {})
  super 'deposit', 'DepositWebServices', {url: base_url}.merge(options)
end

Instance Method Details

#deposits(opts = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 29

def deposits(opts = {})
  options = opts.dup
  flow_id = options.delete :flow_id
  submit_date_from, submit_date_to = options.delete :submit_date
  submit_date_to ||= submit_date_from if submit_date_from
  update_date_from, update_date_to = options.delete :update_date
  update_date_to ||= update_date_from if update_date_from
  if submit_date_from
    if flow_id
      get_by_submit_flow submit_date_from, submit_date_to, flow_id, options
    else
      get_by_submit_date submit_date_from, submit_date_to, options
    end
  elsif update_date_from
    if flow_id
      get_by_update_flow update_date_from, update_date_to, flow_id, options
    else
      get_by_update_date update_date_from, update_date_to, options
    end
  else
    error "unsupported deposit query: #{opts}."
    []
  end
end

#get_by_submit_date(date_from, date_to, options = {}) ⇒ Object

  • status: Status of the deposit [All (default), In process, Rejected, Draft, Approved, Declined]

  • producer_id: optional, limits by producer_id

  • agent_id: optional, limits by agent_id

  • start_record: optional, pagination start

  • end_record: optional, pagination end

Parameters:

  • date_from (String)

    Start date for lookup range

  • date_to (String)

    End date for lookup range

  • options (Hash) (defaults to: {})

    optional string parameters limiting the search with:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 62

def get_by_submit_date(date_from, date_to, options = {})
  options = {
      status: 'All',
      producer_id: nil,
      agent_id: nil,
      start_record: nil,
      end_record: nil
  }.merge options
  params = {
      arg0: @pds_handle,
      arg1: options[:status],
      arg2: options[:producer_id],
      arg3: options[:agent_id],
      arg4: date_from,
      arg5: date_to,
      arg6: options[:start_record],
      arg7: options[:end_record]
  }.cleanup
  request_activities :get_deposit_activity_by_submit_date, params
end

#get_by_submit_flow(date_from, date_to, flow_id, options = {}) ⇒ Object

  • status: Status of the deposit [All (default), In process, Rejected, Draft, Approved, Declined]

  • producer_id: optional, limits by producer_id

  • agent_id: optional, limits by agent_id

  • start_record: optional, pagination start

  • end_record: optional, pagination end

Parameters:

  • date_from (String)

    Start date for lookup range

  • date_to (String)

    End date for lookup range

  • flow_id (Object)

    ID of the material flow used

  • options (Hash) (defaults to: {})

    optional string parameters limiting the search with:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 92

def get_by_submit_flow(date_from, date_to, flow_id, options = {})
  options = {
      status: 'All',
      producer_id: nil,
      agent_id: nil,
      start_record: nil,
      end_record: nil
  }.merge options
  params = {
      arg0: @pds_handle,
      arg1: options[:status],
      arg2: flow_id,
      arg3: options[:producer_id],
      arg4: options[:agent_id],
      arg5: date_from,
      arg6: date_to,
      arg7: options[:start_record],
      arg8: options[:end_record]
  }.cleanup
  request_activities :get_deposit_activity_by_submit_date_by_material_flow, params
end

#get_by_update_date(date_from, date_to, options = {}) ⇒ Object

  • status: Status of the deposit [All (default), In process, Rejected, Draft, Approved, Declined]

  • producer_id: optional, limits by producer_id

  • agent_id: optional, limits by agent_id

  • start_record: optional, pagination start

  • end_record: optional, pagination end

Parameters:

  • date_from (String)

    Start date for lookup range

  • date_to (String)

    End date for lookup range

  • options (Hash) (defaults to: {})

    optional string parameters limiting the search with:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 122

def get_by_update_date(date_from, date_to, options = {})
  options = {
      status: 'All',
      producer_id: nil,
      agent_id: nil,
      start_record: nil,
      end_record: nil
  }.merge options
  params = {
      arg0: @pds_handle,
      arg1: options[:status],
      arg2: options[:producer_id],
      arg3: options[:agent_id],
      arg4: date_from,
      arg5: date_to,
      arg6: options[:start_record],
      arg7: options[:end_record]
  }.cleanup
  request_activities :get_deposit_activity_by_update_date, params
end

#get_by_update_flow(date_from, date_to, flow_id, options = {}) ⇒ Object

  • status: Status of the deposit [All (default), In process, Rejected, Draft, Approved, Declined]

  • producer_id: optional, limits by producer_id

  • agent_id: optional, limits by agent_id

  • start_record: optional, pagination start

  • end_record: optional, pagination end

Parameters:

  • date_from (String)

    Start date for lookup range

  • date_to (String)

    End date for lookup range

  • flow_id (Object)

    ID of the material flow used

  • options (Hash) (defaults to: {})

    optional string parameters limiting the search with:



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 152

def get_by_update_flow(date_from, date_to, flow_id, options = {})
  options = {
      status: 'All',
      producer_id: nil,
      agent_id: nil,
      start_record: nil,
      end_record: nil
  }.merge options
  params = {
      arg0: @pds_handle,
      arg1: options[:status],
      arg2: flow_id,
      arg3: options[:producer_id],
      arg4: options[:agent_id],
      arg5: date_from,
      arg6: date_to,
      arg7: options[:start_record],
      arg8: options[:end_record]
  }.cleanup
  request_activities :get_deposit_activity_by_update_date_by_material_flow, params
end

#submit(flow_id, subdir, producer_id, deposit_set_id = '1') ⇒ Object

Parameters:

  • flow_id (Object)

    ID of the material flow used

  • subdir (Object)

    name of the load directory

  • producer_id (Object)

    ID of the Producer

  • deposit_set_id (Object) (defaults to: '1')

    ID of the set of deposits



20
21
22
23
24
25
26
27
# File 'lib/libis/services/rosetta/deposit_handler.rb', line 20

def submit(flow_id, subdir, producer_id, deposit_set_id = '1')
  call :submit_deposit_activity,
             arg0: @pds_handle,
             arg1: flow_id,
             arg2: subdir,
             arg3: producer_id,
             arg4: deposit_set_id
end