Class: Services::ServiceImplementation

Inherits:
Object
  • Object
show all
Defined in:
app/models/services/service_implementation.rb

Direct Known Subclasses

Hl7InboundService, MdsPull, MdsPush

Instance Attribute Summary collapse

Instance Method Summary collapse

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_definitionObject (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 ()
  AccountMapping.where(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 = #{}" if am.blank?
  end
end

#server_credentialsObject

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