class PolarAccesslinkApiGem::NightlyRecharge

Attributes

ans_charge[RW]

ANS stands for autonomic nervous system. ANS charge is formed by measuring heart rate, heart rate variability and breathing rate during roughly the first four hours of your sleep. It is formed comparing your last night to your usual levels from the past 28 days. The scale is from -10.0 to +10.0. Around zero is your usual level.

ans_charge_status[RW]

ANS charge status = much below usual (1) - below usual (2) - usual (3) - above usual (4) - much above usual (5)

beat_to_beat_avg[RW]

Average time in milliseconds (ms) between successive heart beats during a 4-hour period starting at 30 minutes after falling asleep.

breathing_rate_avg[RW]

Average breathing rate as breaths per minute (bpm) during a 4-hour period starting at 30 minutes after falling asleep.

breathing_samples[RW]

5-minute average samples of breathing rate. Unit of samples is breaths per minute (bpm). You can request access to this data at www.polar.com/en/science/polar-accesslink-api-extended-content

date[RW]

Result date of the Nightly Recharge

heart_rate_avg[RW]

Average heart rate as beats per minute (bpm) during a 4-hour period starting at 30 minutes after falling asleep.

heart_rate_variability_avg[RW]

Average variation in the time in milliseconds (ms) between successive heart beats during a 4-hour period starting at 30 minutes after falling asleep. The Heart rate variability is Root Mean Square of Successive Differences (RMSSD) in beat-to-beat intervals.

hrv_samples[RW]

5-minute average samples of heart rate variability. Unit of samples is milliseconds(ms). You can request access to this data at www.polar.com/en/science/polar-accesslink-api-extended-content

nightly_recharge_status[RW]

The Nightly Recharge status shows how your body was able to recover from training and stress during the night. Scores for both ANS charge and sleep charge are taken into account. Nightly Recharge status has the following (6-item) scale: very poor (1) – poor (2) – compromised (3) – OK (4) – good (5) – very good (6).

polar_user[RW]

Absolute link to user owning the sleep

Public Class Methods

acceptable_attributes() click to toggle source

Returns all the JSON keys this model knows about

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 69
def self.acceptable_attributes
  attribute_map.values
end
attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 52
def self.attribute_map
  {
    :'polar_user' => :'polar_user',
    :'date' => :'date',
    :'heart_rate_avg' => :'heart_rate_avg',
    :'beat_to_beat_avg' => :'beat_to_beat_avg',
    :'heart_rate_variability_avg' => :'heart_rate_variability_avg',
    :'breathing_rate_avg' => :'breathing_rate_avg',
    :'nightly_recharge_status' => :'nightly_recharge_status',
    :'ans_charge' => :'ans_charge',
    :'ans_charge_status' => :'ans_charge_status',
    :'hrv_samples' => :'hrv_samples',
    :'breathing_samples' => :'breathing_samples'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 202
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 98
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PolarAccesslinkApiGem::NightlyRecharge` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `PolarAccesslinkApiGem::NightlyRecharge`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'polar_user')
    self.polar_user = attributes[:'polar_user']
  end

  if attributes.key?(:'date')
    self.date = attributes[:'date']
  end

  if attributes.key?(:'heart_rate_avg')
    self.heart_rate_avg = attributes[:'heart_rate_avg']
  end

  if attributes.key?(:'beat_to_beat_avg')
    self.beat_to_beat_avg = attributes[:'beat_to_beat_avg']
  end

  if attributes.key?(:'heart_rate_variability_avg')
    self.heart_rate_variability_avg = attributes[:'heart_rate_variability_avg']
  end

  if attributes.key?(:'breathing_rate_avg')
    self.breathing_rate_avg = attributes[:'breathing_rate_avg']
  end

  if attributes.key?(:'nightly_recharge_status')
    self.nightly_recharge_status = attributes[:'nightly_recharge_status']
  end

  if attributes.key?(:'ans_charge')
    self.ans_charge = attributes[:'ans_charge']
  end

  if attributes.key?(:'ans_charge_status')
    self.ans_charge_status = attributes[:'ans_charge_status']
  end

  if attributes.key?(:'hrv_samples')
    self.hrv_samples = attributes[:'hrv_samples']
  end

  if attributes.key?(:'breathing_samples')
    self.breathing_samples = attributes[:'breathing_samples']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 91
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 74
def self.openapi_types
  {
    :'polar_user' => :'String',
    :'date' => :'Date',
    :'heart_rate_avg' => :'Integer',
    :'beat_to_beat_avg' => :'Integer',
    :'heart_rate_variability_avg' => :'Integer',
    :'breathing_rate_avg' => :'Float',
    :'nightly_recharge_status' => :'Integer',
    :'ans_charge' => :'Float',
    :'ans_charge_status' => :'Integer',
    :'hrv_samples' => :'Object',
    :'breathing_samples' => :'Object'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 171
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      polar_user == o.polar_user &&
      date == o.date &&
      heart_rate_avg == o.heart_rate_avg &&
      beat_to_beat_avg == o.beat_to_beat_avg &&
      heart_rate_variability_avg == o.heart_rate_variability_avg &&
      breathing_rate_avg == o.breathing_rate_avg &&
      nightly_recharge_status == o.nightly_recharge_status &&
      ans_charge == o.ans_charge &&
      ans_charge_status == o.ans_charge_status &&
      hrv_samples == o.hrv_samples &&
      breathing_samples == o.breathing_samples
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 232
def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = PolarAccesslinkApiGem.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 303
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 209
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 189
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 195
def hash
  [polar_user, date, heart_rate_avg, beat_to_beat_avg, heart_rate_variability_avg, breathing_rate_avg, nightly_recharge_status, ans_charge, ans_charge_status, hrv_samples, breathing_samples].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 158
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 279
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 285
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 273
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/polar-accesslink-api-gem/models/nightly_recharge.rb, line 165
def valid?
  true
end