Class: Fizzy::Services::CommentsService

Inherits:
BaseService show all
Defined in:
lib/fizzy/generated/services/comments_service.rb

Overview

Service for Comments operations

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Fizzy::Services::BaseService

Instance Method Details

#create(account_id:, card_number:, body:, created_at: nil) ⇒ Hash

create operation

Parameters:

  • account_id (String)

    account id ID

  • card_number (Integer)

    card number ID

  • body (String)

    body

  • created_at (String, nil) (defaults to: nil)

    created at

Returns:

  • (Hash)

    response data



26
27
28
29
30
# File 'lib/fizzy/generated/services/comments_service.rb', line 26

def create(account_id:, card_number:, body:, created_at: nil)
  with_operation(service: "comments", operation: "CreateComment", is_mutation: true, resource_id: card_number) do
    http_post("/#{}/cards/#{card_number}/comments.json", body: compact_params(body: body, created_at: created_at)).json
  end
end

#delete(account_id:, card_number:, comment_id:) ⇒ void

This method returns an undefined value.

delete operation

Parameters:

  • account_id (String)

    account id ID

  • card_number (Integer)

    card number ID

  • comment_id (String)

    comment id ID



60
61
62
63
64
65
# File 'lib/fizzy/generated/services/comments_service.rb', line 60

def delete(account_id:, card_number:, comment_id:)
  with_operation(service: "comments", operation: "DeleteComment", is_mutation: true, resource_id: comment_id) do
    http_delete("/#{}/cards/#{card_number}/comments/#{comment_id}")
    nil
  end
end

#get(account_id:, card_number:, comment_id:) ⇒ Hash

get operation

Parameters:

  • account_id (String)

    account id ID

  • card_number (Integer)

    card number ID

  • comment_id (String)

    comment id ID

Returns:

  • (Hash)

    response data



37
38
39
40
41
# File 'lib/fizzy/generated/services/comments_service.rb', line 37

def get(account_id:, card_number:, comment_id:)
  with_operation(service: "comments", operation: "GetComment", is_mutation: false, resource_id: comment_id) do
    http_get("/#{}/cards/#{card_number}/comments/#{comment_id}").json
  end
end

#list(account_id:, card_number:) ⇒ Enumerator<Hash>

list operation

Parameters:

  • account_id (String)

    account id ID

  • card_number (Integer)

    card number ID

Returns:

  • (Enumerator<Hash>)

    paginated results



14
15
16
17
18
# File 'lib/fizzy/generated/services/comments_service.rb', line 14

def list(account_id:, card_number:)
  wrap_paginated(service: "comments", operation: "ListComments", is_mutation: false, resource_id: card_number) do
    paginate("/#{}/cards/#{card_number}/comments.json")
  end
end

#update(account_id:, card_number:, comment_id:, body:) ⇒ Hash

update operation

Parameters:

  • account_id (String)

    account id ID

  • card_number (Integer)

    card number ID

  • comment_id (String)

    comment id ID

  • body (String)

    body

Returns:

  • (Hash)

    response data



49
50
51
52
53
# File 'lib/fizzy/generated/services/comments_service.rb', line 49

def update(account_id:, card_number:, comment_id:, body:)
  with_operation(service: "comments", operation: "UpdateComment", is_mutation: true, resource_id: comment_id) do
    http_patch("/#{}/cards/#{card_number}/comments/#{comment_id}", body: compact_params(body: body)).json
  end
end