xiami 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d642a22309e30720cbf1fc99ae7a359be008ba6e
4
- data.tar.gz: 18bbd20112a9cb47b3afeda855c8e43a414433e9
3
+ metadata.gz: d7bc4899719b5debb44bf95bae219579c6d376af
4
+ data.tar.gz: d6efa0a450b027240341441d599e2f09d590e2de
5
5
  SHA512:
6
- metadata.gz: a32e3ffc7d37ec7b1acfbe06deb32c21884dca7b956c2a79e6506edd50ae7f2bb3442651a0658a92037fb4fb2b7d3922afa59f17ccf3936495e83b595c619445
7
- data.tar.gz: 2f4e4bc91fdb5794cee6a98f64d8c57947866c7bc70c3b38c55d1c7d9ee1c27fee894ca7642c2dab870ce1e897cbcd51a2dcb1be6da02723530386a98ff61c46
6
+ metadata.gz: 8f0b0fe4a387b7976d169072fa9e127f3ab46a3ce1b565bbdef829d796bcf329a22b660d455ac83ed7ab17b3ea4fcb9b464adbe53bbc43cbff4664e249668a0e
7
+ data.tar.gz: 9d54cb7026b236ae59d85690ebe419028ec119f3b3671cc507ec9b79c4b86f05017408436834e945de908813cd32b6d3db78088fa548b761c0fb8b6f0d911b8f
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  .env
2
2
  pkg
3
3
  Gemfile.lock
4
+ coverage
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rspec
data/Gemfile CHANGED
@@ -7,4 +7,6 @@ group :development, :test do
7
7
  gem 'nokogiri'
8
8
  gem 'rspec', '~> 2.12.0'
9
9
  gem 'webmock'
10
+ gem 'simplecov', require: false
11
+ gem 'coveralls', require: false
10
12
  end
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
1
  # xiami gem
2
2
 
