Class: Ribbon::Intercom::Client::SDK::Adapters::HttpAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/ribbon/intercom/client/sdk/adapters/http_adapter.rb

Defined Under Namespace

Classes: Connection

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

#call, #headers, #initialize

Constructor Details

This class inherits a constructor from Ribbon::Intercom::Client::SDK::Adapters::Adapter

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/ribbon/intercom/client/sdk/adapters/http_adapter.rb', line 6

def connection
  @connection
end

Instance Method Details

#call!(method_name, encoded_args) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/ribbon/intercom/client/sdk/adapters/http_adapter.rb', line 16

def call!(method_name, encoded_args)
  response = connection.put(
    headers: headers.merge("X-Intercom-Method" => method_name),
    body:    encoded_args
  )

  Adapter::Response.new(response.body, response.code.to_i, response, method_name)
end

#connect(*args) ⇒ Object



8
9
10
# File 'lib/ribbon/intercom/client/sdk/adapters/http_adapter.rb', line 8

def connect(*args)
  @connection = Connection.new(*args)
end

#connected?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ribbon/intercom/client/sdk/adapters/http_adapter.rb', line 12

def connected?
  !!connection
end