2017-02-07 7 views
0

Google 지식 그래프 API를 사용하려고합니다. 이미 API 키가 있고 RESTful API 대신 라이브러리를 사용합니다.자격 증명

kgSearch = Kgsearch::KgsearchService.new 
response = kgSearch.search_entities(query: query) 

나는 초기화가 인수를 기대 없기 때문에 거부 것

kgSearch = Kgsearch::KgsearchService.new(api: 'klfkdlfkdlm') 

아래로 서비스를 인스턴스화하는 것을 시도했다.

모든 아이디어, api_key를 추가하는 방법 ??

나는 또한 시도 :

response = kgSearch.search_entities(query: query, api: 'fjfkjfl') 

같은 일

어떤 아이디어가?

답변

0

Google Api 클라이언트 용 Ruby 문서 도구에 따르면 key은 API 키 (http://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/KgsearchV1/KgsearchService#key-instance_method)를 할당 할 수있는 인스턴스 메소드입니다.

kgSearch = Kgsearch::KgsearchService.new 
kgSearch.key = 'your_key_here' 
response = kgSearch.search_entities(query: query) # and any other options that are necessary 
:

그래서 난 당신이 다음과 같은 일을 할 거라고 생각