Class: EarnShark::Api::Client

Inherits:
Object
  • Object
show all
Includes:
EarnShark::Account, License, Request, Subscription
Defined in:
lib/earnshark_sdk/api.rb

Constant Summary

Constants included from Request

Request::APP_DIR, Request::BASE_URL

Instance Method Summary collapse

Methods included from License

#get_all_licenses, #get_license_information

Methods included from EarnShark::Account

#get_account_information, #get_account_payments

Constructor Details

#initialize(product_id, key) ⇒ Client

initialize the object with the earnshark product id and token provided



20
21
22
23
24
# File 'lib/earnshark_sdk/api.rb', line 20

def initialize(product_id,key)
  @product_id, @key = product_id , key
  @base_url = BASE_URL
  @app_dir = APP_DIR
end

Instance Method Details

#app_dirObject



26
27
28
# File 'lib/earnshark_sdk/api.rb', line 26

def app_dir
  @app_dir
end

#base_urlObject



30
31
32
# File 'lib/earnshark_sdk/api.rb', line 30

def base_url
  @base_url
end

#get(url) ⇒ Object



42
43
44
# File 'lib/earnshark_sdk/api.rb', line 42

def get(url)
  HTTP.get(url).body
end

#get_objObject



34
35
36
# File 'lib/earnshark_sdk/api.rb', line 34

def get_obj
  "product_id = #@product_id , token = #@key"
end

#post(url, body) ⇒ Object



38
39
40
# File 'lib/earnshark_sdk/api.rb', line 38

def post(url, body)
  HTTP.post(url, :json => body)
end