Module: HTTP

Included in:
WalletPay::Client
Defined in:
lib/wallet_pay/http.rb

Defined Under Namespace

Classes: ResponseError

Constant Summary collapse

SUCCESS_STATUSES =
[200, 201].freeze

Instance Method Summary collapse

Instance Method Details

#get(path:) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/wallet_pay/http.rb', line 9

def get(path:)
  response = conn.get(uri(path: path)) do |req|
    req.headers = headers
  end

  error_or_response(response)
end

#json_post(path:, parameters:) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/wallet_pay/http.rb', line 17

def json_post(path:, parameters:)
  response = conn.post(uri(path: path)) do |req|
    req.headers = headers
    req.body = parameters.to_json
  end

  error_or_response(response)
end