Giter VIP home page Giter VIP logo

notion-ruby's Introduction

Hi there, I'm Dan.๐Ÿ‘‹

Davidson College Economics grad with a focus on Computer Science. Analyst @brexhq.

Previous work includes: Lead Engineer at Jam, Consultant at Wilbur Labs, Software Engineer at Stacauto, and Data Analyst and Data Engineer at Pathstream. Most of my professional projects are written in Ruby and Python, and most of my personal ones are written in Python.

  • ๐Ÿ”ญ Iโ€™m currently working on building public and internally-facing APIs with Django and Flask, live backend pipelines with Ruby and various APIs, and data-driven interfaces with JS, R, Python, and Ruby.
  • ๐ŸŒฑ Iโ€™m currently learning about AWS (lambda, ec2, S3, RDS, and more), various forms of user authentication (session storage vs. JWT), Google Cloud, Python design patterns, and how to build CLI's in Ruby and Python.
  • ๐Ÿ’ฌ Ask me about how I started coding, my recent professional projects, and what I plan to work on next.
  • ๐Ÿ“ซ How to reach me: [email protected]
  • ๐Ÿ˜„ Pronouns: he/him

notion-ruby's People

Contributors

codacy-badger avatar danmurphy1217 avatar nfilzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notion-ruby's Issues

add_row doesn't seem to work

Hey there! Thanks for this gem. I just gave it a shot and unfortunately it seems like add_row doesn't really work. I'm getting a response from Notion with PostgresNullConstraintError. I have a basic collection with Name property and I do:

page.add_row(Name: "Test")

I tried with different collections and different property names (ie "Title" or "title" but nothing works).

Am I doing something wrong or is it a bug?

Error when trying to write

Every time I try to write or do anything else than just reading Blocks terminal tells me that the method I'm trying to use doesn't exist. I have no Idea how to fix this, pls help! I'm quiet shit at coding though..

3.0.0 :095 > @page.title
 => "Telegram Test" 
3.0.0 :096"> @page.title = "hey!"
Traceback (most recent call last):
        4: from /Users/eumel/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `<main>'
        3: from /Users/eumel/.rvm/rubies/ruby-3.0.0/bin/irb:23:in `load'
        2: from /Users/eumel/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        1: from (irb):96:in `<main>'
NoMethodError (undefined method `title=' for #<NotionAPI::CollectionViewPage:0x00007ff141146308 @id="97967408-8a83-406c-8afe-32a1879ec3f4", @title="Telegram Test", @parent_id="bee0d234-4086-483d-9b1e-e1706ffccf5a", @collection_id="6cf1d6bf-a38d-433a-b203-330e3ab48337", @view_id="66f62fd8-86f9-4141-987a-767763fff159", @column_names=["Tags", "Name"]>)
Did you mean?  title
3.0.0 :097 > 

Crashes when property is a self-ref relation

If you have a property that is a relation to itself, then the following exception is raised:

NameError: `@related_to_tasks_(parent)' is not allowed as an instance variable name

Adding images doesn't work

Adding images doesn't work (By URL and with source file)

@page.create(NotionAPI::ImageBlock, file_url)

just creates an empty image block

Link block

Hey @danmurphy1217, thanks so much for your work on this gem! Do you have plans to add link blocks? If not, I can fork and try to add.

Failed to run method get_page

I installed the gem, and put this code into my seed file

require 'notion_api'
@client = NotionAPI::Client.new("...")
@page = @client.get_page("05624583c9f442dfa8413368a23ed869")

but when I run the file I get the error
the URL or ID passed to the get_page method must be that of a Page Block.
even though the token is correct, anf the page ID was copied directly from the view

Error in extract_collection_schema method

I am trying to add a column with the add_property method but it returns an error.
I am getting the same error when I call rows on collection.

irb(main):004:0> notion_page.add_property('TEST', 'url')
Traceback (most recent call last):
        2: from (irb):3
        1: from (irb):4:in `rescue in irb_binding'
NoMethodError (undefined method `[]' for nil:NilClass)
irb(main):005:0>

Looks like POST request in extract_collection_schema is invalid, it is returning validation error.

response.body
"{\"errorId\":\"83f22b07-f9c5-4247-a2bf-96c20799a974\",\"name\":\"ValidationError\",\"message\":\"Invalid input.\"}"

`x-notion-active-user-header` not handed down to page block

When attempting to use page.children, or page.get_block('<BLOCK_ID>'), I get empty results back.

I believe I tracked down the bug to this part:

# notion-ruby/lib/notion_api/core.rb:139
def get_all_block_info(_clean_id, body)
      # ! retrieves all info pertaining to a block Id.
      # ! clean_id -> the block ID or URL cleaned : ``str``
      Core.options['cookies'][:token_v2] = @@token_v2
      Core.options['headers']['x-notion-active-user-header'] = @active_user_header # <--- ๐Ÿšจ
      cookies = Core.options['cookies']
      headers = Core.options['headers']
# [...]

When pry-byebugging it, I get nil when checking up @active_user_header, and the correct header value when checking up @@active_user_header.
I made the replacement in the source code installed on my system, and it looks like it fixed the issue.

What do you think?

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.