Created
May 17, 2015 03:01
-
-
Save takashicompany/879cc0f3e9e43c9dfd0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redcarpet' | |
# 式展開時に渡す変数 | |
version_name = "v1.1.0" | |
# Markdown形式でコンテンツを書く | |
markdown_text = | |
" | |
# Logfat #{version_name} | |
[はじめる](/login/twitter) | |
[タカシカンパニー](http://takashicompany.com) | |
## 体重や体脂肪率といったデーターを記録することができます | |
|種別|必須|hash | | |
|:---|:---|:---| | |
|体重(kg)|○|`weight` | |
|体脂肪率(%)|-|`body_fat_percentage`| | |
|内蔵脂肪レベル|-|`visceral_fat_level`| | |
|骨格筋率(&)|-|`skeletal_muscle_rate`| | |
|体年齢|-|`body_age`| | |
|基礎代謝(kcal)|-|`basal_metabolism`| | |
|BMI|-|`bmi`| | |
## 記録したデーターをAPIで取得することができます | |
上述のデーターをJSON形式で取得することができます。 | |
`http://logfat.herokuapp.com/api/list?twitter_nickname=<ツイッターアカウント名>` | |
### オプション | |
* `&row_count=<取得したい件数>`を末尾に追加で取得したい件数を指定 | |
* `&start_at=<YYYY-mm-dd HH:MM:SS>`を末尾に追加で取得開始日時を指定 | |
* `&end_at=<YYYY-mm-dd HH:MM:SS>`を末尾に追加で取得終了日時を指定 | |
### APIサンプル | |
* 最新の1件を取得する | |
[http://logfat.herokuapp.com/api/list?twitter_nickname=takashicompany](http://logfat.herokuapp.com/api/list?twitter_nickname=takashicompany) | |
* 件数、日時を指定 | |
[http://logfat.herokuapp.com/api/list?twitter_nickname=takashicompany&row_count=3&start_at=2015-02-09 10:00:00&end_at=2015-02-15 22:00:00](http://logfat.herokuapp.com/api/list?twitter_nickname=takashicompany&row_count=3&start_at=2015-02-09%2010:00:00&end_at=2015-02-15%2022:00:00) | |
## 日々のデーターを自動でツイートします | |
* 当日の体重と前回との差を毎日午前10:00に自動でツイート | |
 | |
* 当日分の体重を入力していないと怒られる | |
 | |
## 更新履歴 | |
* 2015/05/17: v1.1.0 | |
* サービスのデザインを修正 | |
* 2015/02/15: v1.0.0 | |
* Logfatを公開 | |
" | |
# Markdown形式のテキストをhtmlテキストに変換 | |
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :tables => true, :autolink => true) | |
body = markdown.render(markdown_text) | |
# html化したMarkdownをbodyタグ内に挿入する & headerタグやcssを設定する | |
html = | |
" | |
<!doctype html> | |
<html lang='en'> | |
<head> | |
<meta charset='UTF-8'> | |
<title>Logfat #{version_name}</title> | |
<link rel='stylesheet' type='text/css' href='github.css'> | |
</head> | |
<body> | |
#{body} | |
</body> | |
</html> | |
" | |
puts html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment