Class: Fastlane::Helper::BitbucketCloudHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::BitbucketCloudHelper
- Defined in:
- lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb
Class Method Summary collapse
- .check_result(options) ⇒ Object
- .formatted_context_result(response) ⇒ Object
- .formatted_result(response) ⇒ Object
- .headers(options) ⇒ Object
- .parse_json(value) ⇒ Object
-
.url(options) ⇒ Object
class methods that you define here become available in your action as ‘Helper::BitbucketCloudHelper.your_method`.
Class Method Details
.check_result(options) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 48 def self.check_result() result = [:result] return unless result[:status] != [:status] = "Plugin Bitbucket finished with error code #{result[:status]} #{result[:reason_phrase]}" raise StandardError, end |
.formatted_context_result(response) ⇒ Object
36 37 38 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 36 def self.formatted_context_result(response) "Status code: #{response[:status]}, reason: #{response[:reason_phrase]}" end |
.formatted_result(response) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 27 def self.formatted_result(response) { status: response[:status], reason_phrase: response[:reason_phrase], body: response.body || '', json: parse_json(response.body) || {} } end |
.headers(options) ⇒ Object
21 22 23 24 25 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 21 def self.headers() api_token = Base64.strict_encode64("#{options[:username]}:#{options[:password]}") { 'Content-Type': 'application/json', Authorization: "Basic #{api_token}" } end |
.parse_json(value) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 40 def self.parse_json(value) require 'json' JSON.parse(value) rescue JSON::ParserError nil end |
.url(options) ⇒ Object
class methods that you define here become available in your action as ‘Helper::BitbucketCloudHelper.your_method`
13 14 15 16 17 18 19 |
# File 'lib/fastlane/plugin/bitbucket_cloud/helper/bitbucket_cloud_helper.rb', line 13 def self.url() company_host_name = [:company_host_name] repository_name = [:repository_name] api = [:api] "https://api.bitbucket.org/2.0/repositories/#{company_host_name}/#{repository_name}/#{api}" end |