Method: Medea::JasonBase#load_from_jasondb

Defined in:
lib/medea/jason_base.rb

#load_from_jasondbObject

fetches the data from the JasonDB



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/medea/jason_base.rb', line 128

def load_from_jasondb
  #because this object might be owned by another, we need to search by key.
  #not passing a format to the query is a shortcut to getting just the object.
  url = to_url
  
  response = RestClient.get url
  @__jason_data = JSON.parse response
  @__jason_etag = response.headers[:etag]
  @__jason_timestamp = response.headers[:timestamp]
  if response.headers[:http_x_permissions]
    @public = []
    response.headers[:http_x_permissions].match /PUBLIC:\[([A-Z]+)(,[A-Z]+)*\]/ do |m|
      m.captures.each do |c|
        @public << c.slice(/[A-Z]+/)
      end
    end
  end
  @__jason_state = :stale
end