Class: Kickplan::Adapters::HTTP

Inherits:
Kickplan::Adapter show all
Extended by:
Forwardable
Defined in:
lib/kickplan/adapters/http.rb

Instance Attribute Summary

Attributes inherited from Kickplan::Adapter

#config

Instance Method Summary collapse

Methods inherited from Kickplan::Adapter

for, #initialize

Methods included from Concurrency

included, #memoize, #synchronize, #unset

Constructor Details

This class inherits a constructor from Kickplan::Adapter

Instance Method Details

#configure_account(params) ⇒ Object



11
12
13
# File 'lib/kickplan/adapters/http.rb', line 11

def (params)
  false
end

#configure_feature(params) ⇒ Object



16
17
18
# File 'lib/kickplan/adapters/http.rb', line 16

def configure_feature(params)
  false
end

#connectionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/kickplan/adapters/http.rb', line 35

def connection
  memoize do
    Faraday::Connection.new(
      url: config.endpoint,
      proxy: config.proxy,
      builder: config.middleware,
      headers: {
        user_agent: config.user_agent
      }
    )
  end
end

#resolve_feature(key, params) ⇒ Object



20
21
22
# File 'lib/kickplan/adapters/http.rb', line 20

def resolve_feature(key, params)
  post("features/#{key}", params.to_h).body
end

#resolve_features(params) ⇒ Object



24
25
26
# File 'lib/kickplan/adapters/http.rb', line 24

def resolve_features(params)
  post("features", params.to_h).body
end

#update_metric(params) ⇒ Object



28
29
30
31
32
# File 'lib/kickplan/adapters/http.rb', line 28

def update_metric(params)
  path = ["metrics", params.key, params.action].join("/")

  post(path, params.to_h.slice(:value, :context)).body
end