Class: CalendarApi::CalendarListResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/calendar_api/models/calendar_list_response.rb

Overview

A paginated list of the user’s calendar list entries.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(kind: 'calendar#calendarList', etag: SKIP, next_page_token: SKIP, next_sync_token: SKIP, items: SKIP, additional_properties: nil) ⇒ CalendarListResponse

Returns a new instance of CalendarListResponse.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/calendar_api/models/calendar_list_response.rb', line 61

def initialize(kind: 'calendar#calendarList', etag: SKIP,
               next_page_token: SKIP, next_sync_token: SKIP, items: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @kind = kind unless kind == SKIP
  @etag = etag unless etag == SKIP
  @next_page_token = next_page_token unless next_page_token == SKIP
  @next_sync_token = next_sync_token unless next_sync_token == SKIP
  @items = items unless items == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#etagString

ETag of the collection.

Returns:

  • (String)


18
19
20
# File 'lib/calendar_api/models/calendar_list_response.rb', line 18

def etag
  @etag
end

#itemsArray[CalendarListEntry]

Calendars on the user’s calendar list.

Returns:



32
33
34
# File 'lib/calendar_api/models/calendar_list_response.rb', line 32

def items
  @items
end

#kindString

Type of the collection.

Returns:

  • (String)


14
15
16
# File 'lib/calendar_api/models/calendar_list_response.rb', line 14

def kind
  @kind
end

#next_page_tokenString

Token used to access the next page of this result. Omitted if no further results are available.

Returns:

  • (String)


23
24
25
# File 'lib/calendar_api/models/calendar_list_response.rb', line 23

def next_page_token
  @next_page_token
end

#next_sync_tokenString

Token used for incremental synchronization at a later point. Only provided on the last page of results.

Returns:

  • (String)


28
29
30
# File 'lib/calendar_api/models/calendar_list_response.rb', line 28

def next_sync_token
  @next_sync_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/calendar_api/models/calendar_list_response.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  kind = hash['kind'] ||= 'calendar#calendarList'
  etag = hash.key?('etag') ? hash['etag'] : SKIP
  next_page_token =
    hash.key?('nextPageToken') ? hash['nextPageToken'] : SKIP
  next_sync_token =
    hash.key?('nextSyncToken') ? hash['nextSyncToken'] : SKIP
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (CalendarListEntry.from_hash(structure) if structure)
    end
  end

  items = SKIP unless hash.key?('items')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CalendarListResponse.new(kind: kind,
                           etag: etag,
                           next_page_token: next_page_token,
                           next_sync_token: next_sync_token,
                           items: items,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/calendar_api/models/calendar_list_response.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['kind'] = 'kind'
  @_hash['etag'] = 'etag'
  @_hash['next_page_token'] = 'nextPageToken'
  @_hash['next_sync_token'] = 'nextSyncToken'
  @_hash['items'] = 'items'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/calendar_api/models/calendar_list_response.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/calendar_api/models/calendar_list_response.rb', line 46

def self.optionals
  %w[
    kind
    etag
    next_page_token
    next_sync_token
    items
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/calendar_api/models/calendar_list_response.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} kind: #{@kind.inspect}, etag: #{@etag.inspect}, next_page_token:"\
  " #{@next_page_token.inspect}, next_sync_token: #{@next_sync_token.inspect}, items:"\
  " #{@items.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/calendar_api/models/calendar_list_response.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} kind: #{@kind}, etag: #{@etag}, next_page_token: #{@next_page_token},"\
  " next_sync_token: #{@next_sync_token}, items: #{@items}, additional_properties:"\
  " #{@additional_properties}>"
end