Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザーからのAPIキーの使用を必要とするサービス用に最初のrubygemを構築しているので、ユーザーがインストール時に自分のAPIキーをgemに提供できるようにするにはどうすればよいですか?
ありがとう :)
宝石のユーザーがAPIキーを入力できるようにするconfig/yourgem_config.yml
config/yourgem_config.yml
# yourgem_config.yml api_key: 1233456
gemから、このYAMLファイルをロードし、指定されたものを使用しapi_keyます。
api_key
オプションでフォールバックして、構成ファイルが見つからない場合に他の種類のAPIアクセスを行うか、エラーメッセージを表示します。
オプションで、ユーザーに構成ファイルへのパスを構成させます。