Sha256: 04cc7799e30d922059ef544f0fc58817a726ffa312059b8cfcaafc6d4dc206ef

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

module CampfireExport
  class Account
    include CampfireExport::IO
    include CampfireExport::TimeZone

    @subdomain = ""
    @api_token = ""
    @base_url  = ""
    @timezone  = nil

    class << self
      attr_accessor :subdomain, :api_token, :base_url, :timezone
    end

    def initialize(subdomain, api_token)
      Account.subdomain = subdomain
      Account.api_token = api_token
      Account.base_url  = "https://#{subdomain}.campfirenow.com"
    end

    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

    def rooms
      doc = Nokogiri::XML get('/rooms.xml').body
      doc.xpath('/rooms/room').map {|room_xml| Room.new(room_xml) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stackbuilders-campfire_export-0.5.1 lib/campfire_export/account.rb
stackbuilders-campfire_export-0.5.0 lib/campfire_export/account.rb
stackbuilders-campfire_export-0.4.1 lib/campfire_export/account.rb
stackbuilders-campfire_export-0.4.0 lib/campfire_export/account.rb