Module: NodeInfo

Defined in:
lib/node_info.rb

Defined Under Namespace

Classes: Document

Class Method Summary collapse

Class Method Details

.build(&block) ⇒ Object


164
165
166
# File 'lib/node_info.rb', line 164

def self.build(&block)
  Document.build(&block)
end

.jrd(endpoint) ⇒ Object


168
169
170
171
172
173
174
175
176
177
# File 'lib/node_info.rb', line 168

def self.jrd(endpoint)
  {
    "links" => VERSIONS.map {|version|
      {
        "rel"  => "http://nodeinfo.diaspora.software/ns/schema/#{version}",
        "href" => endpoint % {version: version}
      }
    }
  }
end

.schema(version) ⇒ Object

rubocop:enable Metrics/BlockLength


158
159
160
161
162
# File 'lib/node_info.rb', line 158

def self.schema(version)
  SCHEMAS[version] ||= JSON.parse(
    Pathname.new(__dir__).join("..", "vendor", "nodeinfo", "schemas", "#{version}.json").expand_path.read
  )
end

.supported_version?(version) ⇒ Boolean

Returns:

  • (Boolean)

179
180
181
# File 'lib/node_info.rb', line 179

def self.supported_version?(version)
  VERSIONS.include? version
end