Class: Intermix::Client
- Inherits:
-
Object
- Object
- Intermix::Client
- Defined in:
- lib/intermix/client.rb
Constant Summary collapse
- TABLES_PATH =
paths
'/tables'
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
- #tables(fields = Table::FIELDS) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 |
# File 'lib/intermix/client.rb', line 8 def initialize(configuration) raise ArgumentError, 'configuration cannot be nil.' unless configuration.present? @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/intermix/client.rb', line 6 def configuration @configuration end |
Instance Method Details
#tables(fields = Table::FIELDS) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/intermix/client.rb', line 14 def tables(fields = Table::FIELDS) fields &&= Table::FIELDS query = "fields=#{fields.join(',')}" if fields.any? response = post(TABLES_PATH, query: query) if response.success? parsed_response = response.parsed_response parsed_response['data'].map { |entry| Intermix::Table.new(entry) } else [] end end |