Coder Social home page Coder Social logo

notion-model's Introduction

Notion::Rb

一个能让你像ActiveModel一样增删改查Notion中的Databases和Pages的RubyGem

安装

依赖:

  • Ruby >= 2.6

安装命令:

gem install notion-rb

或在Gemfile中增加

gem 'notion-rb'

然后执行

bundle install

使用

# 先做好必要配置
Notion.config.token = 'YOUR_NOTION_TOKEN'

# 或者
Notion.configure do |config|
  config.token = "YOUR_NOTION_TOKEN"
end

# 参考ActiveRecord处理数据的方法,以面向对象的方式操作数据
database = Notion::Database.find(your_database_id)

# 由于不同Database下的Page都可能有不同的属性
# 因此每个Page实例中的属性在获得pages时动态生成
pages = database.pages

# 把提供的选项转换为等价的JSON Query结构体
# 触发Http请求并从Response中检索对应的结果
# 为每个查询结果实例化对应的模型对象
some_pages = pages.where(options)

notion-model's People

Contributors

helloevenzhang avatar

Stargazers

Tuan Duc Tran avatar Baptiste ARRECOT avatar Lukas Krauter avatar  avatar

Watchers

 avatar

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.