Class: Bitmovin::Input
- Inherits:
-
Object
- Object
- Bitmovin::Input
- Extended by:
- Helpers
- Includes:
- Helpers
- Defined in:
- lib/bitmovin/input.rb
Overview
Represents a bitmovin input
Constant Summary collapse
- ATTRIBUTES =
%i{ input_id async type url username password created_at region bucket object_key access_key secret_key account_name account_key container min_bandwidth max_bandwidth }
Constants included from Helpers
Helpers::S3_BUCKET_IN_URL_REGEX, Helpers::S3_BUCKET_SUBDOMAIN_REGEX, Helpers::S3_OBJECT_KEY_IN_URL_REGEX, Helpers::S3_OBJECT_KEY_SUBDOMAIN_REGEX
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.create(*args) ⇒ Bitmovin::Input
Creates a new bitmovin input.
-
.list(page = 1, reload = false) ⇒ Array<Bitmovin::Input>
Get lsit of available bitmovin inputs (10 per page).
Instance Method Summary collapse
-
#create ⇒ Bitmovin::Input
Creates a new bitmovin input with params given within initialization.
-
#details(reload = false) ⇒ Object
Get bitmovin input details.
-
#initialize(*args) ⇒ Hash
constructor
Input details as a hash.
Methods included from Helpers
deep_camelize_keys, deep_underscore_keys, extract_bucket, extract_object_key, prepare_request_json, prepare_response_json
Constructor Details
#initialize(url, params) ⇒ Hash #initialize(params) ⇒ Hash
Returns Input details as a hash.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bitmovin/input.rb', line 85 def initialize(*args) @params = args.pop @url = args.pop if args.length == 1 if @url @params[:bucket] = extract_bucket(url) if !@params[:bucket] && @params[:type] == "s3" @params[:object_key] = extract_object_key(url) if !@params[:object_key] && @params[:type] == "s3" @params[:url] end end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
43 44 45 |
# File 'lib/bitmovin/input.rb', line 43 def params @params end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
43 44 45 |
# File 'lib/bitmovin/input.rb', line 43 def url @url end |
Class Method Details
.create(*args) ⇒ Bitmovin::Input
Creates a new bitmovin input
104 105 106 |
# File 'lib/bitmovin/input.rb', line 104 def self.create(*args) new(*args).create end |
.list(page = 1, reload = false) ⇒ Array<Bitmovin::Input>
Get lsit of available bitmovin inputs (10 per page)
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/bitmovin/input.rb', line 139 def list(page = 1, reload = false) var_name = :"@list_p#{ page }" val = instance_variable_get(var_name) return val if val && !reload get = Net::HTTP::Get.new "/api/inputs/#{ page }", initheaders = headers response = Bitmovin.http.request get list = prepare_response_json(response.body).map { |input| Bitmovin::Input.new(input) } val = instance_variable_set(var_name, list) end |
Instance Method Details
#create ⇒ Bitmovin::Input
Creates a new bitmovin input with params given within initialization
112 113 114 |
# File 'lib/bitmovin/input.rb', line 112 def create make_create_request end |
#details(reload = false) ⇒ Object
Get bitmovin input details
120 121 122 123 124 |
# File 'lib/bitmovin/input.rb', line 120 def details(reload = false) return @params if !reload && @params reload_details end |