File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def extract_and_save_meta
3939 end
4040
4141 def extract_and_save_expansions
42- @expansions = @response [ 'includes' ]
42+ @expansions = Expansions . new ( @response [ 'includes' ] )
4343 end
4444
4545 def extract_and_save_options ( **options )
@@ -186,7 +186,33 @@ def initialize(expansions)
186186 @places = expansions [ 'places' ]
187187 @polls = expansions [ 'polls' ]
188188 @tweets = expansions [ 'tweets' ]
189- @users = expansions [ 'users' ]
189+ @users = Users . new ( expansions [ 'users' ] )
190+ end
191+
192+ class Tweets
193+ attr_accessor :tweets
194+
195+ def initialize ( tweets )
196+ @tweets = tweets . collect { |tweet | Tweet . new ( tweet ) }
197+ end
198+ end
199+
200+ class Users
201+ attr_accessor :users
202+
203+ def initialize ( users )
204+ @users = users . collect { |user | User . new ( user ) }
205+ end
206+
207+ class User
208+ attr_accessor :id , :name , :username
209+
210+ def initialize ( user )
211+ @id = user [ 'id' ]
212+ @name = user [ 'name' ]
213+ @username = user [ 'username' ]
214+ end
215+ end
190216 end
191217 end
192218
You can’t perform that action at this time.
0 commit comments