Class: Centrifuge::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/centrifuge/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, data, client) ⇒ Builder

Returns a new instance of Builder.



7
8
9
# File 'lib/centrifuge/builder.rb', line 7

def initialize(method, data, client)
  @method, @data, @client = method, data, client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/centrifuge/builder.rb', line 5

def client
  @client
end

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/centrifuge/builder.rb', line 5

def data
  @data
end

#methodObject

Returns the value of attribute method.



5
6
7
# File 'lib/centrifuge/builder.rb', line 5

def method
  @method
end

Instance Method Details

#processObject



11
12
13
14
15
# File 'lib/centrifuge/builder.rb', line 11

def process
  body = { data: json(method, data) }
  body.merge!(sign: client.sign(body[:data]))
  Centrifuge::Request.new(client.client, 'POST', client.url, nil, body).send
end