Module: Twilio::Finder
- Included in:
- Account, Application, AuthorizedConnectApp, AvailablePhoneNumber, Call, Conference, ConnectApp, IncomingPhoneNumber, Notification, OutgoingCallerId, Queue, Recording, SMS, ShortCode, Transcription
- Defined in:
- lib/twilio/finder.rb
Instance Method Summary collapse
Instance Method Details
#all(opts = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/twilio/finder.rb', line 27 def all(opts={}) opts = opts.with_indifferent_access # Support subaccounts by optionally passing in an account_sid or account object account_sid = opts.delete('account_sid') || opts.delete('account').try(:sid) || Twilio::Config.account_sid connect = opts.delete 'connect' params = prepare_params opts if opts.any? handle_response get "#{resource_path(account_sid)}.json#{params}", :account_sid => (connect && account_sid) end |
#count(opts = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/twilio/finder.rb', line 17 def count(opts={}) opts = opts.with_indifferent_access # Support subaccounts by optionally passing in an account_sid or account object account_sid = opts.delete('account_sid') || opts.delete('account').try(:sid) || Twilio::Config.account_sid connect = opts.delete 'connect' params = prepare_params opts if opts.any? get("#{resource_path(account_sid)}.json#{params}", :account_sid => (connect && account_sid)).parsed_response['total'] end |
#find(id, opts = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/twilio/finder.rb', line 3 def find(id, opts={}) opts = opts.with_indifferent_access # Support subaccounts by optionally passing in an account_sid or account object account_sid = opts.delete('account_sid') || opts.delete('account').try(:sid) || Twilio::Config.account_sid connect = opts.delete 'connect' res = get "#{resource_path(account_sid)}/#{id}.json", :account_sid => (connect && account_sid) hash = res.parsed_response if (200..299).include? res.code hash['api_version'] = hash['api_version'].to_s # api_version parsed as a date by http_party new hash end end |