Module: RedboothRuby

Defined in:
lib/redbooth-ruby.rb,
lib/redbooth-ruby/me.rb,
lib/redbooth-ruby/base.rb,
lib/redbooth-ruby/file.rb,
lib/redbooth-ruby/note.rb,
lib/redbooth-ruby/task.rb,
lib/redbooth-ruby/user.rb,
lib/redbooth-ruby/client.rb,
lib/redbooth-ruby/person.rb,
lib/redbooth-ruby/comment.rb,
lib/redbooth-ruby/helpers.rb,
lib/redbooth-ruby/project.rb,
lib/redbooth-ruby/session.rb,
lib/redbooth-ruby/subtask.rb,
lib/redbooth-ruby/version.rb,
lib/redbooth-ruby/task_list.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,
lib/redbooth-ruby/client_operations/search.rb,
lib/redbooth-ruby/client_operations/perform.rb,
lib/redbooth-ruby/client_operations/metadata.rb

Defined Under Namespace

Modules: ClientOperations, Helpers, Operations, Request Classes: APIError, AuthenticationError, BadRequest, Base, Client, Comment, Conversation, File, Me, Membership, NotFound, Note, OauthTokenExpired, OauthTokenRevoked, ObjectNotFound, Organization, Person, Processing, Project, RedboothError, RedboothSignal, Session, Subtask, Task, TaskList, User

Constant Summary collapse

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

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



89
90
91
92
93
# File 'lib/redbooth-ruby.rb', line 89

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

.configurationObject



95
96
97
98
# File 'lib/redbooth-ruby.rb', line 95

def self.configuration
  default_configuration
  @@configuration
end

.configuration=(value) ⇒ Object



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

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

.default_configurationObject



117
118
119
120
121
122
123
124
125
# File 'lib/redbooth-ruby.rb', line 117

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.



112
113
114
115
# File 'lib/redbooth-ruby.rb', line 112

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