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
# File 'lib/bitmovin/client.rb', line 6

def initialize(config)
  @api_key = config[:api_key]
  @base_url = "https://api.bitmovin.com/v1"
  @conn = Faraday.new(url: @base_url, headers: {
      'X-Api-Key' => @api_key,
      'X-Api-Client-Version' => Bitmovin::VERSION,
      'X-Api-Client' => 'bitmovin-ruby',
      'Content-Type' => 'application/json'
    }) 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



27
28
29
# File 'lib/bitmovin/client.rb', line 27

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

#get(*args, &block) ⇒ Object



23
24
25
# File 'lib/bitmovin/client.rb', line 23

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

#post(*args, &block) ⇒ Object



31
32
33
# File 'lib/bitmovin/client.rb', line 31

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