Class: GitHubMarkdownAPI::Raw

Inherits:
APIClient show all
Defined in:
lib/github_markdown_api/raw.rb

Overview

Client implementation of Markdown Raw API

Instance Attribute Summary

Attributes inherited from APIClient

#content_type, #endpoints, #host, #last_response, #port, #scheme

Instance Method Summary collapse

Methods inherited from APIClient

#initialize, render, #set_option

Constructor Details

This class inherits a constructor from GitHubMarkdownAPI::APIClient

Instance Method Details

#render(markdown) ⇒ String

Parameters:

  • markdown (String)

Returns:

  • (String)


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/github_markdown_api/raw.rb', line 5

def render(markdown)
  raw_uri = endpoint(:raw)

  headers = {
    'Content-Type' => @content_type
  }

  post = Net::HTTP::Post.new(raw_uri, headers)
  post.body = markdown

  request(raw_uri, post)
end