twin 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/twin/resources.rb +41 -1
  2. metadata +4 -4
@@ -50,7 +50,12 @@ class Twin
50
50
  end
51
51
 
52
52
  resource 'statuses/(?:replies|mentions)' do
53
- respond_with('statuses', [])
53
+ statuses = if self.model.respond_to?(:mentions)
54
+ self.model.mentions(params.with_indifferent_access, current_user)
55
+ else
56
+ []
57
+ end
58
+ respond_with('statuses', normalize_statuses(statuses))
54
59
  end
55
60
 
56
61
  resource '(\w+)/lists(/subscriptions)?' do
@@ -89,6 +94,41 @@ class Twin
89
94
  not_implemented
90
95
  end
91
96
 
97
+ resource 'promoted_tweets/search' do
98
+ # params['q']
99
+ respond_with(nil, {"promoted_tweets" => []})
100
+ end
101
+
102
+ resource 'favorites/toptweets' do
103
+ not_implemented
104
+ end
105
+
106
+ resource 'favorites(?:/(\w+))?' do
107
+ statuses = if self.model.respond_to?(:favorites)
108
+ self.model.favorites(params.with_indifferent_access, current_user, captures[0])
109
+ else
110
+ []
111
+ end
112
+ respond_with('statuses', normalize_statuses(statuses))
113
+ end
114
+
115
+ resource 'favorites/(create|destroy)/(\w+)' do
116
+ action = "#{captures[0]}_favorite"
117
+ self.model.send(action, captures[1], current_user)
118
+ ''
119
+ end
120
+
121
+ resource 'statuses/retweet/(\w+)' do
122
+ self.model.retweet(captures[0], current_user)
123
+ ''
124
+ end
125
+
126
+ resource 'statuses/update' do
127
+ status = self.model.status_update(params.with_indifferent_access, current_user)
128
+ status = normalize_statuses(Array === status ? status : [status]).first
129
+ respond_with('status', status)
130
+ end
131
+
92
132
  DEFAULT_STATUS_PARAMS = {
93
133
  :id => nil,
94
134
  :text => "",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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-11-05 00:00:00.000000000 Z
12
+ date: 2011-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70155972080040 !ruby/object:Gem::Requirement
16
+ requirement: &70364211094580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70155972080040
24
+ version_requirements: *70364211094580
25
25
  description: Rack middleware to expose a Twitter-like API in your app.
26
26
  email: mislav.marohnic@gmail.com
27
27
  executables: []