Class: CampfireExport::Account
- Inherits:
-
Object
- Object
- CampfireExport::Account
- Defined in:
- lib/campfire_export.rb
Constant Summary
Constants included from TimeZone
Class Attribute Summary collapse
-
.api_token ⇒ Object
Returns the value of attribute api_token.
-
.base_url ⇒ Object
Returns the value of attribute base_url.
-
.subdomain ⇒ Object
Returns the value of attribute subdomain.
-
.timezone ⇒ Object
Returns the value of attribute timezone.
Instance Method Summary collapse
- #find_timezone ⇒ Object
-
#initialize(subdomain, api_token) ⇒ Account
constructor
A new instance of Account.
- #rooms ⇒ Object
Methods included from TimeZone
Methods included from IO
#api_url, #export_dir, #export_file, #get, #log, #verify_export, #zero_pad
Constructor Details
#initialize(subdomain, api_token) ⇒ Account
Returns a new instance of Account.
139 140 141 142 143 |
# File 'lib/campfire_export.rb', line 139 def initialize(subdomain, api_token) Account.subdomain = subdomain Account.api_token = api_token Account.base_url = "https://#{subdomain}.campfirenow.com" end |
Class Attribute Details
.api_token ⇒ Object
Returns the value of attribute api_token.
136 137 138 |
# File 'lib/campfire_export.rb', line 136 def api_token @api_token end |
.base_url ⇒ Object
Returns the value of attribute base_url.
136 137 138 |
# File 'lib/campfire_export.rb', line 136 def base_url @base_url end |
.subdomain ⇒ Object
Returns the value of attribute subdomain.
136 137 138 |
# File 'lib/campfire_export.rb', line 136 def subdomain @subdomain end |
.timezone ⇒ Object
Returns the value of attribute timezone.
136 137 138 |
# File 'lib/campfire_export.rb', line 136 def timezone @timezone end |
Instance Method Details
#find_timezone ⇒ Object
145 146 147 148 149 |
# File 'lib/campfire_export.rb', line 145 def find_timezone settings = Nokogiri::XML get('/account.xml').body selected_zone = settings.xpath('/account/time-zone') Account.timezone = find_tzinfo(selected_zone.text) end |
#rooms ⇒ Object
151 152 153 154 |
# File 'lib/campfire_export.rb', line 151 def rooms doc = Nokogiri::XML get('/rooms.xml').body doc.xpath('/rooms/room').map {|room_xml| Room.new(room_xml) } end |