Class: Mobiscroll::Connect::ConnectionStatus

Inherits:
Struct
  • Object
show all
Defined in:
lib/mobiscroll/connect/models.rb

Overview

Result of Auth#get_connection_status. ‘connections` is keyed by lowercase provider name to match the API wire form.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#connectionsObject

Returns the value of attribute connections

Returns:

  • (Object)

    the current value of connections



49
50
51
# File 'lib/mobiscroll/connect/models.rb', line 49

def connections
  @connections
end

#limit_reachedObject

Returns the value of attribute limit_reached

Returns:

  • (Object)

    the current value of limit_reached



49
50
51
# File 'lib/mobiscroll/connect/models.rb', line 49

def limit_reached
  @limit_reached
end

Class Method Details

.from_h(hash) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/mobiscroll/connect/models.rb', line 50

def self.from_h(hash)
  return new(connections: {}, limit_reached: false) if hash.nil?

  raw = hash['connections'] || hash[:connections] || {}
  connections = raw.each_with_object({}) do |(provider, accounts), acc|
    acc[provider.to_s] = Array(accounts).map { |a| ConnectedAccount.from_h(a) }
  end
  new(connections: connections, limit_reached: hash['limitReached'] || hash[:limitReached] || false)
end