campfire_export 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'bundler'
2
3
  Bundler::GemHelper.install_tasks
3
4
 
@@ -1,3 +1,3 @@
1
1
  module CampfireExport
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -143,10 +143,9 @@ module CampfireExport
143
143
  end
144
144
 
145
145
  def find_timezone
146
- settings = Nokogiri::HTML get('/account/settings').body
147
- selected_zone = settings.css('select[id="account_time_zone_id"] ' +
148
- '> option[selected="selected"]')
149
- Account.timezone = find_tzinfo(selected_zone.attribute("value").text)
146
+ settings = Nokogiri::XML get('/account.xml').body
147
+ selected_zone = settings.css('time-zone')
148
+ Account.timezone = find_tzinfo(selected_zone.text)
150
149
  end
151
150
 
152
151
  def rooms
@@ -8,13 +8,23 @@ module CampfireExport
8
8
  @api_token = "test-apikey"
9
9
  @account = Account.new(@subdomain, @api_token)
10
10
 
11
- @good_timezone = '<select id="account_time_zone_id">' +
12
- '<option selected="selected" value="America/Los_Angeles">' +
13
- '</option></select>'
11
+ @good_timezone = '<?xml version="1.0" encoding="UTF-8"?>' +
12
+ '<account>' +
13
+ ' <time-zone>America/Los_Angeles</time-zone>' +
14
+ ' <owner-id type="integer">99999</owner-id>' +
15
+ ' <created-at type="datetime">2010-01-31T18:30:18Z</created-at>' +
16
+ ' <storage type="integer">9999999</storage>' +
17
+ ' <plan>basic</plan>' +
18
+ ' <updated-at type="datetime">2010-01-31T18:31:55Z</updated-at>' +
19
+ ' <subdomain>example</subdomain>' +
20
+ ' <name>Example</name>' +
21
+ ' <id type="integer">999999</id>' +
22
+ '</account>'
23
+
14
24
  @bad_timezone = @good_timezone.gsub('America/Los_Angeles',
15
25
  'No Such Timezone')
16
- @timezone_html = stub("timezone HTML block")
17
- @timezone_html.stub(:body).and_return(@good_timezone)
26
+ @account_xml = stub("Account XML")
27
+ @account_xml.stub(:body).and_return(@good_timezone)
18
28
  end
19
29
 
20
30
  context "when it is created" do
@@ -27,23 +37,23 @@ module CampfireExport
27
37
 
28
38
  context "when timezone is loaded" do
29
39
  it "determines the user's timezone" do
30
- @account.should_receive(:get).with("/account/settings"
31
- ).and_return(@timezone_html)
40
+ @account.should_receive(:get).with("/account.xml"
41
+ ).and_return(@account_xml)
32
42
  @account.find_timezone
33
43
  Account.timezone.to_s.should == "America - Los Angeles"
34
44
  end
35
45
 
36
46
  it "raises an error if it gets a bad time zone identifier" do
37
- @timezone_html.stub(:body).and_return(@bad_timezone)
38
- @account.stub(:get).with("/account/settings"
39
- ).and_return(@timezone_html)
47
+ @account_xml.stub(:body).and_return(@bad_timezone)
48
+ @account.stub(:get).with("/account.xml"
49
+ ).and_return(@account_xml)
40
50
  expect {
41
51
  @account.find_timezone
42
52
  }.to raise_error(TZInfo::InvalidTimezoneIdentifier)
43
53
  end
44
54
 
45
55
  it "raises an error if it can't get the account settings at all" do
46
- @account.stub(:get).with("/account/settings"
56
+ @account.stub(:get).with("/account.xml"
47
57
  ).and_raise(CampfireExport::Exception.new("/account/settings",
48
58
  "Not Found", 404))
49
59
  expect {
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marc Hedlund
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-04 00:00:00 -04:00
17
+ date: 2011-08-09 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency