class NameDotCom::API

Public Class Methods

new(*args) click to toggle source
# File lib/name-dot-com.rb, line 16
def initialize(*args)


  @api = Faraday.new(:url => END_POINT) do |builder|
                    builder.request  :url_encoded
                    builder.use Faraday::Response::Mashify
                    builder.use Faraday::Response::ParseJson
                    builder.request  :json 
                   builder.adapter  :net_http
  end


  if args[0].is_a? String and args[1].is_a? String then
    login(args[0],args[1])
  end

end

Public Instance Methods

check_domain(params) click to toggle source
# File lib/name-dot-com.rb, line 39
def check_domain(params)
  @api.post('/api/domain/check',params,'Content-Type' => 'application/json').body
end
hello() click to toggle source
# File lib/name-dot-com.rb, line 36
def hello
 @api.get(ACTIONS[:hello]).body
end
login(account,api_token) click to toggle source
# File lib/name-dot-com.rb, line 33
def login(account,api_token)
  @api.get(ACTIONS[:login],{:account => account, :api_token =>api_token}).body
end