Class: Telesign::API::PhoneId

Inherits:
Rest
  • Object
show all
Defined in:
lib/telesign.rb

Overview

The PhoneId class exposes services that each provide detailed information about a specified phone number.

Instance Method Summary collapse

Methods inherited from Rest

#execute, #generate_auth_headers

Constructor Details

#initialize(customer_id, secret_key, ssl = true, api_host = 'rest.telesign.com', timeout = nil) ⇒ PhoneId

Returns a new instance of PhoneId.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/telesign.rb', line 21

def initialize(customer_id,
               secret_key,
               ssl=true,
               api_host='rest.telesign.com',
               timeout=nil)

  super(customer_id,
        secret_key,
        ssl,
        api_host,
        timeout)
end

Instance Method Details

#call_forward(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

In addition to the information retrieved by standard, this service provides information on call forwarding for the phone number provided.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/telesign.rb', line 143

def call_forward(phone_number,
                 use_case_code,
                 extra=nil,
                 timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/call_forward/#{phone_number}",
          params,
          nil,
          timeout)
end

#contact(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

In addition to the information retrieved by standard, this service provides the Name & Address associated with the specified phone number.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/telesign.rb', line 83

def contact(phone_number,
            use_case_code,
            extra=nil,
            timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/contact/#{phone_number}",
          params,
          nil,
          timeout)
end

#live(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

In addition to the information retrieved by standard, this service provides actionable data associated with the specified phone number.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/telesign.rb', line 103

def live(phone_number,
         use_case_code,
         extra=nil,
         timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/live/#{phone_number}",
          params,
          nil,
          timeout)
end

#number_deactivation(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

In addition to the information retrieved by standard, this service provides information on call forwarding for the phone number provided.



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/telesign.rb', line 163

def number_deactivation(phone_number,
                        use_case_code,
                        extra=nil,
                        timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/number_deactivation/#{phone_number}",
          params,
          nil,
          timeout)
end

#score(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

Retrieves a score for the specified phone number. This ranks the phone number’s “risk level” on a scale from 0 to 1000, so you can code your web application to handle particular use cases (e.g., to stop things like chargebacks, identity theft, fraud, and spam).



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/telesign.rb', line 63

def score(phone_number,
          use_case_code,
          extra=nil,
          timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/score/#{phone_number}",
          params,
          nil,
          timeout)
end

#sim_swap(phone_number, use_case_code, extra = nil, timeout = nil) ⇒ Object

In addition to the information retrieved by standard, this service provides data about potential sim_swaps associated with the specified phone number.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/telesign.rb', line 123

def sim_swap(phone_number,
             use_case_code,
             extra=nil,
             timeout=nil)

  params = {:ucid => use_case_code}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/sim_swap/check/#{phone_number}",
          params,
          nil,
          timeout)
end

#standard(phone_number, use_case_code = nil, extra = nil, timeout = nil) ⇒ Object

Retrieves the standard set of details about the specified phone number. This includes the type of phone (e.g., land line or mobile), and it’s approximate geographic location.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/telesign.rb', line 37

def standard(phone_number,
             use_case_code=nil,
             extra=nil,
             timeout=nil)

  params = {}

  unless use_case_code.nil?
    params[:ucid] = use_case_code
  end

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/phoneid/standard/#{phone_number}",
          params,
          nil,
          timeout)
end