class Fastlane::Actions::BoxAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 37
def self.authors
  ["Wesley Sui"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 50
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :ipa,
                            env_name: "BOX_IPA_FILE",
                         description: "the provided ipa file name",
                            optional: true,
                                type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 33
def self.description
  "library for the Box Content API"
end
details() click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 45
def self.details
  # Optional:
  ""
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 60
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 41
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/box/actions/box_action.rb, line 6
def self.run(params)
  Actions.verify_gem!('boxr')
  ipa_file = params[:ipa]
  UI.message("filename: #{ipa_file}")

  #JWT methods
  token = Boxr::get_enterprise_token(private_key: ENV['JWT_PRIVATE_KEY'],
                              private_key_password: ENV['JWT_PRIVATE_KEY_PASSWORD'],
                              public_key_id: ENV['JWT_PUBLIC_KEY_ID'],
                              enterprise_id: ENV['BOX_ENTERPRISE_ID'],
                              client_id: ENV['BOX_CLIENT_ID'],
                              client_secret: ENV['BOX_CLIENT_SECRET'])


  # client = Boxr::Client.new  #uses ENV['BOX_DEVELOPER_TOKEN']
  client = Boxr::Client.new(token)

  folder = client.folder_from_path('/')
  client.create_folder()
  file = client.upload_file(ipa_file, folder)
  updated_file = client.create_shared_link_for_file(file, access: :open)
  puts "Shared Link: #{updated_file.shared_link.url}"

  # items = client.folder_items(Boxr::ROOT)
  # items.each {|i| puts i.name}
end