Sha256: 4134af08f209e6232afc92f101f19bb2e0dd379b420046085d83c36c9a521342

Contents?: true

Size: 688 Bytes

Versions: 24

Compression:

Stored size: 688 Bytes

Contents

module Moneta
  module Api
    class Service
      DEMO = 'https://demo.moneta.ru/services.wsdl'
      PRODUCTION = 'https://www.moneta.ru/services.wsdl'

      include ServiceMethods
      attr_reader :client

      def initialize(username, password, params = {})
        @client = Savon.client(prepare_params(username, password, params))
      end

      private

      def prepare_params(username, password, params)
        demo_mode = params.delete(:demo_mode)

        { wsse_auth: [ username, password ] }
          .merge(params)
          .merge(wsdl: wsdl_url(demo_mode))
      end

      def wsdl_url(demo_mode)
        demo_mode ? DEMO : PRODUCTION
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
moneta-api-1.12.7 lib/moneta/api/service.rb
moneta-api-1.12.6 lib/moneta/api/service.rb
moneta-api-1.12.5 lib/moneta/api/service.rb
moneta-api-1.12.4 lib/moneta/api/service.rb
moneta-api-1.12.3 lib/moneta/api/service.rb
moneta-api-1.12.2 lib/moneta/api/service.rb
moneta-api-1.12.1 lib/moneta/api/service.rb
moneta-api-1.12.0 lib/moneta/api/service.rb
moneta-api-1.11.0 lib/moneta/api/service.rb
moneta-api-1.10.0 lib/moneta/api/service.rb
moneta-api-1.9.0 lib/moneta/api/service.rb
moneta-api-1.8.0 lib/moneta/api/service.rb
moneta-api-1.7.0 lib/moneta/api/service.rb
moneta-api-1.6.0 lib/moneta/api/service.rb
moneta-api-1.5.0 lib/moneta/api/service.rb
moneta-api-1.4.0 lib/moneta/api/service.rb
moneta-api-1.3.0 lib/moneta/api/service.rb
moneta-api-1.2.1 lib/moneta/api/service.rb
moneta-api-1.2.0 lib/moneta/api/service.rb
moneta-api-1.1.0 lib/moneta/api/service.rb