Class: Io::Flow::V0::Models::AuthenticationTechnique

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ AuthenticationTechnique

Returns a new instance of AuthenticationTechnique.



13091
13092
13093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13091

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13089
13090
13091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13089

def value
  @value
end

Class Method Details

.ALLObject



13111
13112
13113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13111

def AuthenticationTechnique.ALL
  @@all ||= [AuthenticationTechnique.anonymous, AuthenticationTechnique.session, AuthenticationTechnique.token, AuthenticationTechnique.partner_token, AuthenticationTechnique.user]
end

.anonymousObject

No authentication necessary.



13116
13117
13118
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13116

def AuthenticationTechnique.anonymous
  @@_anonymous ||= AuthenticationTechnique.new('anonymous')
end

.apply(value) ⇒ Object

Returns the instance of AuthenticationTechnique for this value, creating a new instance for an unknown value



13096
13097
13098
13099
13100
13101
13102
13103
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096

def AuthenticationTechnique.apply(value)
  if value.instance_of?(AuthenticationTechnique)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || AuthenticationTechnique.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of AuthenticationTechnique for this value, or nil if not found



13106
13107
13108
13109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13106

def AuthenticationTechnique.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  AuthenticationTechnique.ALL.find { |v| v.value == value }
end

.partner_tokenObject

A partner token. Partner Tokens can only access anonymous endpoints and the endpoints of the partner api.



13134
13135
13136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13134

def AuthenticationTechnique.partner_token
  @@_partner_token ||= AuthenticationTechnique.new('partner_token')
end

.sessionObject

A browser has been assigned an identifier by Flow to track their use of our service for an organization.



13122
13123
13124
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13122

def AuthenticationTechnique.session
  @@_session ||= AuthenticationTechnique.new('session')
end

.tokenObject

A token. Tokens carry the same permissions as the user who originally created them.



13128
13129
13130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13128

def AuthenticationTechnique.token
  @@_token ||= AuthenticationTechnique.new('token')
end

.userObject

A user logs into Flow.



13139
13140
13141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13139

def AuthenticationTechnique.user
  @@_user ||= AuthenticationTechnique.new('user')
end

Instance Method Details

#to_hashObject



13143
13144
13145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13143

def to_hash
  value
end