embulk-input-healthplanet 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6559e9ab461422fdb84aae86853330560023ae9
4
- data.tar.gz: b67eb584c925f946fa95a2e038a2cf82dc389062
3
+ metadata.gz: 2f2a2c16bfdf1b6e9ebdcd2a01ee4bf6a48a82d0
4
+ data.tar.gz: 1e99aaf73f13477ccbc40fdbf5a4a073220c3c23
5
5
  SHA512:
6
- metadata.gz: f3f1233856605a544b0e10f74d26510c1f6b038f868fe0ca621a2716a41ffbaa6aeabb726fb54387e5f47c1e47007ad421361f81a559ac9e06a62bd0d59bdb3f
7
- data.tar.gz: c1c046e24a1f549b2d7185bf999814b97924946f6110640e91db0e31369389ec5547ac27091f578270ccd400588fdc82750ece5a2930072b7bed24ae5c31ca5f
6
+ metadata.gz: 042587852de58ce90660337b2d69b10f7b38bcc05885f8bacaa93e41fe04d0d0a4a039603a93bfde32aeb608d02a50cfba92d189bc27e4dccc979e1aff131267
7
+ data.tar.gz: 15896793d71eb08bf7df07f8bb0f55946e250278bdb72c0b9b670e36d9b174a2453d0de2ce48b040fed764f60eb31fa489121a0ade3682f924e3bfe50edffb65
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Healthplanet input plugin for Embulk
2
2
 
3
- Retrieve your innerscan data through Health Planet API v1.
3
+ Retrieve your data from [TANITA's Health Planet website](https://www.healthplanet.jp/) through Health Planet API v1.
4
4
 
5
5
  This plugin only supports 'innerscan' scope. Other scopes such as 'sphygmomanometer', 'pedometer' and 'smug' are not supported.
6
6
 
@@ -51,6 +51,11 @@ If only new records are required, please use -o option as follows:
51
51
  $ embulk run config.yml -o config.yml
52
52
  ```
53
53
 
54
+ ## Notice
55
+
56
+ Health Planet API ver. 1.0 does not export 'Body Water Mass' data. I reported this issue to TANITA. But with no word of thanks, they just replied that they did not fix this issue because this API was free. embulk-input-healthplanet therefore can not export the 'Body Water Mass' data, too.
57
+
54
58
  ## References
55
59
 
56
60
  * [Health Planet API Specification Ver. 1.0 (Japanese)](http://www.healthplanet.jp/apis/api.html)
61
+ * [Health Planet からデータをエクスポートするための embulk-input-healthplanet プラグイン - 無印吉澤](http://muziyoshiz.hatenablog.com/entry/2016/01/11/234921 "Health Planet からデータをエクスポートするための embulk-input-healthplanet プラグイン - 無印吉澤")
@@ -1,10 +1,10 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-healthplanet"
4
- spec.version = "1.0.0"
4
+ spec.version = "1.0.1"
5
5
  spec.authors = ["Masahiro Yoshizawa"]
6
6
  spec.summary = "Healthplanet input plugin for Embulk"
7
- spec.description = "Retrieve your innerscan data through Health Planet API v1."
7
+ spec.description = "Load records from Health Planet through Health Planet API v1."
8
8
  spec.email = ["muziyoshiz@gmail.com"]
9
9
  spec.licenses = ["MIT"]
10
10
  spec.homepage = "https://github.com/muziyoshiz/embulk-input-healthplanet"
@@ -4,6 +4,7 @@ require 'oga'
4
4
  require 'nkf'
5
5
  require 'json'
6
6
  require 'time'
7
+ require 'embulk/input/healthplanet_api/column'
7
8
 
8
9
  module Embulk
9
10
  module Input
@@ -46,18 +47,21 @@ module Embulk
46
47
  'next_from' => config.param('next_from', :string, :default => nil)
47
48
  }
48
49
 
50
+ lang = config.param('lang', :string, :default => 'en')
51
+ col = HealthplanetApi::Column.new(lang)
52
+
49
53
  columns = [
50
- Column.new(0, 'time', :timestamp),
51
- Column.new(1, 'model', :string),
52
- Column.new(2, 'weight', :double),
53
- Column.new(3, 'body fat %', :double),
54
- Column.new(4, 'muscle mass', :double),
55
- Column.new(5, 'muscle score', :long),
56
- Column.new(6, 'visceral fat level 2', :double),
57
- Column.new(7, 'visceral fat level 1', :long),
58
- Column.new(8, 'basal metabolic rate', :long),
59
- Column.new(9, 'metabolic age', :long),
60
- Column.new(10, 'estimated bone mass', :double),
54
+ Column.new(0, col.name(:time), :timestamp),
55
+ Column.new(1, col.name(:model), :string),
56
+ Column.new(2, col.name(:weight), :double),
57
+ Column.new(3, col.name(:body_fat), :double),
58
+ Column.new(4, col.name(:muscle_mass), :double),
59
+ Column.new(5, col.name(:muscle_score), :long),
60
+ Column.new(6, col.name(:visceral_fat2), :double),
61
+ Column.new(7, col.name(:visceral_fat1), :long),
62
+ Column.new(8, col.name(:metabolic_rate), :long),
63
+ Column.new(9, col.name(:metabolic_age), :long),
64
+ Column.new(10, col.name(:bone_mass), :double),
61
65
  # Not supported by Health Planet API Ver. 1.0
62
66
  # Column.new(11, 'body water mass', :string),
63
67
  ]
@@ -0,0 +1,62 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ module Embulk
4
+ module Input
5
+ module HealthplanetApi
6
+ class Column
7
+
8
+ def initialize(lang)
9
+ case lang.downcase
10
+ when 'ja', 'japanese'
11
+ @names = {
12
+ :time => '測定日時',
13
+ :model => 'モデル',
14
+ :weight => '体重',
15
+ :body_fat => '体脂肪率',
16
+ :muscle_mass => '筋肉量',
17
+ :muscle_score => '筋肉スコア',
18
+ :visceral_fat2 => '内臓脂肪レベル2',
19
+ :visceral_fat1 => '内臓脂肪レベル1',
20
+ :metabolic_rate => '基礎代謝量',
21
+ :metabolic_age => '体内年齢',
22
+ :bone_mass => '推定骨量',
23
+ }
24
+ when 'en', 'english'
25
+ @names = {
26
+ :time => 'time',
27
+ :model => 'model',
28
+ :weight => 'weight',
29
+ :body_fat => 'body fat %',
30
+ :muscle_mass => 'muscle mass',
31
+ :muscle_score => 'muscle score',
32
+ :visceral_fat2 => 'visceral fat level 2',
33
+ :visceral_fat1 => 'visceral fat level 1',
34
+ :metabolic_rate => 'basal metabolic rate',
35
+ :metabolic_age => 'metabolic age',
36
+ :bone_mass => 'estimated bone mass',
37
+ }
38
+ else
39
+ # returns as-is API tag
40
+ @names = {
41
+ :time => 'time',
42
+ :model => 'model',
43
+ :weight => '6021',
44
+ :body_fat => '6022',
45
+ :muscle_mass => '6023',
46
+ :muscle_score => '6024',
47
+ :visceral_fat2 => '6025',
48
+ :visceral_fat1 => '6026',
49
+ :metabolic_rate => '6027',
50
+ :metabolic_age => '6028',
51
+ :bone_mass => '6029',
52
+ }
53
+ end
54
+ end
55
+
56
+ def name(key)
57
+ @names[key]
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-healthplanet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Yoshizawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: embulk
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.0.0
97
- description: Retrieve your innerscan data through Health Planet API v1.
97
+ description: Load records from Health Planet through Health Planet API v1.
98
98
  email:
99
99
  - muziyoshiz@gmail.com
100
100
  executables: []
@@ -109,6 +109,7 @@ files:
109
109
  - Rakefile
110
110
  - embulk-input-healthplanet.gemspec
111
111
  - lib/embulk/input/healthplanet.rb
112
+ - lib/embulk/input/healthplanet_api/column.rb
112
113
  homepage: https://github.com/muziyoshiz/embulk-input-healthplanet
113
114
  licenses:
114
115
  - MIT