sentry-api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63d5a7432a7a86a1c8077fb4d702701632640a76
4
- data.tar.gz: 7aee07004fab408b8a662e3ed394090408ecbdda
3
+ metadata.gz: c8b17332ffe6b7c3740b3acda3256007b9707ab2
4
+ data.tar.gz: ab1af12f7cfb73c90ac3d651d6000510489bfd00
5
5
  SHA512:
6
- metadata.gz: ada67008ed2eaa102a87ff5b2e3bd370aaf57f408371261149984e8f4f220319c68c28180ca691958b2cba5911d67fa25366b1f8bce132b480fe7a9f1b9a2517
7
- data.tar.gz: 31879008fa89a01e1601f19dc0fc0754b5677a5b726bfefcf745efa20815b7b53a946be315baf090c7d2661e0ebe5e9835e04ea1c9c3e741c4130fa96fb41de4
6
+ metadata.gz: 241e63d67c12b558096dc100fffb5e1af11bcbb4715c2d2c9fe211f72d0fc1d1448b56222eb130887be2ac94d73924ad8da45c7dd0fd09a6f6e69197192639da
7
+ data.tar.gz: da8488d89638f3427f687dacdfdad2ccd5eeb5562886a6176254378afd2460daea632d0418babdb4db20c833fa0a02ba1aeef3697bfc1c2e9cfa1fa23020d0eb
data/README.md CHANGED
@@ -6,11 +6,16 @@ Sentry Ruby API is a Ruby wrapper for the [getsentry/sentry API](https://docs.se
6
6
 
7
7
 
8
8
  ## Installation
9
+ Install it from rubygems:
9
10
 
10
- add to a Gemfile:
11
+ ```sh
12
+ gem install sentry-api
13
+ ```
14
+
15
+ Or add to a Gemfile:
11
16
 
12
17
  ```ruby
13
- gem 'sentry', :git => "git@github.com:thierryxing/sentry-ruby-api.git"
18
+ gem 'sentry-api'
14
19
  ```
15
20
 
16
21
  ## Usage
@@ -72,6 +72,20 @@ class SentryApi::Client
72
72
  get("/projects/#{organization_slug}/#{project_slug}/stats/", query: options)
73
73
  end
74
74
 
75
+ # Upload a new dsym file for the given release
76
+ #
77
+ # @example
78
+ # SentryApi.upload_dsym_files('project-slug','/path/to/file')
79
+ #
80
+ # @param project_slug [String] the slug of the project to list the dsym files of.
81
+ # @param file_path [String] the absolute file path of the dsym file.
82
+ # @param organization_slug [String] the slug of the organization.
83
+ # @return [Array<SentryApi::ObjectifiedHash>]
84
+ def upload_dsym_files(project_slug, file_path, organization_slug="")
85
+ organization_slug = @default_org_slug if organization_slug == ""
86
+ post("/projects/#{organization_slug}/#{project_slug}/files/dsyms/", body: {file: File.new(file_path)})
87
+ end
88
+
75
89
  # List a Project’s DSym Files.
76
90
  #
77
91
  # @example
@@ -6,5 +6,6 @@ module SentryApi
6
6
  include Organizations
7
7
  include Projects
8
8
  include Events
9
+ include Teams
9
10
  end
10
11
  end
@@ -1,14 +1,14 @@
1
- require 'httparty'
1
+ require 'httmultiparty'
2
2
  require 'json'
3
3
 
4
4
  module SentryApi
5
5
  # @private
6
6
  class Request
7
- include HTTParty
7
+ include HTTMultiParty
8
+
8
9
  format :json
9
- headers 'Content-Type' => 'application/json'
10
+ headers "Content-Type" => "application/json"
10
11
  parser proc { |body, _| parse(body) }
11
-
12
12
  attr_accessor :auth_token, :endpoint, :default_org_slug
13
13
 
14
14
  # Converts the response body to an ObjectifiedHash.
@@ -67,6 +67,12 @@ module SentryApi
67
67
  validate self.class.delete(@endpoint + path, options)
68
68
  end
69
69
 
70
+ def upload(path, options={})
71
+ set_httparty_config(options)
72
+ set_authorization_header(options)
73
+ validate self.class.post(@endpoint + path, options)
74
+ end
75
+
70
76
  # Checks the response code for common errors.
71
77
  # Returns parsed response for successful requests.
72
78
  def validate(response)
@@ -119,9 +125,12 @@ module SentryApi
119
125
  end
120
126
  end
121
127
 
122
- # Set http post or put body as json string
128
+ # Set http post or put body as json string if content type is application/json
123
129
  def set_json_body(options)
124
- options[:body] = options[:body].to_json
130
+ headers = self.class.headers
131
+ if headers and headers["Content-Type"] == "application/json"
132
+ options[:body] = options[:body].to_json
133
+ end
125
134
  end
126
135
 
127
136
  # Set HTTParty configuration
@@ -1,3 +1,3 @@
1
1
  module SentryApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/sentry-api.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency 'httparty', "~> 0.14.0"
29
+ spec.add_runtime_dependency 'httmultiparty', "~> 0.3.16"
30
30
  spec.add_development_dependency "bundler", "~> 1.12"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency 'rspec', "~> 3.5.0", '>= 3.5.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thierry Xing
@@ -11,19 +11,19 @@ cert_chain: []
11
11
  date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: httparty
14
+ name: httmultiparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.14.0
19
+ version: 0.3.16
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.14.0
26
+ version: 0.3.16
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement