Class: MyTankInfo::Client
- Inherits:
-
Object
- Object
- MyTankInfo::Client
- Defined in:
- lib/my_tank_info/client.rb
Constant Summary collapse
- BASE_URL =
"https://app.mytankinfo.com"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #active_alarms ⇒ Object
- #alarm_history ⇒ Object
- #alarm_notes ⇒ Object
- #connection ⇒ Object
- #csld_results ⇒ Object
- #environmental_sitegroups ⇒ Object
- #generate_api_token(username:, password:) ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
- #inventory_sitegroups ⇒ Object
- #line_leak_results ⇒ Object
- #notification_contacts ⇒ Object
- #notification_rules ⇒ Object
- #sensor_status_results ⇒ Object
- #sitegroup_inventory_dashboards ⇒ Object
- #tank_daily_usage ⇒ Object
- #tank_deliveries ⇒ Object
- #tank_inventory ⇒ Object
- #tank_leak_results ⇒ Object
- #tank_reconciliation_records ⇒ Object
- #tank_rules ⇒ Object
- #tank_runout ⇒ Object
- #tanks ⇒ Object
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/my_tank_info/client.rb', line 11 def initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) @api_key = api_key @adapter = adapter @stubs = stubs end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/my_tank_info/client.rb', line 9 def api_key @api_key end |
Instance Method Details
#active_alarms ⇒ Object
21 22 23 |
# File 'lib/my_tank_info/client.rb', line 21 def active_alarms ActiveAlarmsResource.new(self) end |
#alarm_history ⇒ Object
25 26 27 |
# File 'lib/my_tank_info/client.rb', line 25 def alarm_history AlarmHistoryResource.new(self) end |
#alarm_notes ⇒ Object
29 30 31 |
# File 'lib/my_tank_info/client.rb', line 29 def alarm_notes AlarmNotesResource.new(self) end |
#connection ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/my_tank_info/client.rb', line 97 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = BASE_URL conn.request :json conn.response :json, content_type: "application/json" conn.adapter @adapter, @stubs end end |
#csld_results ⇒ Object
41 42 43 |
# File 'lib/my_tank_info/client.rb', line 41 def csld_results CsldResultsResource.new(self) end |
#environmental_sitegroups ⇒ Object
17 18 19 |
# File 'lib/my_tank_info/client.rb', line 17 def environmental_sitegroups EnvironmentalSitegroupsResource.new(self) end |
#generate_api_token(username:, password:) ⇒ Object
93 94 95 |
# File 'lib/my_tank_info/client.rb', line 93 def generate_api_token(username:, password:) TokensResource.new(self).generate(username: username, password: password) end |
#inventory_sitegroups ⇒ Object
49 50 51 |
# File 'lib/my_tank_info/client.rb', line 49 def inventory_sitegroups InventorySitegroupsResource.new(self) end |
#line_leak_results ⇒ Object
37 38 39 |
# File 'lib/my_tank_info/client.rb', line 37 def line_leak_results LineLeakResultsResource.new(self) end |
#notification_contacts ⇒ Object
85 86 87 |
# File 'lib/my_tank_info/client.rb', line 85 def notification_contacts NotificationContactsResource.new(self) end |
#notification_rules ⇒ Object
89 90 91 |
# File 'lib/my_tank_info/client.rb', line 89 def notification_rules NotificationRulesResource.new(self) end |
#sensor_status_results ⇒ Object
45 46 47 |
# File 'lib/my_tank_info/client.rb', line 45 def sensor_status_results SensorStatusResultsResource.new(self) end |
#sitegroup_inventory_dashboards ⇒ Object
57 58 59 |
# File 'lib/my_tank_info/client.rb', line 57 def sitegroup_inventory_dashboards SitegroupInventoryDashboardsResource.new(self) end |
#tank_daily_usage ⇒ Object
61 62 63 |
# File 'lib/my_tank_info/client.rb', line 61 def tank_daily_usage TankDailyUsageResource.new(self) end |
#tank_deliveries ⇒ Object
65 66 67 |
# File 'lib/my_tank_info/client.rb', line 65 def tank_deliveries TankDeliveriesResource.new(self) end |
#tank_inventory ⇒ Object
69 70 71 |
# File 'lib/my_tank_info/client.rb', line 69 def tank_inventory TankInventoryResource.new(self) end |
#tank_leak_results ⇒ Object
33 34 35 |
# File 'lib/my_tank_info/client.rb', line 33 def tank_leak_results TankLeakResultsResource.new(self) end |
#tank_reconciliation_records ⇒ Object
81 82 83 |
# File 'lib/my_tank_info/client.rb', line 81 def tank_reconciliation_records TankReconciliationRecordsResource.new(self) end |
#tank_rules ⇒ Object
77 78 79 |
# File 'lib/my_tank_info/client.rb', line 77 def tank_rules TankRulesResource.new(self) end |
#tank_runout ⇒ Object
73 74 75 |
# File 'lib/my_tank_info/client.rb', line 73 def tank_runout TankRunoutResource.new(self) end |
#tanks ⇒ Object
53 54 55 |
# File 'lib/my_tank_info/client.rb', line 53 def tanks TanksResource.new(self) end |