Class: A2A::Operation::ListTasks::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/operation/list_tasks.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tasks:, next_page_token:, page_size:, total_size:) ⇒ Response

Returns a new instance of Response.



51
52
53
54
55
56
# File 'lib/a2a/operation/list_tasks.rb', line 51

def initialize(tasks:, next_page_token:, page_size:, total_size:)
  @tasks = tasks
  @next_page_token = next_page_token
  @page_size = page_size
  @total_size = total_size
end

Instance Attribute Details

#next_page_tokenObject (readonly)

Returns the value of attribute next_page_token.



49
50
51
# File 'lib/a2a/operation/list_tasks.rb', line 49

def next_page_token
  @next_page_token
end

#page_sizeObject (readonly)

Returns the value of attribute page_size.



49
50
51
# File 'lib/a2a/operation/list_tasks.rb', line 49

def page_size
  @page_size
end

#tasksObject (readonly)

Returns the value of attribute tasks.



49
50
51
# File 'lib/a2a/operation/list_tasks.rb', line 49

def tasks
  @tasks
end

#total_sizeObject (readonly)

Returns the value of attribute total_size.



49
50
51
# File 'lib/a2a/operation/list_tasks.rb', line 49

def total_size
  @total_size
end

Class Method Details

.from_h(hash) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/a2a/operation/list_tasks.rb', line 58

def self.from_h(hash)
  new(
    tasks: Array(hash["tasks"]).map { Task.from_h(_1) },
    next_page_token: hash.fetch("nextPageToken"),
    page_size: hash.fetch("pageSize"),
    total_size: hash.fetch("totalSize")
  )
end

Instance Method Details

#to_hObject



67
68
69
70
71
72
73
74
# File 'lib/a2a/operation/list_tasks.rb', line 67

def to_h
  {
    "tasks" => tasks.map(&:to_h),
    "nextPageToken" => next_page_token,
    "pageSize" => page_size,
    "totalSize" => total_size
  }
end