kabustation_client
KabustationClient - the Ruby gem for the kabuステーションAPI
定義情報
REST APIのコード一覧、エンドポイントは下記リンク参照
This SDK is automatically generated by the OpenAPI Generator project:
Installation
Build a gem
To build the Ruby code into a gem:
gem build kabustation_client.gemspec
Then either install the gem locally:
gem install ./kabustation_client-1.1.0.gem
(for development, run gem install --dev ./kabustation_client-1.1.0.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'kabustation_client', '~> 1.1.0'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/kyohah/kabustation_client-ruby, then add the following in the Gemfile:
gem 'kabustation_client', :git => 'https://github.com/kyohah/kabustation_client-ruby.git'
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
Windowsのnginxの設定
windows マシンで rubyを動かすなら不要
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name localhost;
proxy_http_version 1.1;
proxy_set_header Host localhost;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
location /production/ { # 本番用
proxy_pass http://127.0.0.1:18080/kabusapi;
}
location /development/ { # 検証用
proxy_pass http://127.0.0.1:18081/kabusapi;
}
}
}
require 'kabustation_client'
KabustationClient.configure do |config|
config.host = ENV.fetch('KABUSTATION_HOST', 'localhost')
config.base_path = '/production'
end
api_instance = KabustationClient::AuthApi.new
request_token = KabustationClient::RequestToken.new({api_password: 'xxxxxx'})
begin
result = api_instance.token_post(request_token)
p result
rescue KabustationClient::ApiError => e
puts "Exception when calling AuthApi->token_post: #{e}"
end
KabustationClient.configure.api_key['ApiKeyAuth'] = result.token
register_instance = KabustationClient::RegisterApi.new
instance = KabustationClient::RequestRegister.new(symbols: [{symbol: '5401', exchange: 1}])
result = register_instance.register_put(instance)
client = KabustationClient::PushClient.new(
open: -> { puts "WebSocket opened" },
message: -> (board) { puts "Received message: #{board.symbol_name}" },
error: -> (e) { puts "Error occurred: #{e}" },
close: -> (e) { puts "Connection closed: #{e}" }
)
client.connect
Documentation for API Endpoints
All URIs are relative to http://localhost:18080/kabusapi
Documentation for Models
Documentation for Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: X-API-Key
- Location: HTTP header