GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 87edba...b77717 )
by Karol
10s
created

Twilio.client()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1 1
module Textris
2 1
  module Delivery
3 1
    class Twilio < Textris::Delivery::Base
4 1
      def deliver(to)
5 4
        options = {
6
          :from => phone_with_plus(message.from_phone),
7
          :to   => phone_with_plus(to),
8
          :body => message.content
9
        }
10 4
        if message.media_urls.is_a?(Array)
11 2
          options[:media_url] = message.media_urls
12
        end
13 4
        client.messages.create(options)
14
      end
15
16 1
      private
17
18
      # Twillo requires phone numbers starting with a '+' sign
19 1
      def phone_with_plus(phone)
20 8
        phone.to_s.start_with?('+') ? phone : "+#{phone}"
21
      end
22
23 1
      def client
24 4
        @client ||= ::Twilio::REST::Client.new
25
      end
26
    end
27
  end
28
end
29