Class: OTX::URL

Inherits:
Base
  • Object
show all
Defined in:
lib/otx_ruby/url.rb

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #patch, #post

Constructor Details

This class inherits a constructor from OTX::Base

Instance Method Details

#get_general(url) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/otx_ruby/url.rb', line 3

def get_general(url)
  uri = "/api/v1/indicators/url/#{url}/general"

  json_data = get(uri)

  general = OTX::Indicator::IP::General.new(json_data)

  return general
end

#get_url_list(url) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/otx_ruby/url.rb', line 13

def get_url_list(url)
  uri = "/api/v1/indicators/url/#{url}/url_list"

  page = 0
  url_list = []
  begin
    page += 1
    params = {limit: 20, page: page}
    json_data = get(uri, params)
    has_next = json_data['has_next']

    url_list += json_data['url_list']
  end while has_next

  results = []
  url_list.each do |url|
    results << OTX::Indicator::IP::URL.new(url)
  end

  return results
end