Class: PayTrace::Configuration
- Inherits:
-
Object
- Object
- PayTrace::Configuration
- Defined in:
- lib/paytrace/configuration.rb
Constant Summary collapse
- RESET_PASSWORD_METHOD =
"UpdatePassword"
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #update_password(params) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
7 8 9 10 11 |
# File 'lib/paytrace/configuration.rb', line 7 def initialize @domain = "paytrace.com" @connection = Faraday.new @path = "api/default.pay" end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
3 4 5 |
# File 'lib/paytrace/configuration.rb', line 3 def connection @connection end |
#domain ⇒ Object
Returns the value of attribute domain.
3 4 5 |
# File 'lib/paytrace/configuration.rb', line 3 def domain @domain end |
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/paytrace/configuration.rb', line 3 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/paytrace/configuration.rb', line 3 def path @path end |
#user_name ⇒ Object
Returns the value of attribute user_name.
3 4 5 |
# File 'lib/paytrace/configuration.rb', line 3 def user_name @user_name end |
Instance Method Details
#update_password(params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/paytrace/configuration.rb', line 13 def update_password(params) request = PayTrace::API::Request.new request.set_param(:method, RESET_PASSWORD_METHOD) request.set_param(:new_password, params[:new_password]) request.set_param(:new_password_confirmation, params[:new_password]) gateway = PayTrace::API::Gateway.new response = gateway.send_request(request) unless response.has_errors? PayTrace.configure do |config| config.password = params[:new_password] end end response end |
#url ⇒ Object
30 31 32 |
# File 'lib/paytrace/configuration.rb', line 30 def url "https://#{@domain}/#{@path}" end |