Module: Komoju

Defined in:
lib/komoju.rb,
lib/komoju/client.rb,
lib/komoju/version.rb

Defined Under Namespace

Classes: Client, Customers, Events, Payments, Subscriptions, Tokens

Constant Summary collapse

VERSION =
"0.0.8"

Class Method Summary collapse

Class Method Details

.connect(api_key, options = nil) ⇒ Client

Get a Client configured to use HTTP Basic or header-based authentication.



23
24
25
26
27
28
29
30
# File 'lib/komoju/client.rb', line 23

def self.connect(api_key, options=nil)
  options = custom_options(options)
  uri = URI.parse(options[:url])
  uri.user = api_key
  uri.password = ""
  client = Heroics.client_from_schema(SCHEMA, uri.to_s, options)
  Client.new(client)
end

.connect_oauth(oauth_token, options = nil) ⇒ Client

Get a Client configured to use OAuth authentication.



48
49
50
51
52
53
# File 'lib/komoju/client.rb', line 48

def self.connect_oauth(oauth_token, options=nil)
  options = custom_options(options)
  url = options[:url]
  client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, options)
  Client.new(client)
end

.connect_token(token, options = nil) ⇒ Client

Get a Client configured to use Token authentication.



63
64
65
66
67
68
# File 'lib/komoju/client.rb', line 63

def self.connect_token(token, options=nil)
  options = custom_options(options)
  url = options[:url]
  client = Heroics.token_client_from_schema(token, SCHEMA, url, options)
  Client.new(client)
end