Class: Sendgo::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgo/http_client.rb

Overview

Sendgo API HTTP 클라이언트.

Instance Method Summary collapse

Constructor Details

#initialize(token_manager:, base_url:, api_version:) ⇒ HttpClient

Returns a new instance of HttpClient.



8
9
10
11
12
# File 'lib/sendgo/http_client.rb', line 8

def initialize(token_manager:, base_url:, api_version:)
  @token_manager = token_manager
  @base_url      = base_url
  @api_version   = api_version
end

Instance Method Details

#delete(path) ⇒ Object

DELETE 요청. 짧은 URL 리다이렉트 중지에서 사용한다.



25
26
27
# File 'lib/sendgo/http_client.rb', line 25

def delete(path)
  request(:delete, path, is_retry: false)
end

#get(path, params = {}) ⇒ Object

GET 요청. 캠페인 조회 엔드포인트에서 사용한다. params 의 nil 값은 제외되어 서버 기본값이 적용된다.



20
21
22
# File 'lib/sendgo/http_client.rb', line 20

def get(path, params = {})
  request(:get, path, params: params, is_retry: false)
end

#post(path, body) ⇒ Object



14
15
16
# File 'lib/sendgo/http_client.rb', line 14

def post(path, body)
  request(:post, path, body: body, is_retry: false)
end