Class: ParameterBuilders::GetRecordList

Inherits:
Base
  • Object
show all
Defined in:
lib/drebedengi/parameter_builders/get_record_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concerns::TypeFormatters

#soap_date

Constructor Details

#initialize(id_list: nil, period_from: nil, period_to: nil) ⇒ GetRecordList

Returns a new instance of GetRecordList.



5
6
7
8
9
# File 'lib/drebedengi/parameter_builders/get_record_list.rb', line 5

def initialize(id_list: nil, period_from: nil, period_to: nil)
  @id_list     = id_list
  @period_from = period_from
  @period_to   = period_to
end

Instance Attribute Details

#id_listObject (readonly)

Returns the value of attribute id_list.



3
4
5
# File 'lib/drebedengi/parameter_builders/get_record_list.rb', line 3

def id_list
  @id_list
end

#period_fromObject (readonly)

Returns the value of attribute period_from.



3
4
5
# File 'lib/drebedengi/parameter_builders/get_record_list.rb', line 3

def period_from
  @period_from
end

#period_toObject (readonly)

Returns the value of attribute period_to.



3
4
5
# File 'lib/drebedengi/parameter_builders/get_record_list.rb', line 3

def period_to
  @period_to
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/drebedengi/parameter_builders/get_record_list.rb', line 11

def to_s

  builder.apiId({ 'xsi:type' => 'xsd:string' }, 'demo_api')
  builder.({ 'xsi:type' => 'xsd:string' }, '[email protected]')
  builder.pass({ 'xsi:type' => 'xsd:string' }, 'demo')

  builder.params('xsi:type' => 'ns2:Map') do

    boolean_param('is_report', false)
    if period_from && period_to
      date_param('period_from', period_from)
      date_param('period_to', period_to)
      integer_param('r_period', 0)
    else
      integer_param('r_period', 1)
    end
    integer_param('r_how', 1) # detailed, no grouping

    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'is_show_duty')
    #   builder.value({'xsi:type' => 'xsd:boolean'}, true)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_period')
    #   builder.value({'xsi:type' => 'xsd:int'}, 8)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_how')
    #   builder.value({'xsi:type' => 'xsd:int'}, 1)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_what')
    #   builder.value({'xsi:type' => 'xsd:int'}, 6)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_currency')
    #   builder.value({'xsi:type' => 'xsd:int'}, 0)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_is_place')
    #   builder.value({'xsi:type' => 'xsd:int'}, 0)
    # end
    # builder.item do
    #   builder.key({'xsi:type' => 'xsd:string'}, 'r_is_tag')
    #   builder.value({'xsi:type' => 'xsd:int'}, 0)
    # end
  end

  if id_list
    builder.idList('xsi:type' => 'SOAP-ENC:Array') do
      id_list.each do |id|
        builder.item({ 'xsi:type' => 'xsd:string' }, id.to_s)
      end
    end
    # else
    #   builder.idList('xsi:nil' => 'true')
  end

  builder.target!
end