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.



11513
11514
11515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11513

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11511
11512
11513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11511

def value
  @value
end

Class Method Details

.ALLObject



11533
11534
11535
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11533

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

.anonymousObject

No authentication necessary.



11538
11539
11540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11538

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



11518
11519
11520
11521
11522
11523
11524
11525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11518

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



11528
11529
11530
11531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11528

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.



11556
11557
11558
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11556

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.



11544
11545
11546
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11544

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

.tokenObject

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



11550
11551
11552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11550

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

.userObject

A user logs into Flow.



11561
11562
11563
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11561

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

Instance Method Details

#to_hashObject



11565
11566
11567
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11565

def to_hash
  value
end