Class: Services::ServiceImplementation
- Inherits:
-
Object
- Object
- Services::ServiceImplementation
- Defined in:
- app/models/services/service_implementation.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#service_definition ⇒ Object
readonly
Returns the value of attribute service_definition.
Instance Method Summary collapse
- #account_map(account_id) ⇒ Object
-
#initialize(srv_def) ⇒ ServiceImplementation
constructor
A new instance of ServiceImplementation.
-
#server_credentials ⇒ Object
Returns the credentials assocated with this service definition’s server.
Constructor Details
#initialize(srv_def) ⇒ ServiceImplementation
Returns a new instance of ServiceImplementation.
7 8 9 |
# File 'app/models/services/service_implementation.rb', line 7 def initialize(srv_def) @service_definition = srv_def end |
Instance Attribute Details
#service_definition ⇒ Object (readonly)
Returns the value of attribute service_definition.
5 6 7 |
# File 'app/models/services/service_implementation.rb', line 5 def service_definition @service_definition end |
Instance Method Details
#account_map(account_id) ⇒ Object
20 21 22 23 24 25 |
# File 'app/models/services/service_implementation.rb', line 20 def account_map(account_id) AccountMapping.where(account_id: account_id, third_party_id: service_definition.third_party_id).first.tap do |am| raise "No account mapping associated with #{service_definition.to_rrepr} and account_id = #{account_id}" if am.blank? end end |
#server_credentials ⇒ Object
Returns the credentials assocated with this service definition’s server
14 15 16 17 18 |
# File 'app/models/services/service_implementation.rb', line 14 def server_credentials (@credentials ||= service_definition.credentials.first).tap do | cred | raise "No credentials configured for server: (#{service_definition.to_rrepr})" if cred.blank? end end |