Module: DistributedPress::V1::Social::Liquid

Defined in:
lib/jekyll/drops/activity_drop.rb

Instance Method Summary collapse

Instance Method Details

#to_hObject



25
26
27
28
29
30
31
32
33
# File 'lib/jekyll/drops/activity_drop.rb', line 25

def to_h
  if object.success?
    object.parsed_response.to_json
  else
    Jekyll.logger.warn 'ActivityPub:', "Couldn't download #{object.request.uri} (Status: #{object.code})"

    {}
  end
end

#to_jsonObject



39
40
41
42
43
44
45
46
47
# File 'lib/jekyll/drops/activity_drop.rb', line 39

def to_json
  if object.success?
    object.parsed_response.to_json
  else
    Jekyll.logger.warn 'ActivityPub:', "Couldn't download #{object.request.uri} (Status: #{object.code})"

    object.request.uri
  end
end

#to_liquidObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jekyll/drops/activity_drop.rb', line 10

def to_liquid
  @to_liquid ||=
    begin
      if object.success?
        Jekyll::Drops::ActivityDrop.new(object: object.parsed_response)
      else
        Jekyll.logger.warn 'ActivityPub:', "Couldn't download #{object.request.uri} (Status: #{object.code})"
        {}
      end
    rescue Exception => e
      Jekyll.logger.warn 'ActivityPub:', "Couldn't download (Error: #{e.message})"
      {}
    end
end

#to_sObject



35
36
37
# File 'lib/jekyll/drops/activity_drop.rb', line 35

def to_s
  to_json
end