Class: FHIR::SubscriptionChannel
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::SubscriptionChannel
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/subscription_channel.rb
Overview
fhir/subscription_channel.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = SubscriptionChannel.new) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/fhir/subscription_channel.rb', line 40 def self.transform_json(json_hash, target = SubscriptionChannel.new) result = self.superclass.transform_json(json_hash, target) result['type'] = SubscriptionChannelType.transform_json(json_hash['type'], json_hash['_type']) unless json_hash['type'].nil? result['endpoint'] = PrimitiveUrl.transform_json(json_hash['endpoint'], json_hash['_endpoint']) unless json_hash['endpoint'].nil? result['payload'] = MimeType.transform_json(json_hash['payload'], json_hash['_payload']) unless json_hash['payload'].nil? result['header'] = json_hash['header'].each_with_index.map do |var, i| extension_hash = json_hash['_header'] && json_hash['_header'][i] PrimitiveString.transform_json(var, extension_hash) end unless json_hash['header'].nil? result end |
Instance Method Details
#as_json(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/fhir/subscription_channel.rb', line 10 def as_json(*args) result = super unless self.type.nil? result['type'] = self.type.value serialized = Extension.serializePrimitiveExtension(self.type) result['_type'] = serialized unless serialized.nil? end unless self.endpoint.nil? result['endpoint'] = self.endpoint.value serialized = Extension.serializePrimitiveExtension(self.endpoint) result['_endpoint'] = serialized unless serialized.nil? end unless self.payload.nil? result['payload'] = self.payload.value serialized = Extension.serializePrimitiveExtension(self.payload) result['_payload'] = serialized unless serialized.nil? end unless self.header.nil? || !self.header.any? result['header'] = self.header.compact().map{ |x| x.value } serialized = Extension.serializePrimitiveExtensionArray(self.header) result['_header'] = serialized unless serialized.nil? || !serialized.any? end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |