Code Monkey home page Code Monkey logo

calcium's Introduction

Calcium

Korea School Meal Information API

Usage

  • callback gets 2 arguments: (error, data)
    • error: String, presents error.
    • data: Array of Object, contains data.
  • calcium.find(gov, query, callback)
    • gov is domain prefix or city name in English (seoul) or Korean (서울).
  • calcium.get(code[, year, month], callback)
    • code is a school code.

Example

> calcium = require('calcium')
>
> calcium.find('서울', '린인', (e, d) => console.log(d) )
>
[ { name: '선린인터넷고등학교',
    code: 'B100000658',
    type: '고등학교',
    address: '서울특별시 용산구 청파동3가' } ]
>
> calcium.get('B100000658', 2016, 8, (e, d) => console.log(d) )
>
[
  ...
  { lunch: [ '흑미밥', '참치김치찌개', '양념깻잎', '소고기버섯볶음', '부들어묵볶음', '포기김치' ],
    dinner: [ '렌틸콩밥', '동태찌개', '순대야채볶음', '계란말이', '포기김치', '(음료) 과일맛음료 2' ] },
  { lunch: [ '수수밥', '콩비지찌개', '탕평채', '참나물무침', '오리야채볶음', '포기김치' ],
    dinner: [ '소고기야채볶음밥', '함박스테이크', '포기김치', '크림스프', '(음료) 과일맛음료 1', '마카로니샐러드' ] },
  { lunch: [ '칼슘쌀밥', '갈비탕', '계란찜', '만두강정', '깍두기', '자두' ],
    dinner: [ '클로렐라쌀밥', '닭곰탕', '알감자조림', '양념떡꼬치', '임연수구이', '포기김치' ] },
  { lunch: [ '칼슘쌀밥', '감자탕', '청경채무침', '언양식파채불고기', '포기김치', '찐옥수수' ],
    dinner: [ '고추장불고기주먹밥', '잔치국수', '다시마튀각', '포기김치', '햄또띠아' ] },
  ...
]
>

calcium's People

Contributors

danue1 avatar helloworld017 avatar hibiyasleep avatar hoto-cocoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

calcium's Issues

일부 학교에 대해 에러 발생

경기, 교find Method를 사용할 시 다음과 같은 에러가 발생합니다.

[REMOVED]\node_modules\calcium\src\find.js:22
    const foundData = body.resultSVO.orgDVOList
                                     ^

TypeError: Cannot read property 'orgDVOList' of undefined
    at Request.request [as _callback] ([REMOVED]\node_modules\calcium\src\find.js:22:38)
    at Request.self.callback ([REMOVED]\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> ([REMOVED]\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> ([REMOVED]\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

제주, 제주대학교사범대학부설중학교find Method를 사용한 결과값으로 get Method를 사용할 시 다음과 같은 에러가 발생합니다.

[REMOVED]\node_modules\calcium\src\get.js:13
    throw new TypeError('Invalid or unknown code: '+ school)
    ^

TypeError: Invalid or unknown code: A000003567
    at Object.fetchSchoolMeal [as get] ([REMOVED]\node_modules\calcium\src\get.js:13:11)
    at calcium.find ([REMOVED])
    at Request.request [as _callback] ([REMOVED]\node_modules\calcium\src\find.js:30:12)
    at Request.self.callback ([REMOVED]\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> ([REMOVED]\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> ([REMOVED]\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

find Method를 사용한 결과 값은 다음과 같습니다.

[ { name: '제주대학교사범대학부설중학교',
    code: 'A000003567',
    type: '중학교',
    address: '제주특별자치도 제주시 용담삼동' } ]

광주, 운남 등으로 find Method를 사용할 시 unable to verify the first certificate 에러가 발생합니다.

calcium-tweet bot

Hello.
I'm trying to make a twitter bot based on your module.

While i trying to make a twitter bot, I found a @SunrinMeal Twitter bot source code on your gist profile : https://gist.github.com/hibiyasleep/a29a1099147733d9d1e526d6671fa9c9

I modifie this source code and create the json file, but I did not get the OAuth to linking the twitter account.
2017-05-02 19-21-20

Could you tell me the structure of /home/hibiya/.calciumrc json file?

modified code

#!/usr/bin/env node

'use strict'

const calcium = require('calcium')
const moment = require('moment')
const fs = require('fs')
const T = require('twit')

const rc = JSON.parse(fs.readFileSync('calciumrc.json').toString())

let d = new Date()
let today = d.getDate()
let hour = d.getHours()

for(let id in rc.accounts) {
  let account = rc.accounts[id]
  let t = new T({
    consumer_key:         'consumer_key',
    consumer_secret:      'consumer_secret',
    access_token:         'access_token',
    access_token_secret:  'access_token_secret',
    timeout_ms:           60*1000,  // optional HTTP request timeout to apply to all requests.
    })

calciumrc.json code

{
    "account": {
        "id": {
            "school": "T100000124"
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.