Class: SynapsePayRest::ClientEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse_pay_rest/api/client.rb

Overview

Wrapper class for /client endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ClientEndpoint

Returns a new instance of ClientEndpoint.

Parameters:



10
11
12
# File 'lib/synapse_pay_rest/api/client.rb', line 10

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSynapsePayRest::HTTPClient



7
8
9
# File 'lib/synapse_pay_rest/api/client.rb', line 7

def client
  @client
end

Instance Method Details

#issue_public_key(scope: "OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS") ⇒ Hash

Sends a GET request to /client endpoint to issue public key, and returns the response.

HTTP response from API

Parameters:

  • scope (String) (defaults to: "OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS")

Returns:

  • (Hash)

    API response

Raises:



23
24
25
26
27
# File 'lib/synapse_pay_rest/api/client.rb', line 23

def issue_public_key(scope: "OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS")
  path = '/client?issue_public_key=YES'
  path += "&scope=#{scope}"
  client.get(path)
end