Class: ZuoraConnect::AppInstance
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ZuoraConnect::AppInstance
- Defined in:
- app/models/zuora_connect/app_instance.rb
Instance Attribute Summary collapse
-
#logins ⇒ Object
Returns the value of attribute logins.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#options ⇒ Object
Returns the value of attribute options.
-
#pass ⇒ Object
Returns the value of attribute pass.
-
#user ⇒ Object
Returns the value of attribute user.
-
#valid ⇒ Object
Returns the value of attribute valid.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#logins ⇒ Object
Returns the value of attribute logins.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def logins @logins end |
#mode ⇒ Object
Returns the value of attribute mode.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def mode @mode end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def @options end |
#pass ⇒ Object
Returns the value of attribute pass.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def pass @pass end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def user @user end |
#valid ⇒ Object
Returns the value of attribute valid.
3 4 5 |
# File 'app/models/zuora_connect/app_instance.rb', line 3 def valid @valid end |
Class Method Details
.decrypt_response(resp) ⇒ Object
37 38 39 |
# File 'app/models/zuora_connect/app_instance.rb', line 37 def self.decrypt_response(resp) OpenSSL::PKey::RSA.new(ZuoraConnect.configuration.private_key).private_decrypt(resp) end |
Instance Method Details
#new_session(user, password) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/zuora_connect/app_instance.rb', line 5 def new_session(user, password) @user = user @password = password response = JSON.parse(HTTParty.get(ZuoraConnect.configuration.url + "/api/v1/tools/tasks/#{self.id}.json",:basic_auth => auth = {:username => user, :password => password}).body) @mode = response["mode"] @options = Hash.new @logins = Hash.new response.each do |k,v| if k.match(/^(.*)_login$/) @logins[k] = v elsif k == "options" v.each do |opt| @options[opt["config_name"]] = opt end end end @valid = true end |
#send_email ⇒ Object
33 34 35 |
# File 'app/models/zuora_connect/app_instance.rb', line 33 def send_email end |
#updateOption(optionId, value) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/zuora_connect/app_instance.rb', line 24 def updateOption(optionId, value) if @user && @pass return HTTParty.get(ZuoraConnect.configuration.url + "/api/v1/tools/application_options/#{optionId}/edit?value=#{value}",:basic_auth => auth = {:username => user, :password => password}) else puts "Username or password is nil" return false end end |