Module: RussianPost::OperationsFactory

Defined in:
lib/russianpost/operations_factory.rb

Class Method Summary collapse

Class Method Details

.build(operations_hash) ⇒ Object



8
9
10
11
# File 'lib/russianpost/operations_factory.rb', line 8

def build(operations_hash)
  @country_list = Iso3166Ru
  operations_hash.map { |o| build_operation(o) }
end

.build_operation(operation_hash) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/russianpost/operations_factory.rb', line 13

def build_operation(operation_hash)
  operation = RussianPost::Operation.new
  ungroup_parameters(operation_hash).each do |key, value|
    operation[key] = process_param(key, value)
  end

  operation
end