Class: Flix::Client

Inherits:
Object
  • Object
show all
Includes:
API, Configurable
Defined in:
lib/flix/client.rb

Instance Attribute Summary

Attributes included from Configurable

#connection_options, #consumer_key, #consumer_secret, #endpoint, #identity_map, #middleware, #oauth_token, #oauth_token_secret

Instance Method Summary collapse

Methods included from Configurable

#cache_key, #configure, #credentials?, keys, #reset!

Constructor Details

#initialize(options = {}) ⇒ Flix::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})


22
23
24
25
26
# File 'lib/flix/client.rb', line 22

def initialize(options={})
  Flix::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Flix.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#delete(path, params = {}, options = {}) ⇒ Object

Perform an HTTP DELETE request



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

def delete(path, params={}, options={})
  request(:delete, path, params, options)
end

#get(path, params = {}, options = {}) ⇒ Object

Perform an HTTP GET request



34
35
36
# File 'lib/flix/client.rb', line 34

def get(path, params={}, options={})
  request(:get, path, params, options)
end

#post(path, params = {}, options = {}) ⇒ Object

Perform an HTTP POST request



39
40
41
# File 'lib/flix/client.rb', line 39

def post(path, params={}, options={})
  request(:post, path, params, options)
end

#put(path, params = {}, options = {}) ⇒ Object

Perform an HTTP UPDATE request



44
45
46
# File 'lib/flix/client.rb', line 44

def put(path, params={}, options={})
  request(:put, path, params, options)
end