Class: ScribeAPI

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/scribe_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ ScribeAPI

Returns a new instance of ScribeAPI.



15
16
17
# File 'lib/scribe_api.rb', line 15

def initialize( key )
  @key = key
end

Instance Method Details

#content_analysis(params = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/scribe_api.rb', line 41

def content_analysis( params={} )
  options = { :body => { :htmlTitle => params[:title], :htmlDescription => params[:description], :htmlHeadline => params[:headline], :htmlBody => params[:body], :targetedKeyword => params[:keyword], :domain => params[:domain] }.to_json }
  httparty = self.class.post( "/analysis/content?apikey=#{@key}", options )
  result = {}
  
  if httparty.code == 200
    result = httparty.parsed_response
  end
  result
end

#keyword_details(params = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/scribe_api.rb', line 30

def keyword_details( params={} )
  options = { :body => { :query => params[:keyword], :domain => params[:domain] }.to_json }
  httparty = self.class.post( "/analysis/kw/detail?apikey=#{@key}", options )
  result = {}
  
  if httparty.code == 200
    result = httparty.parsed_response
  end
  result
end

#keyword_suggestions(params = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/scribe_api.rb', line 19

def keyword_suggestions( params={} )
  options = { :body => { :query => params[:keyword] }.to_json }
  httparty = self.class.post( "/analysis/kw/suggestions?apikey=#{@key}", options )
  result = {}
  
  if httparty.code == 200
    result = httparty.parsed_response
  end
  result
end


52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/scribe_api.rb', line 52

def link_building( params={} )
  # options = { :body => { :query => params[:keyword], :domain => params[:domain] }.to_json }
  # httparty =self.class.post( "/analysis/link?apikey=#{@key}", options )
  # 
  # if httparty.code == 200
  #   result = httparty.parsed_response
  # end
  # result
  
  # return empty hash cause scribe is working on this endpt.
  {}
end

#user_information(params = {}) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/scribe_api.rb', line 65

def user_information( params={} )
  httparty = self.class.get( "/membership/user/detail?apikey=#{@key}" )
  result = {}
  
  if httparty.code == 200
    result = httparty.parsed_response
  end
  result
end