Class: FirebaseDynamicLink::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/firebase_dynamic_link/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the value of attribute dynamic_link_domain.



3
4
5
# File 'lib/firebase_dynamic_link/client.rb', line 3

def dynamic_link_domain
  @dynamic_link_domain
end

Instance Method Details

on succeed

on failure

status >= 400
body {"error"=>{"code"=>400, "message"=>"Long link is not parsable: https://k4mu4.app.goo.gl?link=abcde [https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]", "status"=>"INVALID_ARGUMENT"}}


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/firebase_dynamic_link/client.rb', line 10

def shorten_link(link, options = {})
  build_connection_options(connection, options)

  suffix_option = options.delete(:suffix_option)
  suffix_option ||= config.default.suffix.option

  response = connection.post(nil, {
    longDynamicLink: build_link(link, options),
    suffix: {
      option: suffix_option
    }
  }.to_json)
  if response.status.between?(200, 299)
    render_success(response)
  else
    raise_error(response)
  end
rescue Faraday::ConnectionFailed => e
  raise FirebaseDynamicLink::ConnectionError, e.message
end

#shorten_object(_json_object) ⇒ Object

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/firebase_dynamic_link/client.rb', line 31

def shorten_object(_json_object)
  raise NotImplementedError
end