Sha256: d736d7da22b7a6ecc0151c95367ab0dfb49670233d2136b8022afcf8df00bc30

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

require "adyen-admin/skin"

module Adyen
  module Admin
    module Client
      LOGIN       = "https://ca-test.adyen.com/ca/ca/login.shtml"
      DASHBOARD   = "https://ca-test.adyen.com/ca/ca/overview/default.shtml"

      def login(accountname, username, password)
        page = Adyen::Admin.client.get(LOGIN)
        page = Adyen::Admin.client.submit(page.form.tap do |form|
          form.j_account  = accountname
          form.j_username  = username
          form.j_password = password
        end)
        raise "Wrong username + password combination" if page.uri.to_s != DASHBOARD
      end

      def client
        @agent ||= Mechanize.new
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adyen-admin-0.0.1 lib/adyen-admin/client.rb