Class: NgpvanPublicEventListing::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ngpvan_public_event_listing/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
# File 'lib/ngpvan_public_event_listing/client.rb', line 10

def initialize(attrs = {})
  attrs.each do |key,value|
    if self.respond_to?("#{key}=")
      self.send("#{key}=", value)
    end
  end
end

Instance Attribute Details

#event_listObject

Returns the value of attribute event_list.



8
9
10
# File 'lib/ngpvan_public_event_listing/client.rb', line 8

def event_list
  @event_list
end

#hostObject

Returns the value of attribute host.



8
9
10
# File 'lib/ngpvan_public_event_listing/client.rb', line 8

def host
  @host
end

#modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/ngpvan_public_event_listing/client.rb', line 8

def mode
  @mode
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/ngpvan_public_event_listing/client.rb', line 8

def password
  @password
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/ngpvan_public_event_listing/client.rb', line 8

def username
  @username
end

Instance Method Details

#event_list?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ngpvan_public_event_listing/client.rb', line 18

def event_list?
  mode == 'event-list'
end

#eventsObject



26
27
28
29
30
31
32
# File 'lib/ngpvan_public_event_listing/client.rb', line 26

def events
  if event_list?
    load_from_event_list
  else
    load_from_public_site
  end
end

#public_site?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ngpvan_public_event_listing/client.rb', line 22

def public_site?
  mode == 'public-site'
end