Class: Factual::Write::Base
- Inherits:
-
Object
- Object
- Factual::Write::Base
show all
- Defined in:
- lib/factual/write/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(api, params) ⇒ Base
Returns a new instance of Base.
4
5
6
7
8
|
# File 'lib/factual/write/base.rb', line 4
def initialize(api, params)
@api = api
@params = params
@params_on_path = [:table, :factual_id]
end
|
Instance Method Details
#body ⇒ Object
14
15
16
17
|
# File 'lib/factual/write/base.rb', line 14
def body
keys = @params.keys.reject { |key| @params_on_path.include?(key) }
keys.map { |key| "#{key}=#{CGI.escape(stringify(@params[key]))}" }.join("&")
end
|
#path ⇒ Object
10
11
12
|
# File 'lib/factual/write/base.rb', line 10
def path
raise "Virtual method called"
end
|
#write ⇒ Object
19
20
21
|
# File 'lib/factual/write/base.rb', line 19
def write
@api.post(self)
end
|