rixi 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/VERSION +1 -1
  2. data/lib/rixi.rb +78 -15
  3. data/rixi.gemspec +1 -3
  4. metadata +14 -16
  5. data/.document +0 -5
  6. data/Gemfile.lock +0 -42
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
@@ -55,34 +55,91 @@ class Rixi
55
55
  .get_token(code,
56
56
  {:redirect_uri => @redirect_uri})
57
57
  end
58
-
58
+
59
+ #
60
+ # 手抜き実装のため、長いメソッド名の乱立で非常に汚いです
61
+ # メソッド名は適当なので好きなように変えて使ってください
62
+ # %s の部分が各種メソッドの引数になります
63
+ #
64
+ # 注:%d は省略可能なpathを表現するために使ってます
65
+ # 例えば、友人のつぶやき一覧の取得をするAPIは以下で、
66
+ # /2/voice/statuses/friends_timeline/[Group-ID]?since_id=[つぶやきのID]
67
+ # Group-IDはpathにも含まれますが省略可能です
68
+ # そのような場合は、最後の引数のハッシュで:optional_pathのキーで
69
+ # 指定するとして、:optional_pathが存在しなければAPIのパスから
70
+ # 省略することとします。
71
+ #
72
+ # 注2:mixiチェック用API /2/share はPOSTメソッドでリクエストする際に、
73
+ # データをJSON形式で与えるため、未実装です。
74
+ #
75
+ # 注3:DiaryAPIもmultipart/form-data形式として投稿しなければならないため
76
+ # 現状、未実装です
77
+ #
78
+ # 注4:画像投稿系のAPIは未対応です
79
+ #
59
80
  def self.api_settings
60
81
  # method name, path for API endpoints, http method
61
- "people /2/people/%s/%s get
62
- user_timeline /2/voice/statuses/%s/user_timeline get
63
- friends_timeline /2/voice/statuses/%s/user_timeline get
64
- show_status /2/voice/statuses/show/%s get
65
- update_status /2/voice/statuses/update post
66
- delete_status /2/voice/statuses/destroy/%s post
67
- create_reply /2/voice/statuses/replies/create/%s post
68
- delete_reply /2/voice/replies/destroy/%s/%s post
69
- show_favorites_on_voice /2/voice/favorites/show/%s get
70
- favorite_to_voice /2/voice/favorites/create/%s post
71
- delete_favorite_to_voice /2/voice/favorites/destory/%s/%s post
82
+ "people /2/people/%s/%s get
83
+ search_people /2/search/people/%s get
84
+ updates /2/updates/%s/%s get
85
+ user_timeline /2/voice/statuses/%s/user_timeline get
86
+ friends_timeline /2/voice/statuses/%s/friends_timeline/%o get
87
+ show_status /2/voice/statuses/show/%s get
88
+ show_favorites /2/voice/favorites/show/%s get
89
+ update_status /2/voice/statuses/update post
90
+ delete_statsu /2/voice/statuses/destroy/%s post
91
+ create_replies /2/voice/statuses/replies/create/%s post
92
+ delete_replies /2/voice/replies/destroy/%s/%s post
93
+ create_favorite /2/voice/favorites/create/%s post
94
+ delete_favorite /2/voice/favorites/destory/%s/%s post
95
+ album /2/photo/albums/%s/@self/%o get
96
+ recent_album /2/photo/albums/%s/%s get
97
+ mediaitmes /2/photo/mediaItems/%s/@self/%s/%o get
98
+ recent_media /2/photo/mediaItems/%s/%o      get
99
+ comments_album /2/photo/comments/albums/%s/@self/%s get
100
+ comments_media /2/photo/comments/mediaItems/%s/@self/%s/%s get
101
+ favorites_media /2/phoho/favorites/mediaItems/%s/@self/%s/%s get
102
+ create_album /2/photo/albums/%s/@self post
103
+ delete_album /2/photo/albums/%s/@self/%s delete
104
+ create_comment_album /2/photo/comments/albums/%s/@self/%s post
105
+ delete_comment_album /2/photo/comments/albums/%s/@self/%s/%s delete
106
+ 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
108
+ delete_favorite_media /2/photo/favorites/mediaItems/%s/@self/%s/%s/ delete
109
+ messages_inbox /2/messages/%s/@inbox/%o get
110
+ messages_outbox /2/messages/%s/@outbox/%o get
111
+ create_message /2/messages/%s/@self/@outbox post
112
+ read_message /2/messages/%s/@self/@inbox/%s put
113
+ delete_inbox /2/messages/%s/@self/@inbox/%s put
114
+ delete_outbox /2/messages/%s/@self/@outbox/%s delete
115
+ people_images /2/people/images/%s/@self/%o get
116
+ create_people_image /2/people/images/%s/@self post
117
+ set_people_image /2/people/images/%s/@self/%s put
118
+ delete_people_imag /2/people/images/%s/@self/%s delete
72
119
  ".strip.split("\n").map {|l| l.strip.split(/\s+/)}
73
120
  end
