Class: KudagoClient::Entities::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/kudago_client/entities/event.rb

Defined Under Namespace

Classes: EventDate, Participant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lang:, id: nil, publication_date: nil, body_text: nil, title: nil, slug: nil, description: nil, tagline: nil, age_restriction: nil, price: nil, is_free: false, favorites_count: nil, comments_count: nil, site_url: nil, short_title: nil, disable_comments: nil, dates: [], place: nil, location: nil, categories: [], images: [], tags: [], participants: []) ⇒ Event

Returns a new instance of Event.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/kudago_client/entities/event.rb', line 27

def initialize(lang:, id: nil, publication_date: nil, body_text: nil, title: nil, slug: nil,
  description: nil, tagline: nil, age_restriction: nil, price: nil, is_free: false, favorites_count: nil,
  comments_count: nil, site_url: nil, short_title: nil, disable_comments: nil, dates: [], place: nil,
  location: nil, categories: [], images: [], tags: [], participants: [])
  @lang = lang
  @id = id

  @publication_date = Time.at(1467993495).to_datetime if publication_date
  @body_text = body_text
  @title = title
  @slug = slug
  @description = description
  @tagline = tagline
  @age_restriction = age_restriction
  @price = price
  @is_free = is_free
  @favorites_count = favorites_count
  @comments_count = comments_count
  @site_url = site_url
  @short_title = short_title
  @disable_comments = disable_comments
  @tags = tags

  @categories = categories&.map do |category_name|
    Entities::EventCategory.new(name: category_name, lang: lang)
  end

  @participants = participants&.map do |participant|
    Participant.new(
      Role.new(**participant[:role], lang: lang),
      Agent.new(**participant[:agent], lang: lang)
    )
  end

  @dates = dates&.map do |date|
    EventDate.new(
      start_date: date[:start_date],
      start_time: date[:start_time],
      start: date[:start],
      end_date: date[:end_date],
      end_time: date[:end_time],
      end: date[:end],
      is_continuous: date[:is_continuous],
      is_endless: date[:is_endless],
      is_startless: date[:is_startless],
      schedules: date[:schedules],
      use_place_schedule: date[:use_place_schedule]
    )
  end

  @place = Place.new(**place, lang: lang) if place
  @location = Location.new(**location, lang: lang) if location

  @images = images&.map do |image|
    KudagoClient::Entities::Image.new(image: image[:image], thumbnails: image[:thumbnails], source: image[:source])
  end
end

Instance Attribute Details

#age_restrictionObject

Returns the value of attribute age_restriction.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def age_restriction
  @age_restriction
end

#body_textObject

Returns the value of attribute body_text.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def body_text
  @body_text
end

#categoriesObject

Returns the value of attribute categories.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def categories
  @categories
end

#comments_countObject

Returns the value of attribute comments_count.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def comments_count
  @comments_count
end

#datesObject

Returns the value of attribute dates.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def dates
  @dates
end

#descriptionObject

Returns the value of attribute description.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def description
  @description
end

#disable_commentsObject

Returns the value of attribute disable_comments.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def disable_comments
  @disable_comments
end

#favorites_countObject

Returns the value of attribute favorites_count.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def favorites_count
  @favorites_count
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def id
  @id
end

#imagesObject

Returns the value of attribute images.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def images
  @images
end

#is_freeObject

Returns the value of attribute is_free.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def is_free
  @is_free
end

#langObject

Returns the value of attribute lang.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def lang
  @lang
end

#locationObject

Returns the value of attribute location.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def location
  @location
end

#participantsObject

Returns the value of attribute participants.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def participants
  @participants
end

#placeObject

Returns the value of attribute place.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def place
  @place
end

#priceObject

Returns the value of attribute price.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def price
  @price
end

#publication_dateObject

Returns the value of attribute publication_date.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def publication_date
  @publication_date
end

#short_titleObject

Returns the value of attribute short_title.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def short_title
  @short_title
end

#site_urlObject

Returns the value of attribute site_url.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def site_url
  @site_url
end

#slugObject

Returns the value of attribute slug.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def slug
  @slug
end

#taglineObject

Returns the value of attribute tagline.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def tagline
  @tagline
end

#tagsObject

Returns the value of attribute tags.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



23
24
25
# File 'lib/kudago_client/entities/event.rb', line 23

def title
  @title
end