Class: Validic::Client
- Inherits:
-
Object
- Object
- Validic::Client
- Includes:
- REST::Apps, REST::Biometrics, REST::Diabetes, REST::Fitness, REST::Nutrition, REST::Organizations, REST::Profile, REST::Request, REST::Response, REST::Routine, REST::Sleep, REST::TobaccoCessation, REST::Users, REST::Weight
- Defined in:
- lib/validic/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
Instance Method Summary collapse
-
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object.
-
#initialize(options = {}) ⇒ Client
constructor
Create a new Validic::Client object.
Methods included from REST::Weight
#create_weight, #delete_weight, #get_weight, #latest_weight, #update_weight
Methods included from REST::Users
#delete_user, #get_users, #me, #provision_user, #refresh_token, #suspend_user, #unsuspend_user, #update_user
Methods included from REST::TobaccoCessation
#create_tobacco_cessation, #delete_tobacco_cessation, #get_tobacco_cessation, #latest_tobacco_cessation, #update_tobacco_cessation
Methods included from REST::Sleep
#create_sleep, #delete_sleep, #get_sleep, #latest_sleep, #update_sleep
Methods included from REST::Routine
#create_routine, #delete_routine, #get_routine, #latest_routine, #update_routine
Methods included from REST::Request
Methods included from REST::Profile
Methods included from REST::Organizations
Methods included from REST::Nutrition
#create_nutrition, #delete_nutrition, #get_nutrition, #latest_nutrition, #update_nutrition
Methods included from REST::Fitness
#create_fitness, #delete_fitness, #get_fitness, #latest_fitness, #update_fitness
Methods included from REST::Diabetes
#create_diabetes, #delete_diabetes, #get_diabetes, #latest_diabetes, #update_diabetes
Methods included from REST::Biometrics
#create_biometrics, #delete_biometrics, #get_biometrics, #latest_biometrics, #update_biometrics
Methods included from REST::Apps
#get_org_apps, #get_user_synced_apps
Constructor Details
#initialize(options = {}) ⇒ Client
Create a new Validic::Client object
46 47 48 49 50 51 52 |
# File 'lib/validic/client.rb', line 46 def initialize(={}) @api_url = .fetch(:api_url, 'https://api.validic.com') @api_version = .fetch(:api_version, 'v1') @access_token = .fetch(:access_token, Validic.access_token) @organization_id = .fetch(:organization_id, Validic.organization_id) reload_config end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
37 38 39 |
# File 'lib/validic/client.rb', line 37 def access_token @access_token end |
#api_url ⇒ Object
Returns the value of attribute api_url.
37 38 39 |
# File 'lib/validic/client.rb', line 37 def api_url @api_url end |
#api_version ⇒ Object
Returns the value of attribute api_version.
37 38 39 |
# File 'lib/validic/client.rb', line 37 def api_version @api_version end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
37 38 39 |
# File 'lib/validic/client.rb', line 37 def organization_id @organization_id end |
Instance Method Details
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object
58 59 60 61 62 63 64 65 |
# File 'lib/validic/client.rb', line 58 def connection Faraday.new(url: @api_url, headers: default_headers, ssl: { verify: true }) do |faraday| # faraday.use FaradayMiddleware::Mashify faraday.use FaradayMiddleware::ParseJson, content_type: /\bjson$/ faraday.use FaradayMiddleware::FollowRedirects faraday.adapter Faraday.default_adapter end end |