Class: Figa::Client
- Inherits:
-
Object
- Object
- Figa::Client
- Defined in:
- lib/figa.rb
Instance Attribute Summary collapse
-
#enum_values ⇒ Object
readonly
Returns the value of attribute enum_values.
Instance Method Summary collapse
-
#initialize(api_key = nil) ⇒ Client
constructor
A new instance of Client.
- #map(array_or_hash) ⇒ Object
- #search(q, h = {}) ⇒ Object
Constructor Details
#initialize(api_key = nil) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 |
# File 'lib/figa.rb', line 17 def initialize(api_key=nil) @api_key = api_key @enum_values = load_enum_values end |
Instance Attribute Details
#enum_values ⇒ Object (readonly)
Returns the value of attribute enum_values.
15 16 17 |
# File 'lib/figa.rb', line 15 def enum_values @enum_values end |
Instance Method Details
#map(array_or_hash) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/figa.rb', line 23 def map(array_or_hash) a = to_mapping_parameter_array(array_or_hash) post('/mapping', a) end |
#search(q, h = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/figa.rb', line 30 def search(q, h={}) h = q.is_a?(String) ? h.merge(query: q) : q validate(h) fail ArgumentError.new("parameter 'query' is missing" ) unless h[:query] || h['query'] post('/search', h) end |