Class: MyZeo
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
- #get_all_dates_with_sleep_data ⇒ Object
- #get_bulk_sleep_records_since_date(opts = {}) ⇒ Object
- #get_bulk_sleep_stats_since_date(opts = {}) ⇒ Object
- #get_dates_with_sleep_data_in_range(opts = {}) ⇒ Object
- #get_earliest_sleep_record ⇒ Object
- #get_earliest_sleep_stats ⇒ Object
- #get_latest_sleep_record ⇒ Object
- #get_latest_sleep_stats ⇒ Object
- #get_next_sleep_record(opts = {}) ⇒ Object
- #get_next_sleep_stats(opts = {}) ⇒ Object
- #get_overall_average_day_feel_score ⇒ Object
- #get_overall_average_morning_feel_score ⇒ Object
- #get_overall_average_sleep_stealer_score ⇒ Object
-
#get_overall_average_zq_score ⇒ Object
*************************************************************************************************************************************.
- #get_previous_sleep_record(opts = {}) ⇒ Object
- #get_previous_sleep_stats(opts = {}) ⇒ Object
- #get_sleep_record_for_date(opts = {}) ⇒ Object
- #get_sleep_stats_for_date(opts = {}) ⇒ Object
-
#initialize(api_key, opts = {}) ⇒ MyZeo
constructor
A new instance of MyZeo.
- #j_spring_security_logout ⇒ Object
- #logout ⇒ Object
- #secure_logout ⇒ Object
-
#subscribe_to_notify_link(callback_url) ⇒ Object
BULK API *************************************************************************************************************************************.
- #unsubscribe_from_notify ⇒ Object
- #unsubscribe_from_notify_link ⇒ Object
Constructor Details
#initialize(api_key, opts = {}) ⇒ MyZeo
Returns a new instance of MyZeo.
11 12 13 14 15 16 |
# File 'lib/my_zeo.rb', line 11 def initialize(api_key,opts={}) @api_key = api_key @user_id = opts[:user_id] ? opts[:user_id] : nil MyZeo.basic_auth opts[:login], opts[:password] if (opts[:login] && opts[:password]) MyZeo.base_uri opts[:base_url] if opts[:base_url] end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/my_zeo.rb', line 8 def api_key @api_key end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
9 10 11 |
# File 'lib/my_zeo.rb', line 9 def user_id @user_id end |
Instance Method Details
#get_all_dates_with_sleep_data ⇒ Object
65 66 67 |
# File 'lib/my_zeo.rb', line 65 def get_all_dates_with_sleep_data MyZeo.get("/getAllDatesWithSleepData?key=#{@api_key}").recursive_symbolize_keys! end |
#get_bulk_sleep_records_since_date(opts = {}) ⇒ Object
37 38 39 40 |
# File 'lib/my_zeo.rb', line 37 def get_bulk_sleep_records_since_date(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getBulkSleepRecordsSinceDate?key=#{@api_key}", :query => {:userid => @user_id, :date => date }).recursive_symbolize_keys! end |
#get_bulk_sleep_stats_since_date(opts = {}) ⇒ Object
32 33 34 35 |
# File 'lib/my_zeo.rb', line 32 def get_bulk_sleep_stats_since_date(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getBulkSleepStatsSinceDate?key=#{@api_key}", :query => {:userid => @user_id, :date => date }).recursive_symbolize_keys! end |
#get_dates_with_sleep_data_in_range(opts = {}) ⇒ Object
69 70 71 72 73 |
# File 'lib/my_zeo.rb', line 69 def get_dates_with_sleep_data_in_range(opts={}) date_from = opts[:date_from] ? opts[:date_from] : "" date_to = opts[:date_to] ? opts[:date_to] : "" MyZeo.get("/getDatesWithSleepDataInRange?key=#{@api_key}", :query => {:dateFrom => date_from, :dateTo => date_to}).recursive_symbolize_keys! end |
#get_earliest_sleep_record ⇒ Object
109 110 111 |
# File 'lib/my_zeo.rb', line 109 def get_earliest_sleep_record MyZeo.get("/getEarliestSleepRecord?key=#{@api_key}").recursive_symbolize_keys! end |
#get_earliest_sleep_stats ⇒ Object
105 106 107 |
# File 'lib/my_zeo.rb', line 105 def get_earliest_sleep_stats MyZeo.get("/getEarliestSleepStats?key=#{@api_key}").recursive_symbolize_keys! end |
#get_latest_sleep_record ⇒ Object
117 118 119 |
# File 'lib/my_zeo.rb', line 117 def get_latest_sleep_record MyZeo.get("/getLatestSleepRecord?key=#{@api_key}").recursive_symbolize_keys! end |
#get_latest_sleep_stats ⇒ Object
113 114 115 |
# File 'lib/my_zeo.rb', line 113 def get_latest_sleep_stats MyZeo.get("/getLatestSleepStats?key=#{@api_key}").recursive_symbolize_keys! end |
#get_next_sleep_record(opts = {}) ⇒ Object
100 101 102 103 |
# File 'lib/my_zeo.rb', line 100 def get_next_sleep_record(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getNextSleepRecord?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#get_next_sleep_stats(opts = {}) ⇒ Object
95 96 97 98 |
# File 'lib/my_zeo.rb', line 95 def get_next_sleep_stats(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getNextSleepStats?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#get_overall_average_day_feel_score ⇒ Object
53 54 55 |
# File 'lib/my_zeo.rb', line 53 def get_overall_average_day_feel_score MyZeo.get("/getOverallAverageDayFeelScore?key=#{@api_key}").recursive_symbolize_keys! end |
#get_overall_average_morning_feel_score ⇒ Object
57 58 59 |
# File 'lib/my_zeo.rb', line 57 def get_overall_average_morning_feel_score MyZeo.get("/getOverallAverageMorningFeelScore?key=#{@api_key}").recursive_symbolize_keys! end |
#get_overall_average_sleep_stealer_score ⇒ Object
61 62 63 |
# File 'lib/my_zeo.rb', line 61 def get_overall_average_sleep_stealer_score MyZeo.get("/getOverallAverageSleepStealerScore?key=#{@api_key}").recursive_symbolize_keys! end |
#get_overall_average_zq_score ⇒ Object
*************************************************************************************************************************************
49 50 51 |
# File 'lib/my_zeo.rb', line 49 def get_overall_average_zq_score MyZeo.get("/getOverallAverageZQScore?key=#{@api_key}").recursive_symbolize_keys! end |
#get_previous_sleep_record(opts = {}) ⇒ Object
90 91 92 93 |
# File 'lib/my_zeo.rb', line 90 def get_previous_sleep_record(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getPreviousSleepRecord?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#get_previous_sleep_stats(opts = {}) ⇒ Object
85 86 87 88 |
# File 'lib/my_zeo.rb', line 85 def get_previous_sleep_stats(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getPreviousSleepStats?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#get_sleep_record_for_date(opts = {}) ⇒ Object
80 81 82 83 |
# File 'lib/my_zeo.rb', line 80 def get_sleep_record_for_date(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getSleepRecordForDate?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#get_sleep_stats_for_date(opts = {}) ⇒ Object
75 76 77 78 |
# File 'lib/my_zeo.rb', line 75 def get_sleep_stats_for_date(opts={}) date = opts[:date] ? opts[:date] : "" MyZeo.get("/getSleepStatsForDate?key=#{@api_key}", :query => {:date => date }).recursive_symbolize_keys! end |
#j_spring_security_logout ⇒ Object
42 43 44 45 |
# File 'lib/my_zeo.rb', line 42 def j_spring_security_logout logout_url_base = self.base_uri.split('/api/').first get("#{logout_url_base}/j_spring_security_logout") end |
#logout ⇒ Object
121 122 123 |
# File 'lib/my_zeo.rb', line 121 def logout MyZeo.get("/logout?key=#{@api_key}") end |
#secure_logout ⇒ Object
125 126 127 |
# File 'lib/my_zeo.rb', line 125 def secure_logout MyZeo.get("#{self.class.base_uri.split('/api/').first}/j_spring_security_logout") end |
#subscribe_to_notify_link(callback_url) ⇒ Object
BULK API *************************************************************************************************************************************
20 21 22 |
# File 'lib/my_zeo.rb', line 20 def subscribe_to_notify_link(callback_url) "#{self.class.base_uri}/subscribeToNotify?key=#{@api_key}&userid=#{@user_id}&callback=#{callback_url}" end |
#unsubscribe_from_notify ⇒ Object
28 29 30 |
# File 'lib/my_zeo.rb', line 28 def unsubscribe_from_notify MyZeo.get("/unsubscribeFromNotify?key=#{@api_key}", :query => {:userid => @user_id}).recursive_symbolize_keys! end |
#unsubscribe_from_notify_link ⇒ Object
24 25 26 |
# File 'lib/my_zeo.rb', line 24 def unsubscribe_from_notify_link "#{self.class.base_uri}/unsubscribeFromNotify?key=#{@api_key}&userid=#{@user_id}" end |