Class: ActiveInTime::Site
- Inherits:
-
Object
- Object
- ActiveInTime::Site
- Defined in:
- lib/ait_connect/site.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
- #address_line_1 ⇒ Object
- #address_line_2 ⇒ Object
- #borough ⇒ Object
-
#contact ⇒ Object
Contact info.
- #country ⇒ Object
- #email ⇒ Object
- #facilities ⇒ Object
- #fetch ⇒ Object
- #id ⇒ Object
-
#initialize(active_in_time, json) ⇒ Site
constructor
A new instance of Site.
- #latitude ⇒ Object
- #longitude ⇒ Object
- #management ⇒ Object
- #name ⇒ Object
- #post_code ⇒ Object
- #post_town ⇒ Object
- #telephone ⇒ Object
- #timetables ⇒ Object
- #tldc_approved ⇒ Object
- #website ⇒ Object
Constructor Details
#initialize(active_in_time, json) ⇒ Site
Returns a new instance of Site.
5 6 7 |
# File 'lib/ait_connect/site.rb', line 5 def initialize(active_in_time, json) @active_in_time, @json = active_in_time, json end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
3 4 5 |
# File 'lib/ait_connect/site.rb', line 3 def json @json end |
Instance Method Details
#address_line_1 ⇒ Object
46 47 48 |
# File 'lib/ait_connect/site.rb', line 46 def address_line_1 self.contact['address_line_1'] end |
#address_line_2 ⇒ Object
50 51 52 |
# File 'lib/ait_connect/site.rb', line 50 def address_line_2 self.contact['address_line_2'] end |
#borough ⇒ Object
42 43 44 |
# File 'lib/ait_connect/site.rb', line 42 def borough self.contact['borough'] end |
#contact ⇒ Object
Contact info
30 31 32 |
# File 'lib/ait_connect/site.rb', line 30 def contact @json["contact"] end |
#country ⇒ Object
38 39 40 |
# File 'lib/ait_connect/site.rb', line 38 def country self.contact['country'] end |
#email ⇒ Object
70 71 72 |
# File 'lib/ait_connect/site.rb', line 70 def email self.contact['email'] end |
#facilities ⇒ Object
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ait_connect/site.rb', line 88 def facilities return [] if !@json["facilities"] || @json["facilities"].empty? facilities = [] json['facilities'].each do |facility| facilities << ActiveInTime::Facility.new(@active_in_time, facility) end facilities end |
#fetch ⇒ Object
9 10 11 12 |
# File 'lib/ait_connect/site.rb', line 9 def fetch @json = @active_in_time.get("sites/#{id}") self end |
#id ⇒ Object
14 15 16 |
# File 'lib/ait_connect/site.rb', line 14 def id @json["id"] end |
#latitude ⇒ Object
58 59 60 |
# File 'lib/ait_connect/site.rb', line 58 def latitude self.contact['latitude'] end |
#longitude ⇒ Object
62 63 64 |
# File 'lib/ait_connect/site.rb', line 62 def longitude self.contact['longitude'] end |
#management ⇒ Object
99 100 101 102 |
# File 'lib/ait_connect/site.rb', line 99 def management return {} if @json["management"].blank? return ActiveInTime::Management.new(@active_in_time,@json["management"]) end |
#name ⇒ Object
22 23 24 |
# File 'lib/ait_connect/site.rb', line 22 def name @json["name"] end |
#post_code ⇒ Object
54 55 56 |
# File 'lib/ait_connect/site.rb', line 54 def post_code self.contact['post_code'] end |
#post_town ⇒ Object
34 35 36 |
# File 'lib/ait_connect/site.rb', line 34 def post_town self.contact['post_town'] end |
#telephone ⇒ Object
66 67 68 |
# File 'lib/ait_connect/site.rb', line 66 def telephone self.contact['telephone'] end |
#timetables ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/ait_connect/site.rb', line 78 def return [] if !@json["timetables"] || @json["timetables"].empty? = [] @json['timetables'].each do || << ActiveInTime::Timetable.new(@active_in_time, ) end end |
#tldc_approved ⇒ Object
18 19 20 |
# File 'lib/ait_connect/site.rb', line 18 def tldc_approved @json['tldc_approved'] end |
#website ⇒ Object
74 75 76 |
# File 'lib/ait_connect/site.rb', line 74 def website self.contact['website'] end |