Module: Everybit
- Defined in:
- lib/everybit.rb,
lib/everybit/video.rb,
lib/everybit/account.rb,
lib/everybit/version.rb,
lib/everybit/resource.rb,
lib/everybit/collection.rb,
lib/everybit/everybit_object.rb,
lib/everybit/modules/listable.rb,
lib/everybit/modules/createable.rb,
lib/everybit/modules/deleteable.rb,
lib/everybit/modules/updateable.rb,
lib/everybit/errors/everybit_error.rb,
lib/everybit/errors/authentication_error.rb
Defined Under Namespace
Modules: Createable, Deleteable, Listable, Updateable
Classes: Account, AuthenticationError, Collection, EverybitError, EverybitObject, Resource, Video
Constant Summary
collapse
- VERSION =
'0.1.1'
- @@api_key =
nil
- @@api_base =
'https://api.everybit.co'
Class Method Summary
collapse
Class Method Details
.api_base ⇒ Object
47
48
49
|
# File 'lib/everybit.rb', line 47
def self.api_base
@@api_base
end
|
.api_base=(api_base) ⇒ Object
43
44
45
|
# File 'lib/everybit.rb', line 43
def self.api_base=(api_base)
@@api_base = api_base
end
|
.api_key ⇒ Object
39
40
41
|
# File 'lib/everybit.rb', line 39
def self.api_key
@@api_key
end
|
.api_key=(api_key) ⇒ Object
35
36
37
|
# File 'lib/everybit.rb', line 35
def self.api_key=(api_key)
@@api_key = api_key
end
|
.api_url(url = '') ⇒ Object
31
32
33
|
# File 'lib/everybit.rb', line 31
def self.api_url(url='')
api_base + url
end
|
.request(method, url, params = {}, headers = {}) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/everybit.rb', line 51
def self.request(method, url, params={}, ={})
raise AuthenticationError.new('No API key provided (set API key using "Everybit.api_key = API_KEY")') unless self.api_key
= {
:user_agent => "everybit-ruby/#{Everybit::VERSION}",
'x-apikey' => self.api_key
}.merge()
opts = {
method: method,
url: self.api_url(url),
headers: ,
payload: MultiJson.dump(params)
}
MultiJson.load(send_request(opts), symbolize_keys: true)
end
|