Class: Hook0::Generated::ServiceTokenApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/api.rb

Overview

What the API declares under serviceToken, issued through the transport it is handed.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ ServiceTokenApi

Returns a new instance of ServiceTokenApi.

Parameters:

  • transport (Object)

    what one request is issued through



832
833
834
# File 'lib/hook0/generated/api.rb', line 832

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(body) ⇒ ServiceToken

Create a new service token

Parameters:

Returns:



840
841
842
843
844
845
846
847
848
849
850
# File 'lib/hook0/generated/api.rb', line 840

def create(body)
  read_answer(
    @transport.request(
      "POST",
      "/api/v1/service_token/",
      [],
      body.to_h
    ),
    ServiceToken.method(:from_json)
  )
end

#delete(service_token_id, organization_id) ⇒ void

This method returns an undefined value.

Delete a service token

Parameters:

  • service_token_id (String)

    carries service_token_id.

  • organization_id (String)

    carries organization_id.



857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
# File 'lib/hook0/generated/api.rb', line 857

def delete(service_token_id, organization_id)
  check_answer(
    @transport.request(
      "DELETE",
      Runtime.path(
        "/api/v1/service_token/{service_token_id}",
        "service_token_id" => service_token_id
      ),
      Runtime.query(
        [
          ["organization_id", organization_id]
        ],
        []
      ),
      nil
    )
  )
end

#edit(service_token_id, body) ⇒ ServiceToken

Edit a service token

Parameters:

  • service_token_id (String)

    carries service_token_id.

  • body (ServiceTokenPost)

    what the operation reads

Returns:



881
882
883
884
885
886
887
888
889
890
891
892
893
894
# File 'lib/hook0/generated/api.rb', line 881

def edit(service_token_id, body)
  read_answer(
    @transport.request(
      "PUT",
      Runtime.path(
        "/api/v1/service_token/{service_token_id}",
        "service_token_id" => service_token_id
      ),
      [],
      body.to_h
    ),
    ServiceToken.method(:from_json)
  )
end

#get(service_token_id, organization_id) ⇒ ServiceToken

Get a service token

Parameters:

  • service_token_id (String)

    carries service_token_id.

  • organization_id (String)

    carries organization_id.

Returns:



901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
# File 'lib/hook0/generated/api.rb', line 901

def get(service_token_id, organization_id)
  read_answer(
    @transport.request(
      "GET",
      Runtime.path(
        "/api/v1/service_token/{service_token_id}",
        "service_token_id" => service_token_id
      ),
      Runtime.query(
        [
          ["organization_id", organization_id]
        ],
        []
      ),
      nil
    ),
    ServiceToken.method(:from_json)
  )
end

#list(organization_id) ⇒ Array<ServiceToken>

List service tokens

Parameters:

  • organization_id (String)

    carries organization_id.

Returns:



925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
# File 'lib/hook0/generated/api.rb', line 925

def list(organization_id)
  read_answer(
    @transport.request(
      "GET",
      "/api/v1/service_token/",
      Runtime.query(
        [
          ["organization_id", organization_id]
        ],
        []
      ),
      nil
    ),
    Runtime.list(ServiceToken.method(:from_json))
  )
end