Class: ActiveInTime::SiteProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/ait_connect/site_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(active_in_time) ⇒ SiteProxy

Returns a new instance of SiteProxy.



3
4
5
# File 'lib/ait_connect/site_proxy.rb', line 3

def initialize(active_in_time)
  @active_in_time = active_in_time
end

Instance Method Details

#find(id) ⇒ Object



7
8
9
# File 'lib/ait_connect/site_proxy.rb', line 7

def find(id)
  ActiveInTime::Site.new(@active_in_time, @active_in_time.get("sites/#{id}"))
end

#nearby(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
# File 'lib/ait_connect/site_proxy.rb', line 11

def nearby(options={})
  raise ArgumentError, "You must include :ll" unless options[:ll]
  
  sites = []
  response = @active_in_time.get('sites', options).each do |site_json|
    sites << ActiveInTime::Site.new(@active_in_time, site_json)
  end
  
  sites
end