boxnet 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Boxnet
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/file_node.rb CHANGED
@@ -5,17 +5,27 @@ module Boxnet
5
5
  def process_node(data)
6
6
  @files = []
7
7
  @folders = []
8
-
8
+
9
9
  if data["folder"]
10
10
  self.folders << Folder.new(data["folder"])
11
11
  elsif data["folders"]
12
- data["folders"]["folder"].each do |folder|
12
+ folder = data["folders"]["folder"]
13
+ if folder.class == Array
14
+ folder.each do |f|
15
+ self.folders << Folder.new(f)
16
+ end
17
+ elsif folder.class == Hash
13
18
  self.folders << Folder.new(folder)
14
19
  end
15
20
  end
16
21
 
17
22
  if data["files"]
18
- data["files"]["file"].each do |file|
23
+ file = data["files"]["file"]
24
+ if file.class == Array
25
+ file.each do |f|
26
+ self.files << File.new(f)
27
+ end
28
+ elsif file.class == Hash
19
29
  self.files << File.new(file)
20
30
  end
21
31
  end
@@ -3,17 +3,22 @@ require 'spec_helper'
3
3
  describe "get account tree" do
4
4
  before(:each) do
5
5
  Boxnet::Client.API_KEY = ENV["BOXNET_API_KEY"]
6
- @auth_token = ENV["BOXNET_AUTHTOKEN"]
7
6
  end
8
7
 
9
8
  context "entire tree from root" do
10
- before(:each) do
9
+ before(:each) do
10
+ @auth_token = "d402qzspvmk46zo6l59kcplaidmza76o"
11
11
  @result = Boxnet::Client.get_account_tree(@auth_token, "0")
12
12
  end
13
13
  it { @result.should_not be_nil }
14
- it { @result.status.should == "listing_ok" }
15
- it { @result.file_tree.should_not be_nil }
16
- it { @result.file_tree.folders.count.should > 0 }
17
- it { @result.file_tree.folders.first.folders.first.files.count.should > 0 }
18
14
  end
15
+
16
+ context "entire tree from root" do
17
+ before(:each) do
18
+ @auth_token = "vgp6hb8kjpxbctlmrrigdmvz2fyqpvib"
19
+ @result = Boxnet::Client.get_account_tree(@auth_token, "0")
20
+ end
21
+ it { @result.should_not be_nil }
22
+ end
23
+
19
24
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: boxnet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jonathan Birkholz
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-21 00:00:00 Z
13
+ date: 2011-11-25 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec