rixi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/lib/rixi.rb +16 -6
  3. data/rixi.gemspec +2 -2
  4. data/sample_safari.rb +10 -0
  5. metadata +15 -15
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/rixi.rb CHANGED
@@ -60,6 +60,9 @@ class Rixi
60
60
  # 手抜き実装のため、長いメソッド名の乱立で非常に汚いです
61
61
  # メソッド名は適当なので好きなように変えて使ってください
62
62
  # %s の部分が各種メソッドの引数になります
63
+ #
64
+ # 次期バージョンが出来るとするならAPIの種類毎に
65
+ # モジュールに切り分けて実装したいです。
63
66
  #
64
67
  # 注:%d は省略可能なpathを表現するために使ってます
65
68
  # 例えば、友人のつぶやき一覧の取得をするAPIは以下で、
@@ -104,7 +107,7 @@ class Rixi
104
107
  create_comment_album /2/photo/comments/albums/%s/@self/%s post
105
108
  delete_comment_album /2/photo/comments/albums/%s/@self/%s/%s delete
106
109
  create_comment_media /2/photo/comments/mediaItems/%s/@self/%s/%s/ delete
107
-    create_favorite_media /2/photo/favorites/mediaItems/%s/@self/%s/%s/ post
110
+ create_favorite_media /2/photo/favorites/mediaItems/%s/@self/%s/%s/ post
108
111
  delete_favorite_media /2/photo/favorites/mediaItems/%s/@self/%s/%s/ delete
109
112
  messages_inbox /2/messages/%s/@inbox/%o get
110
113
  messages_outbox /2/messages/%s/@outbox/%o get
@@ -147,37 +150,44 @@ class Rixi
147
150
  # define_methodで定義されたメソッドは最終的に
148
151
  # これらのメソッドを呼ぶ
149
152
  def get(path, params = { })
150
- @token.refresh! if @token.expired?
153
+ extend_expire()
151
154
  parse_response(@token.get(path,
152
155
  {:mode => :query,
153
156
  :params => params.merge({:oauth_token => @token.token})}))
154
157
  end
155
158
 
156
159
  def post(path, params = { })
157
- @token.refresh! if @token.expired?
160
+ extend_expire()
158
161
  parse_response(@token.post(path,
159
162
  {:mode => :body,
160
163
  :params => params.merge({:oauth_token => @token.token})}))
161
164
  end
162
165
 
163
166
  def delete(path, params = { })
164
- @token.refresh! if @token.expired?
167
+ extend_expire()
165
168
  parse_response(@token.delete(path,
166
169
  {:mode => :body,
167
170
  :params => params.merge({:oauth_token => @token.token})}))
168
171
  end
169
172
 
170
173
  def put(path, params = { })
171
- @token.refresh! if @token.expired?
174
+ extend_expire()
172
175
  parse_response(@token.put(path,
173
176
  {:mode => :body,
174
177
  :params => params.merge({:oauth_token => @token.token})}))
175
178
  end
176
179
 
180
+ # OAuth2::AccessTokenの仕様上破壊的代入が出来ないため...
181
+ def extend_expire
182
+ if @token.expired?
183
+ @token = @token.refresh!
184
+ end
185
+ end
186
+
177
187
  # mixiボイスの投稿を楽にするため
178
188
  # Update APIとかぶるか?!
179
189
  def voice_update(status)
180
- voice_statuses_update(:statsu => status)
190
+ voice_statuses_update(:statsus => status)
181
191
  end
182
192
 
183
193
  def parse_response(res)
data/rixi.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rixi}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{ainame }]
12
- s.date = %q{2011-08-17}
12
+ s.date = %q{2011-08-18}
13
13
  s.description = %q{Rixi is a simply library for mixi graph api in Ruby.}
14
14
  s.email = %q{ainame954@facebook.com}
15
15
  s.extra_rdoc_files = [
data/sample_safari.rb CHANGED
@@ -37,6 +37,16 @@ scope = {
37
37
  :r_profile => true,
38
38
  :w_profile => true,
39
39
  :r_profile_status => true,
40
+ :r_profile_gender => true,
41
+ :r_profile_birthday => true,
42
+ :r_profile_blood_type => true,
43
+ :r_profile_location => true,
44
+ :r_profile_hometown => true,
45
+ :r_profile_about_me => true,
46
+ :r_profile_occupation => true,
47
+ :r_profile_interests => true,
48
+ :r_profile_favorite_things => true,
49
+ :r_profile_organizations => true,
40
50
  :r_voice => true,
41
51
  :w_voice => true,
42
52
  :w_share => true,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rixi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-17 00:00:00.000000000Z
12
+ date: 2011-08-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
16
- requirement: &70263475593960 !ruby/object:Gem::Requirement
16
+ requirement: &70149873289960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70263475593960
24
+ version_requirements: *70149873289960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70263475593120 !ruby/object:Gem::Requirement
27
+ requirement: &70149873288680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70263475593120
35
+ version_requirements: *70149873288680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70263475588320 !ruby/object:Gem::Requirement
38
+ requirement: &70149873287700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.3.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70263475588320
46
+ version_requirements: *70149873287700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70263475587560 !ruby/object:Gem::Requirement
49
+ requirement: &70149873286860 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70263475587560
57
+ version_requirements: *70149873286860
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70263475586900 !ruby/object:Gem::Requirement
60
+ requirement: &70149873286100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70263475586900
68
+ version_requirements: *70149873286100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70263475586000 !ruby/object:Gem::Requirement
71
+ requirement: &70149873285280 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70263475586000
79
+ version_requirements: *70149873285280
80
80
  description: Rixi is a simply library for mixi graph api in Ruby.
81
81
  email: ainame954@facebook.com
82
82
  executables: []
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: 2920484962120584961
116
+ hash: 1741242612359883089
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements: