Class: Blueticks::Resources::UtilsResource

Inherits:
BaseResource show all
Defined in:
lib/blueticks/resources/utils.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#client

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from Blueticks::BaseResource

Instance Method Details

Fetch OpenGraph-style metadata for a URL (uses the engine’s renderer).



17
18
19
20
# File 'lib/blueticks/resources/utils.rb', line 17

def link_preview(url:)
  data = client.request("GET", "/v1/utils/link_preview", params: { "url" => url })
  Types::LinkPreview.from_hash(data)
end

#validate_phone(phone_or_chat_id:) ⇒ Object

Validate a phone number or chat-id; returns the engine’s canonical form.



10
11
12
13
14
# File 'lib/blueticks/resources/utils.rb', line 10

def validate_phone(phone_or_chat_id:)
  data = client.request("POST", "/v1/utils/validate_phone",
                        body: { "phone_or_chat_id" => phone_or_chat_id })
  Types::PhoneValidation.from_hash(data)
end