Module: CirroIOV2::Responses

Defined in:
lib/cirro_io_v2/responses/base.rb,
lib/cirro_io_v2/responses/responses.rb

Defined Under Namespace

Modules: Base Classes: EpamHeroesBadgeResponse, GigInvitationResponse, GigResponse, GigResultResponse, GigTaskResponse, GigTimeActivityResponse, InvitationNotificationTopicResponse, NotificationBroadcastResponse, NotificationConfigurationResponse, NotificationLayoutResponse, NotificationLayoutTemplateResponse, NotificationLocaleResponse, NotificationTemplateResponse, NotificationTopicPreferenceResponse, NotificationTopicResponse, PayoutResponse, SpaceInvitationResponse, UserInvitationAttemptResponse, UserNotificationPreferenceResponse, UserResponse

Constant Summary collapse

LIST_RESPONSES =
[
  :GigTaskListResponse,
  :GigResultListResponse,
  :GigInvitationListResponse,
  :GigTimeActivityListResponse,
  :PayoutListResponse,
  :NotificationTopicPreferenceListResponse,
  :NotificationLocaleListResponse,
  :NotificationLayoutListResponse,
  :NotificationConfigurationListResponse,
  :NotificationLayoutTemplateListResponse,
  :NotificationTopicListResponse,
  :NotificationTemplateListResponse,
].freeze
DELETE_RESPONSES =
[
  :GigDeleteResponse,
  :PayoutDeleteResponse,
  :NotificationTemplateDeleteResponse,
  :NotificationLayoutTemplateDeleteResponse,
  :NotificationTopicDeleteResponse,
].freeze

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

cover the list and delete responses



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/cirro_io_v2/responses/responses.rb', line 178

def self.const_missing(name)
  return const_get(name) if const_defined? name

  struct = nil
  struct = Struct.new(:object, :url, :has_more, :data, keyword_init: true) if LIST_RESPONSES.include?(name)
  struct = Struct.new(:id, :object, :deleted, keyword_init: true) if DELETE_RESPONSES.include?(name)

  return unless struct.present?

  klass = Class.new(struct) { include Base }
  const_set(name, klass)
end