@@ -4,6 +4,25 @@ class MMS < Resource
44 class << self
55 MAX_BODY_LENGTH = 160
66
7+ # Returns a resource collection containing Telapi::MMS objects
8+ #
9+ # Optional params is a hash containing:
10+ # +To+:: mobile phone number
11+ # +From+:: TelAPI or mobile phone number
12+ # +DateSent+:: date in the following format: YYYY-MM-DD
13+ # +Page+:: integer greater than 0
14+ # +PageSize+:: integer greater than 0
15+ def list ( optional_params = { } )
16+ response = Network . get ( [ 'MMS' , 'Messages' ] , optional_params )
17+ ResourceCollection . new ( response , 'mms_messages' , self )
18+ end
19+
20+ # Returns a specific Telapi::Message object given its id
21+ def get ( id )
22+ response = Network . get ( [ 'MMS' , 'Messages' , id ] )
23+ Message . new ( response )
24+ end
25+
726 # Creates an MMS Message, returning a Telapi::MMS object
827 #
928 # Required params:
@@ -15,13 +34,13 @@ class << self
1534 # Optional param:
1635 # +status_callback+:: valid URL
1736
18- def create ( from , to , body , attachment , status_callback = nil )
37+ def create ( to , from , body , attachment , status_callback = nil )
1938 raise RangeError , "Body must be between 0 and #{ MAX_BODY_LENGTH } characters" if body . length >MAX_BODY_LENGTH || body . length ==0
20- opts = { :From => from , :To => to , :Body => body , :Attachment => attachment , :StatusCallback => status_callback }
39+ opts = { :To => to , :From => from , :Body => body , :Attachment => attachment , :StatusCallback => status_callback }
2140 response = Network . post ( [ 'MMS' , 'Messages' ] , opts )
2241 MMS . new ( response )
2342 end
2443
2544 end
2645 end
27- end
46+ end
0 commit comments