module Ohanakapa::Configurable

Configuration options for {Client}, defaulting to values in {Default}

Attributes

api_endpoint[W]
api_token[W]
auto_paginate[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
connection_options[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
default_media_type[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
middleware[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
per_page[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
proxy[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.
user_agent[RW]

@!attribute api_endpoint

@return [String] Base URL for API requests. default: http://ohana-api-demo.herokuapp.com/api

@!attribute auto_paginate

@return [Boolean] Auto fetch next page of results until rate limit reached

@!attribute [w] api_token

@return [String] Configure OAuth app secret

@!attribute default_media_type

@see http://developer.github.com/v3/media/
@return [String] Configure preferred media type (for API versioning, for example)

@!attribute connection_options

@see https://github.com/lostisland/faraday
@return [Hash] Configure connection options for Faraday

@!attribute middleware

@see https://github.com/lostisland/faraday
@return [Faraday::Builder or Faraday::RackBuilder] Configure middleware for Faraday

@!attribute per_page

@return [String] Configure page size for paginated results. API default: 30

@!attribute proxy

@see https://github.com/lostisland/faraday
@return [String] URI for proxy server

@!attribute user_agent

@return [String] Configure User-Agent header for requests.

Public Class Methods

keys() click to toggle source

List of configurable keys for {Ohanakapa::Client} @return [Array] of option keys

# File lib/ohanakapa/configurable.rb, line 38
def keys
  @keys ||= [
    :api_endpoint,
    :auto_paginate,
    :api_token,
    :connection_options,
    :default_media_type,
    :middleware,
    :per_page,
    :proxy,
    :user_agent
  ]
end

Public Instance Methods

api_endpoint() click to toggle source
# File lib/ohanakapa/configurable.rb, line 67
def api_endpoint
  File.join(@api_endpoint, "")
end
configure() { |self| ... } click to toggle source

Set configuration options using a block

# File lib/ohanakapa/configurable.rb, line 54
def configure
  yield self
end
reset!() click to toggle source

Reset configuration options to default values

# File lib/ohanakapa/configurable.rb, line 59
def reset!
  Ohanakapa::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Ohanakapa::Default.options[key])
  end
  self
end
Also aliased as: setup
setup()
Alias for: reset!

Private Instance Methods

options() click to toggle source
# File lib/ohanakapa/configurable.rb, line 73
def options
  Hash[Ohanakapa::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
end