74
-
121
+
75
122
  api_settings.each do |api|
76
123
  method_name, path, http_method = *api
77
124
  http_method ||= 'get'
78
125
  if /%s/ =~ path
79
126
  define_method method_name do |*args|
80
127
  params = args.last.kind_of?(Hash) ? args.pop : { }
81
- send http_method, path % args, params
128
+ __send__ http_method, path % args, params
82
129
  end
130
+ elsif /%o/ =~ path
131
+ define_method method_name do |*args|
132
+ params = args.last.kind_of?(Hash) ? args.pop : { }
133
+ if params.key? :optional_path
134
+ path.sub!("%o",params[:optional_path].to_s)
135
+ else
136
+ path.sub!("/%o","")
137
+ end
138
+ __send__ http_method, path % args, params
139
+ end
83
140
  else
84
141
  define_method method_name do |params = { }|
85
- send http_method, path, params
142
+ __send__ http_method, path, params
86
143
  end
87
144
  end
88
145
  end
@@ -103,6 +160,12 @@ class Rixi
103
160
  :params => params.merge({:oauth_token => @token.token})}))
104
161
  end
105
162
 
163
+ # mixiボイスの投稿を楽にするため
164
+ # Update APIとかぶるか?!
165
+ def voice_update(status)
166
+ voice_statuses_update(:statsu => status)
167
+ end
168
+
106
169
  def parse_response(res)
107
170
  res = res.response.env
108
171
  case res[:status].to_i
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rixi}
8
- s.version = "0.0.0"
8
+ s.version = "0.1.0"
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 }]
@@ -17,10 +17,8 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".document",
21
20
  ".rspec",
22
21
  "Gemfile",
23
- "Gemfile.lock",
24
22
  "LICENSE.txt",
25
23
  "README.rdoc",
26
24
  "Rakefile",
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.0.0
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
16
- requirement: &70231599481800 !ruby/object:Gem::Requirement
16
+ requirement: &70255016513840 !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: *70231599481800
24
+ version_requirements: *70255016513840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70231599480420 !ruby/object:Gem::Requirement
27
+ requirement: &70255016512600 !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: *70231599480420
35
+ version_requirements: *70255016512600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70231599479420 !ruby/object:Gem::Requirement
38
+ requirement: &70255016510960 !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: *70231599479420
46
+ version_requirements: *70255016510960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70231599478440 !ruby/object:Gem::Requirement
49
+ requirement: &70255016509340 !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: *70231599478440
57
+ version_requirements: *70255016509340
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70231599477400 !ruby/object:Gem::Requirement
60
+ requirement: &70255016508280 !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: *70231599477400
68
+ version_requirements: *70255016508280
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70231599473880 !ruby/object:Gem::Requirement
71
+ requirement: &70255016507320 !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: *70231599473880
79
+ version_requirements: *70255016507320
80
80
  description: Rixi is a simply library for mixi graph api in Ruby.
81
81
  email: ainame954@facebook.com
82
82
  executables: []
@@ -85,10 +85,8 @@ extra_rdoc_files:
85
85
  - LICENSE.txt
86
86
  - README.rdoc
87
87
  files:
88
- - .document
89
88
  - .rspec
90
89
  - Gemfile
91
- - Gemfile.lock
92
90
  - LICENSE.txt
93
91
  - README.rdoc
94
92
  - Rakefile
@@ -115,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
113
  version: '0'
116
114
  segments:
117
115
  - 0
118
- hash: 3290286285413237058
116
+ hash: -1412310983917155515
119
117
  required_rubygems_version: !ruby/object:Gem::Requirement
120
118
  none: false
121
119
  requirements:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
@@ -1,42 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- addressable (2.2.6)
5
- diff-lcs (1.1.2)
6
- faraday (0.7.4)
7
- addressable (~> 2.2.6)
8
- multipart-post (~> 1.1.0)
9
- rack (>= 1.1.0, < 2)
10
- git (1.2.5)
11
- jeweler (1.6.4)
12
- bundler (~> 1.0)
13
- git (>= 1.2.5)
14
- rake
15
- json (1.5.3)
16
- multi_json (1.0.3)
17
- multipart-post (1.1.3)
18
- oauth2 (0.5.0)
19
- faraday (< 0.8, >= 0.6.1)
20
- multi_json (~> 1.0.0)
21
- rack (1.3.2)
22
- rake (0.9.2)
23
- rcov (0.9.10)
24
- rspec (2.3.0)
25
- rspec-core (~> 2.3.0)
26
- rspec-expectations (~> 2.3.0)
27
- rspec-mocks (~> 2.3.0)
28
- rspec-core (2.3.1)
29
- rspec-expectations (2.3.0)
30
- diff-lcs (~> 1.1.2)
31
- rspec-mocks (2.3.0)
32
-
33
- PLATFORMS
34
- ruby
35
-
36
- DEPENDENCIES
37
- bundler (>= 1.0.0)
38
- jeweler (~> 1.6.4)
39
- json
40
- oauth2
41
- rcov
42
- rspec (>= 2.3.0)