Class: GlobiGuard::ResourceClient
- Inherits:
-
Object
- Object
- GlobiGuard::ResourceClient
- Defined in:
- lib/globiguard.rb
Instance Method Summary collapse
- #create(body) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(transport, base_path) ⇒ ResourceClient
constructor
A new instance of ResourceClient.
- #list ⇒ Object
- #post(suffix, body) ⇒ Object
Constructor Details
#initialize(transport, base_path) ⇒ ResourceClient
Returns a new instance of ResourceClient.
132 133 134 135 |
# File 'lib/globiguard.rb', line 132 def initialize(transport, base_path) @transport = transport @base_path = base_path end |
Instance Method Details
#create(body) ⇒ Object
139 |
# File 'lib/globiguard.rb', line 139 def create(body) = @transport.request("post", @base_path, body: body) |
#get(id) ⇒ Object
138 |
# File 'lib/globiguard.rb', line 138 def get(id) = @transport.request("get", "#{@base_path}/#{URI.encode_www_form_component(id)}") |
#list ⇒ Object
137 |
# File 'lib/globiguard.rb', line 137 def list = @transport.request("get", @base_path) |
#post(suffix, body) ⇒ Object
140 |
# File 'lib/globiguard.rb', line 140 def post(suffix, body) = @transport.request("post", "#{@base_path}/#{URI.encode_www_form_component(suffix.sub(%r{\A/+}, ""))}", body: body) |