fluxapi 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'rake/testtask'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('fluxapi', '0.5.4') do |p|
6
+ Echoe.new('fluxapi', '0.5.5') do |p|
7
7
  p.description = "A fluxiom api wrapper for ruby"
8
8
  p.url = "http://fluxapi.rubyforge.org"
9
9
  p.author = "Sebastian Gräßl"
data/fluxapi.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fluxapi}
5
- s.version = "0.5.4"
5
+ s.version = "0.5.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sebastian Gr\303\244\303\237l"]
data/lib/fluxapi/asset.rb CHANGED
@@ -6,9 +6,11 @@ class Fluxiom::Asset < Fluxiom
6
6
  end
7
7
  end
8
8
  def download(path_to_file)
9
- Net::HTTP.start(self.class.base_uri.gsub('https://', ''), 443) {|http|
9
+ session = Net::HTTP.new(self.class.base_uri.gsub('https://', ''), 443)
10
+ session.use_ssl = true
11
+ session.start {|http|
10
12
  req = Net::HTTP::Get.new("/api/assets/download/#{self.id}")
11
- req.basic_auth 'account', 'password'
13
+ req.basic_auth self.class.default_options[:basic_auth][:username], self.class.default_options[:basic_auth][:password]
12
14
  resp = http.request(req)
13
15
  open(File.join(path_to_file, self.filename), 'wb') do |file|
14
16
  file.write(resp.body)
@@ -5,12 +5,13 @@ class Fluxiom::AssetTest < Test::Unit::TestCase
5
5
  def setup
6
6
  set_account
7
7
  @asset = @fluxiom.assets.first
8
- @tmp_dir = File.join(File.dirname(__FILE__), '..', 'tmp')
8
+ @tmp_dir = File.join(File.dirname(__FILE__), '..', '..', 'tmp')
9
9
  FileUtils.mkdir_p @tmp_dir
10
10
  end
11
11
 
12
12
  def test_download
13
13
  assert @asset.download(@tmp_dir).size > 0
14
+ assert File.exists?(File.join(@tmp_dir, @asset.filename))
14
15
  end
15
16
 
16
17
  def teardown
data/test/test_helper.rb CHANGED
@@ -25,7 +25,7 @@ def register_requests
25
25
  next if file == '.' || file == '..' || !file.include?('.xml')
26
26
  stub_get('/api/' + file, file)
27
27
  end
28
- FakeWeb.register_uri(:get, "http://account:password@account.fluxiom.com:443/api/assets/download/182535", :response => File.expand_path(File.dirname(__FILE__) + '/fixtures/download_response'))
28
+ FakeWeb.register_uri(:get, "https://user:password@account.fluxiom.com:443/api/assets/download/182535", :response => File.expand_path(File.dirname(__FILE__) + '/fixtures/download_response'))
29
29
  end
30
30
 
31
31
  def set_account
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluxapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Sebastian Gr\xC3\xA4\xC3\x9Fl"