Skip to content

add balance statement URL#25

Merged
natsuki-yamanaka merged 3 commits into
masterfrom
nyamanaka/add_balance_statement_url
May 17, 2024
Merged

add balance statement URL#25
natsuki-yamanaka merged 3 commits into
masterfrom
nyamanaka/add_balance_statement_url

Conversation

@natsuki-yamanaka

@natsuki-yamanaka natsuki-yamanaka commented May 10, 2024

Copy link
Copy Markdown
Contributor
  • this is version 0.4.1
  • add feature that issue balance statement URL like statement URL
  • example usage:
statement_url = payjp.Balance.statement_urls('ba_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
statement_url = payjp.Balance.statement_urls('ba_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', platformer='true')

Comment thread payjp/resource.py

class Balance(ListableAPIResource):
pass
@classmethod

@darai0512 darai0512 May 10, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

静的メソッドの用意、かなり賛成です!

一方で他はインスタンスメソッドなため、ここだけ急に変わるから使い方を覚えてもらったり、後方互換が必要だったり...。
なので両方用意するのはどうでしょう?

class Hoge():
    def __init__(self):
        self.a = self.__a

    @classmethod
    def a(cls, param):
        print('here' + param)

    def __a(self, param):
        self.__class__.a(param) # 実装の共通化


Hoge.a('fuga')
Hoge().a('fuga')

instance/classを同名で用意する方法は他にも
https://stackoverflow.com/questions/28237955/same-name-for-classmethod-and-instancemethod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新規の部分にインスタンスメソッド要りますかね。
既存の部分を置き換えるなら後方互換を考えるのは分かりますが、ここは新しく使い始める人しかいないわけで使い方が難しいわけでもないしクラスメソッドだけあれば事足りる気がしましたが

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

個人的には同名で両方用意するのが上の通り簡単そうだったので、両方あってもいいなと思います。

retrieveとかlistとかの戻りのインスタンスから直接statement_urlsを実行できれば、idを引数指定する必要がなくなる(=誤指定が減る)ので便利さはありそうです。

ここだけ静的メソッドしかなくて、他は両方あるのが(実装側のコードを想像して)歪ってところがネックですが、
いずれにせよ些事ではあるので、方針を貫いてもらえるならどの方針でも。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど。では一応用意しときます

@natsuki-yamanaka natsuki-yamanaka merged commit df0efc0 into master May 17, 2024
@natsuki-yamanaka natsuki-yamanaka deleted the nyamanaka/add_balance_statement_url branch May 17, 2024 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants