Class: Bitmovin::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmovin/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bitmovin/client.rb', line 6

def initialize(config)
  @api_key = config[:api_key]
  @base_url = "https://api.bitmovin.com/v1"
  headers = {
    'X-Api-Key' => @api_key,
    'X-Api-Client-Version' => Bitmovin::VERSION,
    'X-Api-Client' => 'bitmovin-ruby',
    'Content-Type' => 'application/json'
  }
  headers['X-Tenant-Org-Id'] = config[:organisation_id] if config[:organisation_id]
  @conn = Faraday.new(url: @base_url, headers: headers) do |faraday|

    faraday.request :json
    #faraday.response :logger
    faraday.adapter :httpclient
    faraday.response :raise_error
  end
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/bitmovin/client.rb', line 3

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



4
5
6
# File 'lib/bitmovin/client.rb', line 4

def base_url
  @base_url
end

Instance Method Details

#delete(*args, &block) ⇒ Object



29
30
31
# File 'lib/bitmovin/client.rb', line 29

def delete(*args, &block)
  @conn.delete *args, &block
end

#get(*args, &block) ⇒ Object



25
26
27
# File 'lib/bitmovin/client.rb', line 25

def get(*args, &block)
  @conn.get *args, &block
end

#post(*args, &block) ⇒ Object



33
34
35
# File 'lib/bitmovin/client.rb', line 33

def post(*args, &block)
  @conn.post *args, &block
end