Module: Octokit::Configurable

Included in:
Octokit, Client
Defined in:
lib/octokit/configurable.rb

Overview

Configuration options for Client, defaulting to values in Default

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token



46
47
48
# File 'lib/octokit/configurable.rb', line 46

def access_token
  @access_token
end

#api_endpointString



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#auto_paginateBoolean



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#client_idString

Returns Configure OAuth app key



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#client_secretObject

Returns the value of attribute client_secret



46
47
48
# File 'lib/octokit/configurable.rb', line 46

def client_secret
  @client_secret
end

#connection_optionsHash

Returns Configure connection options for Faraday



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#default_media_typeString

Returns Configure preferred media type (for API versioning, for example)



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#loginString



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#middlewareFaraday::Builder or Faraday::RackBuilder

Returns Configure middleware for Faraday



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#netrcBoolean



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#netrc_fileString



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#password=(value) ⇒ String (writeonly)



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#per_pageString



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#proxyString

Returns URI for proxy server



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#user_agentString



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

#web_endpointString

Base URL for generated web URLs



46
47
48
49
# File 'lib/octokit/configurable.rb', line 46

attr_accessor :access_token, :auto_paginate, :client_id,
:client_secret, :default_media_type, :connection_options,
:middleware, :netrc, :netrc_file,
:per_page, :proxy, :user_agent

Class Method Details

.keysArray

List of configurable keys for Octokit::Client



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/octokit/configurable.rb', line 56

def keys
  @keys ||= [
    :access_token,
    :api_endpoint,
    :auto_paginate,
    :client_id,
    :client_secret,
    :connection_options,
    :default_media_type,
    :login,
    :middleware,
    :netrc,
    :netrc_file,
    :per_page,
    :password,
    :proxy,
    :user_agent,
    :web_endpoint
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Set configuration options using a block

Yields:

  • (_self)

Yield Parameters:



79
80
81
# File 'lib/octokit/configurable.rb', line 79

def configure
  yield self
end

#netrc?Boolean



109
110
111
# File 'lib/octokit/configurable.rb', line 109

def netrc?
  !!@netrc
end

#reset!Object Also known as: setup

Reset configuration options to default values



84
85
86
87
88
89
# File 'lib/octokit/configurable.rb', line 84

def reset!
  Octokit::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Octokit::Default.options[key])
  end
  self
end