Class: Zanshin::SDK::Client
- Inherits:
-
Object
- Object
- Zanshin::SDK::Client
- Includes:
- Account, Alerts, OrganizationFollowers, OrganizationFollowing, OrganizationMembers, OrganizationScanTargets, Organizations, Summaries
- Defined in:
- lib/zanshin/client.rb
Overview
Zanshin SDK Client
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(profile, api_key, api_url, user_agent, proxy_url) ⇒ Client
constructor
Initialize a new Zanshin SDK instance.
Methods included from Summaries
#get_alert_summaries, #get_following_alert_summaries, #get_following_scan_summaries, #get_scan_summaries
Methods included from OrganizationScanTargets
#check_organization_scan_target, #create_organization_scan_target, #delete_organization_scan_target, #get_organization_scan_target, #get_organization_scan_target_scan, #iter_organization_scan_target_scans, #iter_organization_scan_targets, #start_organization_scan_target_scan, #stop_organization_scan_target_scan, #update_organization_scan_target
Methods included from OrganizationMembers
#create_organization_members_invite, #delete_organization_member, #delete_organization_member_invite, #get_organization_member, #get_organization_member_invite, #iter_organization_members, #iter_organization_members_invites, #resend_organization_member_invite, #reset_organization_member_mfa, #reset_organization_member_password, #update_organization_member
Methods included from OrganizationFollowing
#accept_organization_following_request, #decline_organization_following_request, #get_organization_following_request, #iter_organization_following, #iter_organization_following_requests, #stop_organization_following
Methods included from OrganizationFollowers
#create_organization_follower_request, #delete_organization_follower_request, #get_organization_follower_request, #iter_organization_follower_requests, #iter_organization_followers, #stop_organization_follower
Methods included from Organizations
#get_organization, #iter_organizations, #update_organization
Methods included from Alerts
#create_alert_comment, #get_alert, #iter_alert_comments, #iter_alert_history, #iter_alerts, #iter_alerts_following_history, #iter_alerts_history, #iter_following_alerts, #iter_grouped_alerts, #iter_grouped_following_alerts, #update_alert
Methods included from Account
#accept_invite, #create_api_key, #delete_api_key, #get_invite, #get_me, #iter_api_keys, #iter_invites
Constructor Details
#initialize(profile, api_key, api_url, user_agent, proxy_url) ⇒ Client
Initialize a new Zanshin SDK instance
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/zanshin/client.rb', line 74 def initialize(profile: 'default', api_key: ENV.fetch('ZANSHIN_API_KEY', nil), api_url: ENV.fetch('ZANSHIN_API_URL', nil) || ZANSHIN_API, user_agent: ENV.fetch('ZANSHIN_USER_AGENT', nil), proxy_url: ENV.fetch('HTTP_PROXY', ENV.fetch('HTTPS_PROXY', nil))) @logger = Logger.new($stdout) @logger.level = Logger::WARN config = get_config(profile) @api_key = api_key || config['api_key'] || raise('No API key found') @api_url = validate_url(api_url || config['api_url']) @user_agent = add_sdk_agent(user_agent || config['user_agent']) @proxy_url = validate_proxy(proxy_url || config['proxy_url']) update_request @logger.debug('Zanshin SDK Initialized') end |
Instance Attribute Details
#api_key ⇒ Object #api_key=(value) ⇒ Object
36 37 38 |
# File 'lib/zanshin/client.rb', line 36 def api_key @api_key end |
#api_url ⇒ Object #api_url=(value) ⇒ Object
43 44 45 |
# File 'lib/zanshin/client.rb', line 43 def api_url @api_url end |
#http ⇒ Object #http=(`: HTTPClient`) ⇒ Object
65 66 67 |
# File 'lib/zanshin/client.rb', line 65 def http @http end |
#proxy_url ⇒ Object #proxy_url=(value) ⇒ Object
57 58 59 |
# File 'lib/zanshin/client.rb', line 57 def proxy_url @proxy_url end |
#user_agent ⇒ Object #user_agent=(value) ⇒ Object
50 51 52 |
# File 'lib/zanshin/client.rb', line 50 def user_agent @user_agent end |