Class: Skala::AlephAdapter::GetRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/skala/aleph_adapter/get_record.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ GetRecord

Returns a new instance of GetRecord.



5
6
7
# File 'lib/skala/aleph_adapter/get_record.rb', line 5

def initialize(adapter)
  @adapter = adapter
end

Instance Method Details

#call(record_id) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/skala/aleph_adapter/get_record.rb', line 9

def call(record_id)
  get_record = @adapter.restful_api.record(record_id).get(view: :full)

  {
    "_type" => "record",
    "_id" => record_id,
    "fields" => {
      "record" => "#{get_record[/<?.*?>/]}#{WeakXml.find("<record>", get_record).to_s}"
    },
    "_source" => get_record
  }
end