Class: Hiya::Url

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

Instance Attribute Summary

Attributes inherited from Base

#api_url, #bearer_token, #response, #source

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Hiya::Base

Instance Method Details

#create(links) ⇒ Object

links: Array: [{ url: ‘google.com’, weight: 1 }, …]



6
7
8
9
10
11
12
13
14
15
# File 'lib/hiya/url.rb', line 6

def create(links)
  params = { links: links, source: source }

  @response = conn.post(url) do |req|
    req.body = params.to_json
  end
  Oj.load(response.body, symbol_keys: true)
rescue StandardError => _e
  {}
end