Module: StratumnSdk::Request

Included in:
Agent, Agent, Segment
Defined in:
lib/stratumn_sdk/request.rb

Overview

Wrapper around HTTP.request that parses the response and raises on error

Instance Method Summary collapse

Instance Method Details

#get(*args) ⇒ Object



7
8
9
# File 'lib/stratumn_sdk/request.rb', line 7

def get(*args)
  request(:get, *args)
end

#post(*args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/stratumn_sdk/request.rb', line 11

def post(*args)
  result = request(:post, *args)

  if result['meta'] && result['meta']['errorMessage']
    raise result['meta']['errorMessage']
  end

  result
end