Class: StashNotifier::HTTPClient
- Inherits:
-
Object
- Object
- StashNotifier::HTTPClient
- Defined in:
- lib/stash_notifier/http_client.rb
Constant Summary collapse
- STASH_BUILD_STATUS_PATH =
'rest/build-status/1.0/commits'- DEFAULTS =
{ http_client: Faraday.new }.freeze
Instance Attribute Summary collapse
-
#build_result ⇒ Object
Returns the value of attribute build_result.
-
#git_commit ⇒ Object
Returns the value of attribute git_commit.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#stash_pwd ⇒ Object
Returns the value of attribute stash_pwd.
-
#stash_url ⇒ Object
Returns the value of attribute stash_url.
-
#stash_user ⇒ Object
Returns the value of attribute stash_user.
Instance Method Summary collapse
-
#initialize(args) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
- #post_to_stash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ HTTPClient
Returns a new instance of HTTPClient.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/stash_notifier/http_client.rb', line 31 def initialize(args) args = DEFAULTS.merge(args) @stash_url = args[:stash_url] @stash_user = args[:stash_user] @stash_pwd = args[:stash_pwd] @git_commit = args[:git_commit] @build_result = args[:build_result] @http_client = args[:http_client] end |
Instance Attribute Details
#build_result ⇒ Object
Returns the value of attribute build_result.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def build_result @build_result end |
#git_commit ⇒ Object
Returns the value of attribute git_commit.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def git_commit @git_commit end |
#http_client ⇒ Object
Returns the value of attribute http_client.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def http_client @http_client end |
#stash_pwd ⇒ Object
Returns the value of attribute stash_pwd.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def stash_pwd @stash_pwd end |
#stash_url ⇒ Object
Returns the value of attribute stash_url.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def stash_url @stash_url end |
#stash_user ⇒ Object
Returns the value of attribute stash_user.
28 29 30 |
# File 'lib/stash_notifier/http_client.rb', line 28 def stash_user @stash_user end |
Instance Method Details
#post_to_stash ⇒ Object
51 52 53 54 55 56 |
# File 'lib/stash_notifier/http_client.rb', line 51 def post_to_stash setup_http_client response = post_results check_errors(response) response end |
#to_s ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/stash_notifier/http_client.rb', line 42 def to_s "StashNotifier connection: url: #{stash_url}, git_commit: #{git_commit}, user: #{stash_user}, pwd: ***********, build_result: #{build_result}" end |