Class: Bugcrowd::Client
- Inherits:
-
Object
- Object
- Bugcrowd::Client
- Includes:
- Bounties
- Defined in:
- lib/bugcrowd/client.rb,
lib/bugcrowd/client/bounties.rb
Defined Under Namespace
Modules: Bounties
Constant Summary collapse
- API_ENDPOINT =
"https://api.bugcrowd.com".freeze
- USER_AGENT =
"Bugcrowd Ruby Gem #{Bugcrowd::VERSION}".freeze
- MEDIA_TYPE =
"application/vnd.bugcrowd+json"
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #connection ⇒ Object
- #connection_options ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(username: ENV['BUGCROWD_USER'], password: ENV['BUGCROWD_PASSWORD']) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
Methods included from Bounties
Constructor Details
#initialize(username: ENV['BUGCROWD_USER'], password: ENV['BUGCROWD_PASSWORD']) ⇒ Client
Returns a new instance of Client.
14 15 16 17 |
# File 'lib/bugcrowd/client.rb', line 14 def initialize(username: ENV['BUGCROWD_USER'], password: ENV['BUGCROWD_PASSWORD']) self.username = username self.password = password end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
12 13 14 |
# File 'lib/bugcrowd/client.rb', line 12 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
12 13 14 |
# File 'lib/bugcrowd/client.rb', line 12 def username @username end |
Instance Method Details
#connection ⇒ Object
44 45 46 |
# File 'lib/bugcrowd/client.rb', line 44 def connection @connection = Excon.new(API_ENDPOINT, ) end |
#connection_options ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bugcrowd/client.rb', line 33 def { headers: { "Accept" => MEDIA_TYPE, "User-Agent" => USER_AGENT }, user: self.username, password: self.password } end |
#get(path, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/bugcrowd/client.rb', line 28 def get(path, = {}) .merge!(path: path) connection.get() end |
#inspect ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/bugcrowd/client.rb', line 19 def inspect inspected = super inspected = inspected.gsub! self.username, "*******" if self.username inspected = inspected.gsub! self.password, "*******" if self.password inspected end |