Class: RippleKeycloak::Client
- Inherits:
-
Object
- Object
- RippleKeycloak::Client
- Includes:
- HTTParty
- Defined in:
- lib/ripple_keycloak/client.rb
Class Method Summary collapse
- .configure {|configuration| ... } ⇒ Object
- .delete_formatted(resource, json: true, authed: true, **options) ⇒ Object
- .get_formatted(resource, authed: true, **options) ⇒ Object
- .post_formatted(resource, json: true, authed: true, **options) ⇒ Object
- .put_formatted(resource, json: true, authed: true, **options) ⇒ Object
Instance Method Summary collapse
- #delete(resource, body = {}) ⇒ Object
- #get(resource) ⇒ Object
- #post(resource, body) ⇒ Object
- #put(resource, body) ⇒ Object
Class Method Details
.configure {|configuration| ... } ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ripple_keycloak/client.rb', line 15 def configure @configuration = Configuration.new yield(configuration) auth 'Authenticated successfully' end |
.delete_formatted(resource, json: true, authed: true, **options) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/ripple_keycloak/client.rb', line 51 def delete_formatted(resource, json: true, authed: true, **) if authed = add_auth_header() resource = "admin/realms/#{realm}/" + resource end = format_as_json() if json return_or_raise delete("#{base_uri}/#{resource}", ) end |
.get_formatted(resource, authed: true, **options) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/ripple_keycloak/client.rb', line 42 def get_formatted(resource, authed: true, **) if authed = add_auth_header() resource = "admin/realms/#{realm}/" + resource end return_or_raise get("#{base_uri}/#{resource}", ) end |
.post_formatted(resource, json: true, authed: true, **options) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/ripple_keycloak/client.rb', line 22 def post_formatted(resource, json: true, authed: true, **) if authed = add_auth_header() resource = "admin/realms/#{realm}/" + resource end = format_as_json() if json return_or_raise post("#{base_uri}/#{resource}", ) end |
.put_formatted(resource, json: true, authed: true, **options) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/ripple_keycloak/client.rb', line 32 def put_formatted(resource, json: true, authed: true, **) if authed = add_auth_header() resource = "admin/realms/#{realm}/" + resource end = format_as_json() if json return_or_raise put("#{base_uri}/#{resource}", ) end |
Instance Method Details
#delete(resource, body = {}) ⇒ Object
134 135 136 |
# File 'lib/ripple_keycloak/client.rb', line 134 def delete(resource, body = {}) self.class.delete_formatted(resource, body: body) end |
#get(resource) ⇒ Object
130 131 132 |
# File 'lib/ripple_keycloak/client.rb', line 130 def get(resource) self.class.get_formatted(resource) end |
#post(resource, body) ⇒ Object
122 123 124 |
# File 'lib/ripple_keycloak/client.rb', line 122 def post(resource, body) self.class.post_formatted(resource, body: body) end |
#put(resource, body) ⇒ Object
126 127 128 |
# File 'lib/ripple_keycloak/client.rb', line 126 def put(resource, body) self.class.put_formatted(resource, body: body) end |