Skip to content

Commit 74fbe2d

Browse files
committed
rename Sentry => SentryApi
1 parent 2508396 commit 74fbe2d

27 files changed

+196
-195
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gem 'sentry', :git => "[email protected]:thierryxing/sentry-ruby-api.git"
1515
Configuration example:
1616

1717
```ruby
18-
Sentry.configure do |config|
18+
SentryApi.configure do |config|
1919
config.endpoint = 'http://example.com/api/0'
2020
config.auth_token = 'your_auth_token'
2121
config.default_org_slug = 'sentry-sc'
@@ -28,26 +28,26 @@ Usage examples:
2828

2929
```ruby
3030
# set an API endpoint
31-
Sentry.endpoint = 'http://example.com/api/0'
31+
SentryApi.endpoint = 'http://example.com/api/0'
3232
# => "http://example.com/api/0"
3333

3434
# set a user private token
35-
Sentry.auth_token = 'your_auth_token'
35+
SentryApi.auth_token = 'your_auth_token'
3636
# => "your_auth_token"
3737

3838
# configure a proxy server
39-
Sentry.http_proxy('proxyhost', 8888)
39+
SentryApi.http_proxy('proxyhost', 8888)
4040
# proxy server w/ basic auth
41-
Sentry.http_proxy('proxyhost', 8888, 'user', 'pass')
41+
SentryApi.http_proxy('proxyhost', 8888, 'user', 'pass')
4242

4343
# list projects
44-
Sentry.projects
44+
SentryApi.projects
4545

4646
# initialize a new client
47-
s = Sentry.client(endpoint: 'https://api.example.com', auth_token: 'your_auth_token', default_org_slug: 'sentry-sc')
47+
s = SentryApi.client(endpoint: 'https://api.example.com', auth_token: 'your_auth_token', default_org_slug: 'sentry-sc')
4848

4949
# a paginated response
50-
projects = Sentry.projects
50+
projects = SentryApi.projects
5151

5252
# check existence of the next page
5353
projects.has_next_page?

bin/console

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22

33
require "bundler/setup"
4-
require "sentry"
4+
require "sentry-api"
55

66
# You can add fixtures and/or initialization code here to make experimenting
77
# with your gem easier. You can also use a different console, if you like.
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
require 'sentry/version'
2-
require 'sentry/objectified_hash'
3-
require 'sentry/configuration'
4-
require 'sentry/error'
5-
require 'sentry/page_links'
6-
require 'sentry/paginated_response'
7-
require 'sentry/request'
8-
require 'sentry/api'
9-
require 'sentry/client'
1+
require 'sentry-api/version'
2+
require 'sentry-api/objectified_hash'
3+
require 'sentry-api/configuration'
4+
require 'sentry-api/error'
5+
require 'sentry-api/page_links'
6+
require 'sentry-api/paginated_response'
7+
require 'sentry-api/request'
8+
require 'sentry-api/api'
9+
require 'sentry-api/client'
1010

11-
module Sentry
11+
module SentryApi
1212
extend Configuration
1313

1414
# Alias for Sentry::Client.new
1515
#
1616
# @return [Sentry::Client]
1717
def self.client(options={})
18-
Sentry::Client.new(options)
18+
SentryApi::Client.new(options)
1919
end
2020

2121
# Delegate to Sentry::Client
@@ -31,15 +31,15 @@ def respond_to_missing?(method_name, include_private = false)
3131

3232
# Delegate to HTTParty.http_proxy
3333
def self.http_proxy(address=nil, port=nil, username=nil, password=nil)
34-
Sentry::Request.http_proxy(address, port, username, password)
34+
SentryApi::Request.http_proxy(address, port, username, password)
3535
end
3636

3737
# Returns an unsorted array of available client methods.
3838
#
3939
# @return [Array<Symbol>]
4040
def self.actions
4141
hidden = /endpoint|auth_token|default_org_slug|get|post|put|delete|validate|set_request_defaults|httparty/
42-
(Sentry::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
42+
(SentryApi::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
4343
end
4444

4545
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Sentry
1+
module SentryApi
22
# @private
33
class API < Request
44
# @private
@@ -7,7 +7,7 @@ class API < Request
77
# Creates a new API.
88
# @raise [Error:MissingCredentials]
99
def initialize(options={})
10-
options = Sentry.options.merge(options)
10+
options = SentryApi.options.merge(options)
1111
(Configuration::VALID_OPTIONS_KEYS).each do |key|
1212
send("#{key}=", options[key]) if options[key]
1313
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Sentry
1+
module SentryApi
22
# Wrapper for the Sentry REST API.
33
class Client < API
44
Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
class Sentry::Client
1+
class SentryApi::Client
22

33
module Events
44

55
# Retrieve an Issue
66
#
77
# @example
8-
# Sentry.issue('120732258')
8+
# SentryApi.issue('120732258')
99
#
1010
# @param issue_id [String] the ID of the issue to retrieve.
11-
# @return Sentry::ObjectifiedHash
11+
# @return [SentryApi::ObjectifiedHash]
1212
def issue(issue_id)
1313
get("/issues/#{issue_id}/")
1414
end
1515

1616
# List an Issue’s Events
1717
#
1818
# @example
19-
# Sentry.issue_events('120732258')
19+
# SentryApi.issue_events('120732258')
2020
#
2121
# @param issue_id [String] the ID of the issue to retrieve.
22-
# @return [Array<Sentry::ObjectifiedHash>]
22+
# @return [Array<SentryApi::ObjectifiedHash>]
2323
def issue_events(issue_id)
2424
get("/issues/#{issue_id}/events/")
2525
end
2626

2727
# List an Issue’s Hashes
2828
#
2929
# @example
30-
# Sentry.issues_hashes('120732258')
30+
# SentryApi.issues_hashes('120732258')
3131
#
3232
# @param issue_id [String] the ID of the issue to retrieve.
33-
# @return [Array<Sentry::ObjectifiedHash>]
33+
# @return [Array<SentryApi::ObjectifiedHash>]
3434
def issue_hashes(issue_id)
3535
get("/issues/#{issue_id}/hashes/")
3636
end
3737

3838
# Removes an individual issue.
3939
#
4040
# @example
41-
# Sentry.remove_issue('120732258')
41+
# SentryApi.remove_issue('120732258')
4242
#
4343
# @param issue_id [String] the ID of the issue to retrieve.
4444
def remove_issue(issue_id)
@@ -48,9 +48,9 @@ def remove_issue(issue_id)
4848
# Update an individual issue.
4949
#
5050
# @example
51-
# Sentry.update_issue('120732258')
52-
# Sentry.update_issue('120732258',{status:'resolved'})
53-
# Sentry.update_issue('120732258',{status:'resolved', assignedTo:'[email protected]'})
51+
# SentryApi.update_issue('120732258')
52+
# SentryApi.update_issue('120732258',{status:'resolved'})
53+
# SentryApi.update_issue('120732258',{status:'resolved', assignedTo:'[email protected]'})
5454
#
5555
# @param issue_id [String] the ID of the issue to retrieve.
5656
# @param [Hash] options A customizable set of options.
@@ -59,28 +59,29 @@ def remove_issue(issue_id)
5959
# @option options [Boolean] :hasSeen in case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.
6060
# @option options [Boolean] :isBookmarked in case this API call is invoked with a user context this allows changing of the bookmark flag.
6161
# @option options [Boolean] :isSubscribed in case this API call is invoked with a user context this allows changing of the subscribed flag.
62+
# @return <SentryApi::ObjectifiedHash>
6263
def update_issue(issue_id, options={})
6364
put("/issues/#{issue_id}/", body: options)
6465
end
6566

6667
# Retrieves the details of the latest event.
6768
#
6869
# @example
69-
# Sentry.latest_event('120633628')
70+
# SentryApi.latest_event('120633628')
7071
#
7172
# @param issue_id [String] the ID of the issue to retrieve.
72-
# @return Sentry::ObjectifiedHash
73+
# @return [SentryApi::ObjectifiedHash]
7374
def latest_event(issue_id)
7475
get("/issues/#{issue_id}/events/latest/")
7576
end
7677

7778
# Retrieves the details of the oldest event.
7879
#
7980
# @example
80-
# Sentry.oldest_event('120633628')
81+
# SentryApi.oldest_event('120633628')
8182
#
8283
# @param issue_id [String] the ID of the issue to retrieve.
83-
# @return Sentry::ObjectifiedHash
84+
# @return [SentryApi::ObjectifiedHash]
8485
def oldest_event(issue_id)
8586
get("/issues/#{issue_id}/events/oldest/")
8687
end
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
class Sentry::Client
1+
class SentryApi::Client
22

33
module Organizations
44
# List your Organizations.
55
#
66
# @example
7-
# Sentry.organizations
7+
# SentryApi.organizations
88
#
99
# @param member [Boolean] Restrict results to organizations which you have membership
10-
# @return [Array<Sentry::ObjectifiedHash>]
10+
# @return [Array<SentryApi::ObjectifiedHash>]
1111
def organizations(member=false)
1212
get("/organizations/", query: {member: member})
1313
end
1414

1515
# List an Organization’s Projects
1616
#
1717
# @example
18-
# Sentry.organization_projects
19-
# Sentry.organization_projects('slug')
18+
# SentryApi.organization_projects
19+
# SentryApi.organization_projects('slug')
2020
#
2121
# @param organization_slug [String] the slug of the organization for which the projects should be listed.
22-
# @return [Array<Sentry::ObjectifiedHash>]
22+
# @return [Array<SentryApi::ObjectifiedHash>]
2323
def organization_projects(organization_slug="")
2424
organization_slug = @default_org_slug if organization_slug == ""
2525
get("/organizations/#{organization_slug}/projects/")
@@ -28,11 +28,11 @@ def organization_projects(organization_slug="")
2828
# Retrieve an Organization
2929
#
3030
# @example
31-
# Sentry.organization
32-
# Sentry.organization('slug')
31+
# SentryApi.organization
32+
# SentryApi.organization('slug')
3333
#
3434
# @param organization_slug [String] the slug of the organization the team should be created for.
35-
# @return Sentry::ObjectifiedHash
35+
# @return [SentryApi::ObjectifiedHash]
3636
def organization(organization_slug="")
3737
organization_slug = @default_org_slug if organization_slug == ""
3838
get("/organizations/#{organization_slug}/")
@@ -41,24 +41,24 @@ def organization(organization_slug="")
4141
# Update an Organization
4242
#
4343
# @example
44-
# Sentry.update_organization('slug')
45-
# Sentry.update_organization('slug',{name:'new-name'})
46-
# Sentry.update_organization('slug',{name:'new-name', slug:'new-slug'})
44+
# SentryApi.update_organization('slug')
45+
# SentryApi.update_organization('slug',{name:'new-name'})
46+
# SentryApi.update_organization('slug',{name:'new-name', slug:'new-slug'})
4747
#
4848
# @param organization_slug [String] the slug of the organization the team should be created for.
4949
# @param [Hash] options A customizable set of options.
5050
# @option options [String] :name an optional new name for the organization.
5151
# @option options [String] :slug an optional new slug for the organization. Needs to be available and unique.
52-
# @return Sentry::ObjectifiedHash
52+
# @return [SentryApi::ObjectifiedHash]
5353
def update_organization(organization_slug, options={})
5454
put("/organizations/#{organization_slug}/", body: options)
5555
end
5656

5757
# Retrieve Event Counts for an Organization
5858
#
5959
# @example
60-
# Sentry.organization_stats('slug')
61-
# Sentry.organization_stats('slug', {stat:'received', since:'1472158800'})
60+
# SentryApi.organization_stats('slug')
61+
# SentryApi.organization_stats('slug', {stat:'received', since:'1472158800'})
6262
#
6363
# @param organization_slug [String] the slug of the organization for which the stats should be retrieved.
6464
# @param [Hash] options A customizable set of options.

0 commit comments

Comments
 (0)