Skip to content

Commit

Permalink
DRY configuration variables
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyKishenin committed Aug 12, 2014
1 parent c8e7ded commit dc7d340
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/rubykassa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def configure &block
Rubykassa::Client.configure &block
end

%w(login first_password second_password mode http_method xml_http_method success_callback fail_callback result_callback).map do |name|
Rubykassa::Configuration::ATTRIBUTES.map do |name|
define_method name do
Rubykassa::Client.configuration.send(name)
end
Expand Down
10 changes: 6 additions & 4 deletions lib/rubykassa/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# -*- encoding : utf-8 -*-
module Rubykassa
class Configuration
attr_accessor :login, :first_password, :second_password, :mode, :http_method, :xml_http_method
attr_accessor :success_callback
attr_accessor :fail_callback
attr_accessor :result_callback
ATTRIBUTES = [
:login, :first_password, :second_password, :mode, :http_method, :xml_http_method,
:success_callback, :fail_callback, :result_callback
]

attr_accessor *ATTRIBUTES

def initialize
self.login = "your_login"
Expand Down

0 comments on commit dc7d340

Please sign in to comment.