3
+ [![Build Status](https://travis-ci.org/forresty/xiami.svg)](https://travis-ci.org/forresty/xiami)
4
+ [![Code Climate](https://codeclimate.com/github/forresty/xiami/badges/gpa.svg)](https://codeclimate.com/github/forresty/xiami)
5
+ [![Coverage Status](https://coveralls.io/repos/forresty/xiami/badge.png)](https://coveralls.io/r/forresty/xiami)
6
+
3
7
  retrieve songs from xiami.com
@@ -24,6 +24,18 @@ module Xiami
24
24
  self.id == another.id
25
25
  end
26
26
 
27
+ def title
28
+ name
29
+ end
30
+
31
+ def artist_name
32
+ artist.name
33
+ end
34
+
35
+ def album_name
36
+ album.name
37
+ end
38
+
27
39
  def parse_info!
28
40
  doc = Nokogiri::XML(info_xml)
29
41
 
@@ -1,3 +1,3 @@
1
1
  module Xiami
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <trackList>
3
+ <config>
4
+ <copyright>1</copyright>
5
+ </config>
6
+ <track>
7
+ <width>257</width>
8
+ <height>33</height>
9
+ <song_name><![CDATA[Escape (The Pina Colada Song)]]></song_name>
10
+ <song_id>1773357685</song_id>
11
+ <user_id>0</user_id>
12
+ <album_id>705574889</album_id>
13
+ <album_cover><![CDATA[http://img.xiami.net/images/album/img16/37516/7055748891405574890_3.jpg]]></album_cover>
14
+ <album_name><![CDATA[Guardians of the Galaxy]]></album_name>
15
+ <artist_id>37516</artist_id>
16
+ <artist_name><![CDATA[Rupert Holmes]]></artist_name>
17
+ <location><![CDATA[6hAFlm%%1%4F513.Fk38ffda5EEnt%mei226581758mae38a44d2%-ut25..FF%E87663puyb3985-35%lpF.xc5325978%83t%7aee612E5l%%fio17F5%355_%h38295e4%%E32iam657723_El3_D3fddb155-]]></location>
18
+ <widgetCode><![CDATA[<embed src="http://www.xiami.com/widget/0_1773357685/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed>]]></widgetCode>
19
+ </track>
20
+ </trackList>
@@ -1,3 +1,9 @@
1
+ require "simplecov"
2
+ SimpleCov.start
3
+
4
+ require "coveralls"
5
+ Coveralls.wear!
6
+
1
7
  require "xiami"
2
8
 
3
9
  require "webmock"
@@ -9,24 +9,33 @@ module Xiami
9
9
  it { should respond_to :local_file_path }
10
10
  it { should respond_to :local_file_path= }
11
11
 
12
+ it { should respond_to :title }
13
+ it { should respond_to :artist_name }
14
+ it { should respond_to :album_name }
15
+
12
16
  describe '#new' do
13
17
  it 'parses data' do
14
- song = Song.new('http://www.xiami.com/song/3495768')
18
+ song = Song.new('http://www.xiami.com/song/1773357685')
19
+
20
+ song.temporary_url.should == 'http://m5.file.xiami.com/516/37516/705574889/1773357685_15603838_l.mp3?auth_key=33b783883a2ffa9e9df48e5dd456ebad-1415232000-0-null'
15
21
 
16
- song.temporary_url.should == 'http://m5.file.xiami.com/104/5104/315098/3495768_10729341_l.mp3?auth_key=4b470a652c4457234e9dabb80a90b8ba-1414454400-0-null'
22
+ song.name.should == 'Escape (The Pina Colada Song)'
23
+ song.title.should == 'Escape (The Pina Colada Song)'
24
+ song.artist_name.should == 'Rupert Holmes'
25
+ song.album_name.should == 'Guardians of the Galaxy'
17
26
 
18
- song.album.id.should == '315098'
19
- song.album.name.should == 'My Life + Best'
20
- song.album.cover_url.should == 'http://img.xiami.net/images/album/img4/5104/3150981231826033_3.jpg'
27
+ song.album.id.should == '705574889'
28
+ song.album.name.should == 'Guardians of the Galaxy'
29
+ song.album.cover_url.should == 'http://img.xiami.net/images/album/img16/37516/7055748891405574890_3.jpg'
21
30
 
22
- song.artist.id.should == '5104'
23
- song.artist.name.should == '이선희'
31
+ song.artist.id.should == '37516'
32
+ song.artist.name.should == 'Rupert Holmes'
24
33
  end
25
34
 
26
- it 'accepts song id' do
27
- song = Song.new('3495768')
35
+ it 'accepts song id as well' do
36
+ song = Song.new('1773357685')
28
37
 
29
- song.album.id.should == '315098'
38
+ song.album.id.should == '705574889'
30
39
  end
31
40
  end
32
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xiami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Forrest Ye
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - .gitignore
49
+ - .travis.yml
49
50
  - Gemfile
50
51
  - README.md
51
52
  - Rakefile
@@ -54,7 +55,7 @@ files:
54
55
  - lib/xiami/artist.rb
55
56
  - lib/xiami/song.rb
56
57
  - lib/xiami/version.rb
57
- - spec/fixtures/3495768.xml
58
+ - spec/fixtures/1773357685.xml
58
59
  - spec/spec_helper.rb
59
60
  - spec/xiami/album_spec.rb
60
61
  - spec/xiami/artist_spec.rb
@@ -85,7 +86,7 @@ signing_key:
85
86
  specification_version: 4
86
87
  summary: retrieve songs from http://xiami.com
87
88
  test_files:
88
- - spec/fixtures/3495768.xml
89
+ - spec/fixtures/1773357685.xml
89
90
  - spec/spec_helper.rb
90
91
  - spec/xiami/album_spec.rb
91
92
  - spec/xiami/artist_spec.rb
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <trackList>
3
- <config>
4
- <copyright>1</copyright>
5
- </config>
6
- <track>
7
- <width>257</width>
8
- <height>33</height>
9
- <song_name><![CDATA[J에게]]></song_name>
10
- <song_id>3495768</song_id>
11
- <user_id>0</user_id>
12
- <album_id>315098</album_id>
13
- <album_cover><![CDATA[http://img.xiami.net/images/album/img4/5104/3150981231826033_3.jpg]]></album_cover>
14
- <album_name><![CDATA[My Life + Best]]></album_name>
15
- <artist_id>5104</artist_id>
16
- <artist_name><![CDATA[이선희]]></artist_name>
17
- <location><![CDATA[4h%2Ff.moFEF5259F5_E3l3a_%b5543d8aEa14E--lt3Fmixim145EF%837174.%uk34E254a%9b-44%%ntA%5li.%%%1435%46%21m3teD7ac7eb5%814%55up%2.eac252%%1E29859_pFhy4%6429bE5b455EEl]]></location>
18
-
19
- <widgetCode><![CDATA[<embed src="http://www.xiami.com/widget/0_3495768/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed>]]></widgetCode>
20
- </track>
21
- </trackList>