me2api-ruby 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- me2api-ruby (0.1.0)
4
+ me2api-ruby (0.1.1)
5
5
  curb (~> 0.8.0)
6
6
  json (~> 1.7.3)
7
7
  rake (~> 0.8.3)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- curb (0.8.0)
13
+ curb (0.8.1)
14
14
  json (1.7.3)
15
15
  rake (0.8.7)
16
16
  tzinfo (0.3.33)
data/lib/me2api/api.rb CHANGED
@@ -112,7 +112,7 @@ module Me2API
112
112
  end
113
113
 
114
114
  def get_bands(options = {})
115
- resp = agent.call('get_bands')
115
+ resp = agent.call('get_bands', options)
116
116
  resp.map { |b| Band.new(b) }
117
117
  end
118
118
 
@@ -1,4 +1,10 @@
1
1
  module Me2API
2
2
  class Band < Model
3
+ def leader
4
+ if self[:leader].has_key?(:member)
5
+ self[:leader] = Member.new(self[:leader][:member])
6
+ end
7
+ self[:leader]
8
+ end
3
9
  end
4
10
  end
@@ -0,0 +1,4 @@
1
+ module Me2API
2
+ class Member < Model
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Me2API
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/me2api.rb CHANGED
@@ -14,4 +14,5 @@ require "me2api/model/comment"
14
14
  require "me2api/model/metoo"
15
15
  require "me2api/model/setting"
16
16
  require "me2api/model/band"
17
+ require "me2api/model/member"
17
18
  require "me2api/model/friendship_request"
data/test/api_test.rb CHANGED
@@ -220,4 +220,20 @@ class APITest < Test::Unit::TestCase
220
220
  assert_nothing_raised { resp = @api.delete_post(post.post_id) }
221
221
  assert_equal(0, resp.code)
222
222
  end
223
+
224
+ def test_get_bands
225
+ bands = @api.get_bands
226
+ assert(bands.length > 0)
227
+ band = bands.first
228
+ assert_equal(BAND_ID, band.band_id)
229
+ assert_equal(USER_ID, band.leader.id)
230
+ end
231
+
232
+ def test_get_bands_with_band_id
233
+ bands = @api.get_bands(:band_id => BAND_ID)
234
+ assert(bands.length > 0)
235
+ band = bands.first
236
+ assert_equal(BAND_ID, band.band_id)
237
+ assert_equal(USER_ID, band.leader.id)
238
+ end
223
239
  end
data/test/test_helper.rb CHANGED
@@ -7,6 +7,7 @@ module Me2APICommon
7
7
  APPKEY = '40e05bcc74bb61fcfa30ed8ef9ae6107'
8
8
  USER_ID = 'm2test100'
9
9
  APIKEY = '34372730'
10
+ BAND_ID = 'btest100'
10
11
 
11
12
  def setup
12
13
  @api = Me2API::API.new(
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: me2api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Heungseok Do
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-29 00:00:00 Z
18
+ date: 2012-06-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake
@@ -106,6 +106,7 @@ files:
106
106
  - lib/me2api/model/band.rb
107
107
  - lib/me2api/model/comment.rb
108
108
  - lib/me2api/model/friendship_request.rb
109
+ - lib/me2api/model/member.rb
109
110
  - lib/me2api/model/metoo.rb
110
111
  - lib/me2api/model/person.rb
111
112
  - lib/me2api/model/post.rb