added a class wrapper to pull easy things. start with just a basic get_id method
This commit is contained in:
parent
836dced0a2
commit
f8b79d06bb
1 changed files with 45 additions and 0 deletions
45
tools/microsoft/microsoft_cvrf_client.rb
Executable file
45
tools/microsoft/microsoft_cvrf_client.rb
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
require 'openapi_client'
|
||||||
|
require 'date'
|
||||||
|
require 'json'
|
||||||
|
require 'pry'
|
||||||
|
|
||||||
|
MONTHS = %w[
|
||||||
|
Jan
|
||||||
|
Feb
|
||||||
|
Mar
|
||||||
|
Apr
|
||||||
|
May
|
||||||
|
Jun
|
||||||
|
Jul
|
||||||
|
Aug
|
||||||
|
Sep
|
||||||
|
Oct
|
||||||
|
Nov
|
||||||
|
Dec
|
||||||
|
]
|
||||||
|
|
||||||
|
BEGIN_YEAR = 2016
|
||||||
|
CURRENT_YEAR = Date.today.year
|
||||||
|
YEAR_RANGE = (BEGIN_YEAR..CURRENT_YEAR).to_a
|
||||||
|
|
||||||
|
class MicrosoftCvrfClient
|
||||||
|
attr_accessor :ids, :api_instance, :api_version, :api_key
|
||||||
|
|
||||||
|
def initialize(api_instance = OpenapiClient::DefaultApi.new, api_version = 'api_version_example', api_key = 'api_key_example')
|
||||||
|
@ids = YEAR_RANGE.map { |y| MONTHS.map { |m| "#{y}-#{m}" } }.flatten
|
||||||
|
@api_instance = api_instance
|
||||||
|
@api_version = api_version
|
||||||
|
@api_key = api_key
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_id(id)
|
||||||
|
p "Now checking #{id}"
|
||||||
|
p "------------------"
|
||||||
|
result = api_instance.cvrf_id_get(api_version, api_key, id)
|
||||||
|
p result
|
||||||
|
rescue OpenapiClient::ApiError => e
|
||||||
|
puts "Exception when calling DefaultApi->cvrf_id_get: #{e}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
c = MicrosoftCvrfClient.new
|
Loading…
Add table
Reference in a new issue