Class: Factual::Multi
- Inherits:
-
Object
- Object
- Factual::Multi
- Defined in:
- lib/factual/multi.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(api, queries) ⇒ Multi
constructor
A new instance of Multi.
- #send ⇒ Object
Constructor Details
#initialize(api, queries) ⇒ Multi
Returns a new instance of Multi.
5 6 7 8 9 10 11 12 13 |
# File 'lib/factual/multi.rb', line 5 def initialize(api, queries) @api = api @queries = queries @action = nil @path = '/multi' @responses = {} end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/factual/multi.rb', line 3 def action @action end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/factual/multi.rb', line 3 def path @path end |
Instance Method Details
#body ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/factual/multi.rb', line 25 def body query_urls = {} @queries.each do |name, query| query_urls[name] = query.full_path end "queries=#{ CGI.escape(query_urls.to_json) }" end |
#send ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/factual/multi.rb', line 15 def send res = @api.post(self) @queries.each do |name, query| query.populate(res[name.to_s]) @responses[name] = query end @responses end |