Module: RedboothRuby

Defined in:
lib/redbooth-ruby.rb,
lib/redbooth-ruby/me.rb,
lib/redbooth-ruby/base.rb,
lib/redbooth-ruby/task.rb,
lib/redbooth-ruby/user.rb,
lib/redbooth-ruby/client.rb,
lib/redbooth-ruby/person.rb,
lib/redbooth-ruby/project.rb,
lib/redbooth-ruby/session.rb,
lib/redbooth-ruby/version.rb,
lib/redbooth-ruby/membership.rb,
lib/redbooth-ruby/conversation.rb,
lib/redbooth-ruby/organization.rb,
lib/redbooth-ruby/request/base.rb,
lib/redbooth-ruby/request/info.rb,
lib/redbooth-ruby/operations/base.rb,
lib/redbooth-ruby/operations/meta.rb,
lib/redbooth-ruby/operations/show.rb,
lib/redbooth-ruby/request/helpers.rb,
lib/redbooth-ruby/operations/index.rb,
lib/redbooth-ruby/request/response.rb,
lib/redbooth-ruby/operations/create.rb,
lib/redbooth-ruby/operations/delete.rb,
lib/redbooth-ruby/operations/update.rb,
lib/redbooth-ruby/request/validator.rb,
lib/redbooth-ruby/request/collection.rb,
lib/redbooth-ruby/request/connection.rb

Defined Under Namespace

Modules: Operations, Request Classes: APIError, AuthenticationError, BadRequest, Base, Client, Conversation, Me, Membership, NotFound, OauhtTokenExpired, OauhtTokenRevoked, ObjectNotFound, Organization, Person, Processing, Project, RedboothError, RedboothSignal, Session, Task, User

Constant Summary collapse

DOMAIN_BASE =
nil
API_BASE_PATH =
'api'
API_VERSION =
'3'
ROOT_PATH =
File.dirname(__FILE__)
VERSION =
'0.0.4'

Class Method Summary collapse

Class Method Details

.config {|@@configuration| ... } ⇒ String

Gives configuration abilities to setup api_key and api_secret

Examples:

Copy.config do |configuration|
  configuration[:api_key] = '_your_api_key'
  configuration[:api_secret] = '_your_api_secret'
end

Yields:

Returns:

  • (String)

    The api key



76
77
78
79
80
# File 'lib/redbooth-ruby.rb', line 76

def self.config(&block)
  default_configuration
  yield(@@configuration)
  @@configuration
end

.configurationObject



82
83
84
85
# File 'lib/redbooth-ruby.rb', line 82

def self.configuration
  default_configuration
  @@configuration
end

.configuration=(value) ⇒ Object



87
88
89
90
# File 'lib/redbooth-ruby.rb', line 87

def self.configuration=(value)
  default_configuration
  @@configuration = value
end

.default_configurationObject



104
105
106
107
108
109
110
111
112
# File 'lib/redbooth-ruby.rb', line 104

def self.default_configuration
  return if defined?(@@configuration)
  @@configuration ||= {}
  @@configuration[:api_base] ||= 'redbooth.com'
  @@configuration[:domain_base] ||= nil
  @@configuration[:api_base_path] ||= 'api'
  @@configuration[:api_version] ||= '3'
  @@configuration[:use_ssl] ||= true
end

.request(http_method, domain, api_url, data, options = {}) ⇒ Array

Makes a request against the Copy API

Parameters:

  • http_method (Symbol)

    The http method to use, must be one of :get, :post, :put and :delete

  • domain (String)

    The API domain to use

  • api_url (String)

    The API url to use

  • data (Hash)

    The data to send, e.g. used when creating new objects.

Returns:

  • (Array)

    The parsed JSON response.



99
100
101
102
# File 'lib/redbooth-ruby.rb', line 99

def self.request(http_method, domain, api_url, data, options = {})
  info = Request::Info.new(http_method, domain, api_url, data, options)
  Request::Base.new(info).perform
end