class Lyft::Client

Client for making Lyft api requests

Attributes

configuration[R]

The configuration for the Lyft Client @return [Lyft::Api::Configuration]

Public Class Methods

namespace(name) click to toggle source

Defines a method to access class instance.

@example Create a namespace for availability

namespace :availability #=> Lyft::Client::Availability.new
# File lib/lyft/client.rb, line 24
def self.namespace(name)
  converted = name.to_s.split('_').map(&:capitalize).join
  klass = Lyft::Client::Api.const_get(converted)
  @namespaces << klass
end
new(args = {}) click to toggle source

The initializer

@param [Hash] args @option args [String] :client_id @option args [String] :client_secret @option args [Boolean] :debug_output

# File lib/lyft/client.rb, line 62
def initialize(args = {})
  @configuration = Lyft::Client::Configuration.new args
  build_namespaces
end

Public Instance Methods

availability() click to toggle source

Class to handle availability api calls. @return Lyft::Client::Api::Availability

# File lib/lyft/client.rb, line 40
namespace :availability
oauth() click to toggle source

Class to handle availability api calls. @return Lyft::Client::Api::Oauth

# File lib/lyft/client.rb, line 34
namespace :oauth
rides() click to toggle source

Class to handle availability api calls. @return Lyft::Client::Api::Rides

# File lib/lyft/client.rb, line 46
namespace :rides
user() click to toggle source

Class to handle availability api calls. @return Lyft::Client::Api::User

# File lib/lyft/client.rb, line 52
namespace :user

Private Instance Methods

build_namespaces() click to toggle source
# File lib/lyft/client.rb, line 69
def build_namespaces
  namespaces = self.class.instance_variable_get(:@namespaces)
  namespaces.each do |klass|
    reader = klass.to_s.split('::').last.underscore
    self.class.send(:define_method, reader.to_sym) { klass.new @configuration }
  end
end