lymbix 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog +1 -0
 - data/lib/lymbix/base.rb +29 -7
 - data/lib/lymbix/configuration.rb +1 -1
 - data/lib/lymbix/request.rb +0 -1
 - data/lib/lymbix/user.rb +7 -5
 - data/lib/lymbix.rb +1 -208
 - metadata +3 -3
 
    
        data/Changelog
    CHANGED
    
    | 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            v0.3.7 - added endpoint attribute to Base for companies implementation
         
     | 
| 
       1 
2 
     | 
    
         
             
            v0.3.6 - added end and start time to data points coming from toneaday
         
     | 
| 
       2 
3 
     | 
    
         
             
            v.0.3.5 - added tonalize_article, tonalize_paragraph which belongs to the 2.0 version of gyrus, also modified the request to include the version header
         
     | 
| 
       3 
4 
     | 
    
         
             
            v.0.3.4 - fixed issue when setting host it still kept default host instead
         
     | 
    
        data/lib/lymbix/base.rb
    CHANGED
    
    | 
         @@ -8,6 +8,7 @@ module Lymbix 
     | 
|
| 
       8 
8 
     | 
    
         
             
                    @auth_key = options[:auth_key]
         
     | 
| 
       9 
9 
     | 
    
         
             
                    @app_id = options[:app_id]
         
     | 
| 
       10 
10 
     | 
    
         
             
                    @lymbix_user_id = options[:lymbix_user_id]
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @endpoint = options[:endpoint]
         
     | 
| 
       11 
12 
     | 
    
         
             
                    @user = User.new(options[:user].merge({:auth_key => options[:auth_key]})) if options[:user]
         
     | 
| 
       12 
13 
     | 
    
         
             
                    if @user
         
     | 
| 
       13 
14 
     | 
    
         
             
                      @lymbix_user_id = @user.lymbix_user_id
         
     | 
| 
         @@ -25,13 +26,23 @@ module Lymbix 
     | 
|
| 
       25 
26 
     | 
    
         
             
                def self.authenticate(email, password, app_id)
         
     | 
| 
       26 
27 
     | 
    
         
             
                  response = Lymbix::Request.new(:post, 'authenticate', {:app_id => app_id}, {:app_id => app_id, :email => email, :password => password}).run
         
     | 
| 
       27 
28 
     | 
    
         
             
                  hash_response = response.data.to_hash
         
     | 
| 
       28 
     | 
    
         
            -
                  self.new(:auth_key => hash_response["auth_key"], :app_id => app_id, :user => {:name => hash_response["name"], :age => hash_response["age"], :country => hash_response["country"], :state => hash_response["state"], :lymbix_user_id => hash_response["id"], :gender => hash_response["gender"], :error_messages => []})
         
     | 
| 
      
 29 
     | 
    
         
            +
                  self.new(:auth_key => hash_response["auth_key"], :app_id => app_id, :endpoint => hash_response["endpoint"], :user => {:name => hash_response["name"], :age => hash_response["age"], :country => hash_response["country"], :state => hash_response["state"], :lymbix_user_id => hash_response["id"], :gender => hash_response["gender"], :error_messages => []})
         
     | 
| 
       29 
30 
     | 
    
         
             
                rescue RestClient::Unauthorized
         
     | 
| 
       30 
31 
     | 
    
         
             
                  self.new(:error_messages => "Wrong Password")
         
     | 
| 
       31 
32 
     | 
    
         
             
                rescue Exception => ex
         
     | 
| 
       32 
33 
     | 
    
         
             
                  self.new(:error_messages => "#{ex.message} \n #{ex.backtrace}")
         
     | 
| 
       33 
34 
     | 
    
         
             
                end
         
     | 
| 
       34 
35 
     | 
    
         | 
| 
      
 36 
     | 
    
         
            +
                def self.authenticate_from_auth_and_id(lymbix_user_id, auth_key, app_id)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  ActiveRecord::Base.logger.info "self.authenticate_from_auth_and_id"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  
         
     | 
| 
      
 39 
     | 
    
         
            +
                  response = Lymbix::Request.new(:post, 'authenticate_from_auth_and_id', {:app_id => app_id}, {:app_id => app_id, :lymbix_user_id => lymbix_user_id, :auth_key => auth_key}).run
         
     | 
| 
      
 40 
     | 
    
         
            +
                  hash_response = response.data.to_hash
         
     | 
| 
      
 41 
     | 
    
         
            +
                  self.new(:auth_key => hash_response["auth_key"], :app_id => app_id, :user => {:name => hash_response["name"], :age => hash_response["age"], :country => hash_response["country"], :state => hash_response["state"], :lymbix_user_id => hash_response["id"], :gender => hash_response["gender"], :error_messages => []})
         
     | 
| 
      
 42 
     | 
    
         
            +
                rescue Exception => ex
         
     | 
| 
      
 43 
     | 
    
         
            +
                  self.new(:error_messages => "#{ex.message} \n #{ex.backtrace}")
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
                
         
     | 
| 
       35 
46 
     | 
    
         
             
                def service_up
         
     | 
| 
       36 
47 
     | 
    
         
             
                  response = request(:get, 'service_up').data
         
     | 
| 
       37 
48 
     | 
    
         
             
                end
         
     | 
| 
         @@ -147,6 +158,12 @@ module Lymbix 
     | 
|
| 
       147 
158 
     | 
    
         
             
                  response.data['data']
         
     | 
| 
       148 
159 
     | 
    
         
             
                end
         
     | 
| 
       149 
160 
     | 
    
         | 
| 
      
 161 
     | 
    
         
            +
                def medulla_data_points(phrase)
         
     | 
| 
      
 162 
     | 
    
         
            +
                  response = request(:get, "medulla_data_points", {:app_id => @app_id, :phrase => phrase})
         
     | 
| 
      
 163 
     | 
    
         
            +
                  ActiveRecord::Base.logger.info "!!! medulla_data_points #{response.data['data']}"
         
     | 
| 
      
 164 
     | 
    
         
            +
                  response.data['data']
         
     | 
| 
      
 165 
     | 
    
         
            +
                end
         
     | 
| 
      
 166 
     | 
    
         
            +
                
         
     | 
| 
       150 
167 
     | 
    
         
             
                def user_search(query)
         
     | 
| 
       151 
168 
     | 
    
         
             
                  response = request(:post, "user_search", {:app_id => @app_id, :query => query})
         
     | 
| 
       152 
169 
     | 
    
         
             
                  response.data['users']
         
     | 
| 
         @@ -173,13 +190,13 @@ module Lymbix 
     | 
|
| 
       173 
190 
     | 
    
         
             
                  response = request(:post, 'word_data', {:phrase => phrase}).data
         
     | 
| 
       174 
191 
     | 
    
         
             
                end
         
     | 
| 
       175 
192 
     | 
    
         | 
| 
       176 
     | 
    
         
            -
                def update_user_app_config(user_app_config_xml)
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                end
         
     | 
| 
      
 193 
     | 
    
         
            +
                # def update_user_app_config(user_app_config_xml)
         
     | 
| 
      
 194 
     | 
    
         
            +
                #       response = request(:post, 'update_user_app_config', {:user_app_config => user_app_config_xml},{:version => 2}).data
         
     | 
| 
      
 195 
     | 
    
         
            +
                #     end
         
     | 
| 
       179 
196 
     | 
    
         | 
| 
       180 
     | 
    
         
            -
                def checksum_user_app_config
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                end
         
     | 
| 
      
 197 
     | 
    
         
            +
                # def checksum_user_app_config(checksum)
         
     | 
| 
      
 198 
     | 
    
         
            +
                #               response = request(:post, 'checksum_user_app_config',{:checksum_user_app_config => checksum},{:version => 2}).data
         
     | 
| 
      
 199 
     | 
    
         
            +
                #             end
         
     | 
| 
       183 
200 
     | 
    
         | 
| 
       184 
201 
     | 
    
         
             
                def tonalize_words(phrase)
         
     | 
| 
       185 
202 
     | 
    
         
             
                  response = request(:post, 'tonalize_words', {:phrase => phrase}).data
         
     | 
| 
         @@ -225,6 +242,11 @@ module Lymbix 
     | 
|
| 
       225 
242 
     | 
    
         
             
                  response = request(:post, 'swap_groups', {:lymbix_user_id => lymbix_user_id, :group_remove => group_remove, :group_add => group_add})
         
     | 
| 
       226 
243 
     | 
    
         
             
                end
         
     | 
| 
       227 
244 
     | 
    
         | 
| 
      
 245 
     | 
    
         
            +
                def phrase_search(query)
         
     | 
| 
      
 246 
     | 
    
         
            +
                  response = request(:post, "phrase_search", {:app_id => @app_id, :query => query})
         
     | 
| 
      
 247 
     | 
    
         
            +
                  response.data['phrases']
         
     | 
| 
      
 248 
     | 
    
         
            +
                end
         
     | 
| 
      
 249 
     | 
    
         
            +
                
         
     | 
| 
       228 
250 
     | 
    
         
             
                private
         
     | 
| 
       229 
251 
     | 
    
         
             
                def request(action, method, data = nil,headers = nil)
         
     | 
| 
       230 
252 
     | 
    
         
             
                  if headers
         
     | 
    
        data/lib/lymbix/configuration.rb
    CHANGED
    
    
    
        data/lib/lymbix/request.rb
    CHANGED
    
    
    
        data/lib/lymbix/user.rb
    CHANGED
    
    | 
         @@ -30,6 +30,7 @@ module Lymbix 
     | 
|
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                def self.authenticate(email, password, app_id)
         
     | 
| 
       32 
32 
     | 
    
         
             
                  response = Lymbix::Request.new(:post, 'authenticate', {:app_id => app_id}, {:email => email, :password => password, :app_id => app_id}).run
         
     | 
| 
      
 33 
     | 
    
         
            +
                  ActiveRecord::Base.logger.info "!!! self.authenticate response.inspect"
         
     | 
| 
       33 
34 
     | 
    
         
             
                  self.new(response.data.to_hash)
         
     | 
| 
       34 
35 
     | 
    
         
             
                rescue RestClient::Unauthorized      
         
     | 
| 
       35 
36 
     | 
    
         
             
                  self.new(:error_messages => ["Wrong Password"])
         
     | 
| 
         @@ -38,16 +39,17 @@ module Lymbix 
     | 
|
| 
       38 
39 
     | 
    
         
             
                end
         
     | 
| 
       39 
40 
     | 
    
         | 
| 
       40 
41 
     | 
    
         
             
                def self.enable_application(params)
         
     | 
| 
       41 
     | 
    
         
            -
                  begin
         
     | 
| 
       42 
     | 
    
         
            -
                    response = Lymbix::Request.new(:post, 'enable_application', {:app_id => params[:app_id]}, {:email => params[:email], :password => params[:password]}).run
         
     | 
| 
      
 42 
     | 
    
         
            +
                  begin        
         
     | 
| 
      
 43 
     | 
    
         
            +
                    response = Lymbix::Request.new(:post, 'enable_application', {:app_id => params[:app_id]}, {:email => params[:email], :password => params[:password]}).run        
         
     | 
| 
       43 
44 
     | 
    
         
             
                    self.new(response.data.to_hash)
         
     | 
| 
       44 
     | 
    
         
            -
                  rescue Exception => ex
         
     | 
| 
      
 45 
     | 
    
         
            +
                  rescue Exception => ex        
         
     | 
| 
       45 
46 
     | 
    
         
             
                    self.new(:error_messages => [ex.message])
         
     | 
| 
       46 
47 
     | 
    
         
             
                  end
         
     | 
| 
       47 
48 
     | 
    
         
             
                end
         
     | 
| 
       48 
49 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                def self.find_by_email(params) 
     | 
| 
       50 
     | 
    
         
            -
                   
     | 
| 
      
 50 
     | 
    
         
            +
                def self.find_by_email(params)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  ActiveRecord::Base.logger.info "!!! self.find_by_email(params)  #{params[:email]}"
         
     | 
| 
      
 52 
     | 
    
         
            +
                  begin
         
     | 
| 
       51 
53 
     | 
    
         
             
                    response = Lymbix::Request.new(:post, 'user_find_by_email', {:app_id => params[:app_id]}, {:email => params[:email]}).run
         
     | 
| 
       52 
54 
     | 
    
         
             
                    self.new(response.data.to_hash)
         
     | 
| 
       53 
55 
     | 
    
         
             
                  rescue Exception => ex
         
     | 
    
        data/lib/lymbix.rb
    CHANGED
    
    | 
         @@ -8,211 +8,4 @@ require 'lymbix/word' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            require 'lymbix/base'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require 'lymbix/connotative_category'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require 'lymbix/tweet'
         
     | 
| 
       11 
     | 
    
         
            -
            require 'lymbix/data_point'
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            # require 'rest_client'
         
     | 
| 
       14 
     | 
    
         
            -
            # require 'json'
         
     | 
| 
       15 
     | 
    
         
            -
            # require 'benchmark'
         
     | 
| 
       16 
     | 
    
         
            -
            # 
         
     | 
| 
       17 
     | 
    
         
            -
            # module Lymbix
         
     | 
| 
       18 
     | 
    
         
            -
            # 
         
     | 
| 
       19 
     | 
    
         
            -
            #   GYRUS_URL = "http://localhost:4567"
         
     | 
| 
       20 
     | 
    
         
            -
            #   FORNIX_URL = "http://localhost:9393"
         
     | 
| 
       21 
     | 
    
         
            -
            # 
         
     | 
| 
       22 
     | 
    
         
            -
            #   @@auth_token = ''
         
     | 
| 
       23 
     | 
    
         
            -
            #   @@response = nil
         
     | 
| 
       24 
     | 
    
         
            -
            # 
         
     | 
| 
       25 
     | 
    
         
            -
            #   cattr_accessor :auth_token
         
     | 
| 
       26 
     | 
    
         
            -
            # 
         
     | 
| 
       27 
     | 
    
         
            -
            # 
         
     | 
| 
       28 
     | 
    
         
            -
            #   def self.request(resource, action = "get", object = nil, fornix = false)
         
     | 
| 
       29 
     | 
    
         
            -
            #     result = nil
         
     | 
| 
       30 
     | 
    
         
            -
            #     connection = RestClient::Resource.new(fornix ? FORNIX_URL : GYRUS_URL, :headers => { :AUTHENTICATION => @@auth_token })
         
     | 
| 
       31 
     | 
    
         
            -
            #     case(action)
         
     | 
| 
       32 
     | 
    
         
            -
            #     when "get"
         
     | 
| 
       33 
     | 
    
         
            -
            #       result = connection[resource].get
         
     | 
| 
       34 
     | 
    
         
            -
            #     when "post"
         
     | 
| 
       35 
     | 
    
         
            -
            #       result = connection[resource].post object
         
     | 
| 
       36 
     | 
    
         
            -
            #     end
         
     | 
| 
       37 
     | 
    
         
            -
            #     result
         
     | 
| 
       38 
     | 
    
         
            -
            #   end
         
     | 
| 
       39 
     | 
    
         
            -
            # 
         
     | 
| 
       40 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       41 
     | 
    
         
            -
            #   # BaseObject
         
     | 
| 
       42 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       43 
     | 
    
         
            -
            # 
         
     | 
| 
       44 
     | 
    
         
            -
            #   class BaseObject < Struct
         
     | 
| 
       45 
     | 
    
         
            -
            #   end
         
     | 
| 
       46 
     | 
    
         
            -
            # 
         
     | 
| 
       47 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       48 
     | 
    
         
            -
            #   # Users
         
     | 
| 
       49 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       50 
     | 
    
         
            -
            #   
         
     | 
| 
       51 
     | 
    
         
            -
            #   User = BaseObject.new(:id, :login, :email, :gender, :country, :state, :age)
         
     | 
| 
       52 
     | 
    
         
            -
            #   
         
     | 
| 
       53 
     | 
    
         
            -
            #   class User
         
     | 
| 
       54 
     | 
    
         
            -
            # 
         
     | 
| 
       55 
     | 
    
         
            -
            #     def self.authenticate(login, password)
         
     | 
| 
       56 
     | 
    
         
            -
            #       resp = Lymbix::request("login", "post", {:login => login, :password => password}, true)
         
     | 
| 
       57 
     | 
    
         
            -
            #       return nil if resp == "null"
         
     | 
| 
       58 
     | 
    
         
            -
            # 
         
     | 
| 
       59 
     | 
    
         
            -
            #       user = JSON.load(resp)
         
     | 
| 
       60 
     | 
    
         
            -
            # 
         
     | 
| 
       61 
     | 
    
         
            -
            #       User.new(user["id"], user["login"], user["email"], user["gender"], user["country"], user["state"], user["age"])
         
     | 
| 
       62 
     | 
    
         
            -
            #     end
         
     | 
| 
       63 
     | 
    
         
            -
            # 
         
     | 
| 
       64 
     | 
    
         
            -
            #   end
         
     | 
| 
       65 
     | 
    
         
            -
            # 
         
     | 
| 
       66 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       67 
     | 
    
         
            -
            #   # Words
         
     | 
| 
       68 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       69 
     | 
    
         
            -
            # 
         
     | 
| 
       70 
     | 
    
         
            -
            #   Word = BaseObject.new(:id, :word, :is_external, :is_phrase)
         
     | 
| 
       71 
     | 
    
         
            -
            # 
         
     | 
| 
       72 
     | 
    
         
            -
            #   #<struct Lymbix::Word id={:is_external=>false, :id=>34941, :word=>"demand"}, word=nil, is_external=nil>
         
     | 
| 
       73 
     | 
    
         
            -
            # 
         
     | 
| 
       74 
     | 
    
         
            -
            #   class Word
         
     | 
| 
       75 
     | 
    
         
            -
            # 
         
     | 
| 
       76 
     | 
    
         
            -
            #     def self.count
         
     | 
| 
       77 
     | 
    
         
            -
            #       resp = Lymbix::request('word_count')
         
     | 
| 
       78 
     | 
    
         
            -
            #     end
         
     | 
| 
       79 
     | 
    
         
            -
            # 
         
     | 
| 
       80 
     | 
    
         
            -
            #     def self.top_random
         
     | 
| 
       81 
     | 
    
         
            -
            #       resp = Lymbix::request('top_random')
         
     | 
| 
       82 
     | 
    
         
            -
            #       word = JSON.load(resp)
         
     | 
| 
       83 
     | 
    
         
            -
            # 
         
     | 
| 
       84 
     | 
    
         
            -
            #       return nil if word.nil? || word.empty?
         
     | 
| 
       85 
     | 
    
         
            -
            #       Word.new(word["id"], word["word"], word["is_external"], word["is_phrase"])
         
     | 
| 
       86 
     | 
    
         
            -
            #     end
         
     | 
| 
       87 
     | 
    
         
            -
            # 
         
     | 
| 
       88 
     | 
    
         
            -
            #     def self.add_word(word, definition, is_phrase = false)
         
     | 
| 
       89 
     | 
    
         
            -
            #       resp = Lymbix::request('words', 'post', {:word => word, :definition => definition, :is_external => true, :is_phrase => is_phrase})
         
     | 
| 
       90 
     | 
    
         
            -
            #       word = JSON.load(resp)
         
     | 
| 
       91 
     | 
    
         
            -
            #       return nil if word.nil? || word.empty?
         
     | 
| 
       92 
     | 
    
         
            -
            #       Word.new(word["id"], word["word"], word["is_external"], word["is_phrase"])
         
     | 
| 
       93 
     | 
    
         
            -
            #     end
         
     | 
| 
       94 
     | 
    
         
            -
            # 
         
     | 
| 
       95 
     | 
    
         
            -
            #     def self.lookup(word)
         
     | 
| 
       96 
     | 
    
         
            -
            #       resp = Lymbix::request("lookup/#{word}")
         
     | 
| 
       97 
     | 
    
         
            -
            #       return nil if resp == "null"
         
     | 
| 
       98 
     | 
    
         
            -
            # 
         
     | 
| 
       99 
     | 
    
         
            -
            #       word = JSON.load(resp)
         
     | 
| 
       100 
     | 
    
         
            -
            # 
         
     | 
| 
       101 
     | 
    
         
            -
            #       return nil if word.nil? || word.empty?
         
     | 
| 
       102 
     | 
    
         
            -
            #       Word.new(word["id"], word["word"], word["is_external"], word["is_phrase"])
         
     | 
| 
       103 
     | 
    
         
            -
            #     end
         
     | 
| 
       104 
     | 
    
         
            -
            # 
         
     | 
| 
       105 
     | 
    
         
            -
            #     def self.search(word)
         
     | 
| 
       106 
     | 
    
         
            -
            #       resp = Lymbix::request("search/#{word}")
         
     | 
| 
       107 
     | 
    
         
            -
            #       word = JSON.load(resp)
         
     | 
| 
       108 
     | 
    
         
            -
            # 
         
     | 
| 
       109 
     | 
    
         
            -
            #       return nil if word.nil? || word.empty?
         
     | 
| 
       110 
     | 
    
         
            -
            #       Word.new(word["id"], word["word"], word["is_external"], word["is_phrase"])
         
     | 
| 
       111 
     | 
    
         
            -
            #     end
         
     | 
| 
       112 
     | 
    
         
            -
            # 
         
     | 
| 
       113 
     | 
    
         
            -
            #     def self.find(word_id)
         
     | 
| 
       114 
     | 
    
         
            -
            #       resp = Lymbix::request("words/#{word_id}")
         
     | 
| 
       115 
     | 
    
         
            -
            #       word = JSON.load(resp)
         
     | 
| 
       116 
     | 
    
         
            -
            # 
         
     | 
| 
       117 
     | 
    
         
            -
            #       return nil if word.nil? || word.empty?
         
     | 
| 
       118 
     | 
    
         
            -
            #       Word.new(word["id"], word["word"], word["is_external"], word["is_phrase"])
         
     | 
| 
       119 
     | 
    
         
            -
            #     end
         
     | 
| 
       120 
     | 
    
         
            -
            # 
         
     | 
| 
       121 
     | 
    
         
            -
            #     def definitions
         
     | 
| 
       122 
     | 
    
         
            -
            #       Definition::list(self.id)
         
     | 
| 
       123 
     | 
    
         
            -
            #     end
         
     | 
| 
       124 
     | 
    
         
            -
            # 
         
     | 
| 
       125 
     | 
    
         
            -
            #   end
         
     | 
| 
       126 
     | 
    
         
            -
            # 
         
     | 
| 
       127 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       128 
     | 
    
         
            -
            #   # Tweets
         
     | 
| 
       129 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       130 
     | 
    
         
            -
            # 
         
     | 
| 
       131 
     | 
    
         
            -
            #   Tweet = BaseObject.new(:id, :is_user_created, :tweet, :requested_count)
         
     | 
| 
       132 
     | 
    
         
            -
            # 
         
     | 
| 
       133 
     | 
    
         
            -
            #   class Tweet
         
     | 
| 
       134 
     | 
    
         
            -
            # 
         
     | 
| 
       135 
     | 
    
         
            -
            #     def self.top_tweet
         
     | 
| 
       136 
     | 
    
         
            -
            #       resp = Lymbix::request('top_tweet')
         
     | 
| 
       137 
     | 
    
         
            -
            #       resp = JSON.load(resp)
         
     | 
| 
       138 
     | 
    
         
            -
            # 
         
     | 
| 
       139 
     | 
    
         
            -
            #       return nil if resp.nil?
         
     | 
| 
       140 
     | 
    
         
            -
            #       Tweet.new(resp["id"], resp["is_user_created"], resp["tweet"], resp["requested_count"])
         
     | 
| 
       141 
     | 
    
         
            -
            #     end
         
     | 
| 
       142 
     | 
    
         
            -
            # 
         
     | 
| 
       143 
     | 
    
         
            -
            #   end
         
     | 
| 
       144 
     | 
    
         
            -
            # 
         
     | 
| 
       145 
     | 
    
         
            -
            # 
         
     | 
| 
       146 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       147 
     | 
    
         
            -
            #   # Definitions
         
     | 
| 
       148 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       149 
     | 
    
         
            -
            # 
         
     | 
| 
       150 
     | 
    
         
            -
            #   Definition = BaseObject.new(:id, :pos, :category_id, :definition)
         
     | 
| 
       151 
     | 
    
         
            -
            # 
         
     | 
| 
       152 
     | 
    
         
            -
            #   class Definition
         
     | 
| 
       153 
     | 
    
         
            -
            # 
         
     | 
| 
       154 
     | 
    
         
            -
            #     def self.list(word_id)
         
     | 
| 
       155 
     | 
    
         
            -
            #       resp = Lymbix::request("word/#{word_id}/definitions")   #Change to Words
         
     | 
| 
       156 
     | 
    
         
            -
            #       definitions = JSON.load(resp)
         
     | 
| 
       157 
     | 
    
         
            -
            #       definition_list = []
         
     | 
| 
       158 
     | 
    
         
            -
            #       definitions.each do |definition|
         
     | 
| 
       159 
     | 
    
         
            -
            #         definition_list << Definition.new(definition["id"], definition["pos"], definition["category_id"], definition["definition"])
         
     | 
| 
       160 
     | 
    
         
            -
            #       end 
         
     | 
| 
       161 
     | 
    
         
            -
            #       definition_list
         
     | 
| 
       162 
     | 
    
         
            -
            #     end
         
     | 
| 
       163 
     | 
    
         
            -
            # 
         
     | 
| 
       164 
     | 
    
         
            -
            #     def self.find(definition_id)
         
     | 
| 
       165 
     | 
    
         
            -
            #       resp = Lymbix::request("definitions/#{definition_id}")
         
     | 
| 
       166 
     | 
    
         
            -
            #       definition = JSON.load(resp)
         
     | 
| 
       167 
     | 
    
         
            -
            #       Definition.new(definition["id"], definition["pos"], definition["category_id"], definition["definition"])
         
     | 
| 
       168 
     | 
    
         
            -
            #     end
         
     | 
| 
       169 
     | 
    
         
            -
            # 
         
     | 
| 
       170 
     | 
    
         
            -
            #   end
         
     | 
| 
       171 
     | 
    
         
            -
            # 
         
     | 
| 
       172 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       173 
     | 
    
         
            -
            #   # ConnotativeCategory
         
     | 
| 
       174 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       175 
     | 
    
         
            -
            # 
         
     | 
| 
       176 
     | 
    
         
            -
            #   ConnotativeCategory = BaseObject.new(:id, :name, :is_positive)
         
     | 
| 
       177 
     | 
    
         
            -
            # 
         
     | 
| 
       178 
     | 
    
         
            -
            #   class ConnotativeCategory
         
     | 
| 
       179 
     | 
    
         
            -
            #     def self.all
         
     | 
| 
       180 
     | 
    
         
            -
            #       resp = Lymbix::request("connotative_categories")
         
     | 
| 
       181 
     | 
    
         
            -
            #       connotative_categories = JSON.load(resp)
         
     | 
| 
       182 
     | 
    
         
            -
            #       connotative_categories_list = []
         
     | 
| 
       183 
     | 
    
         
            -
            #       connotative_categories.each do |connotative_category|
         
     | 
| 
       184 
     | 
    
         
            -
            #         connotative_categories_list << ConnotativeCategory.new(connotative_category["id"], connotative_category["name"], connotative_category["is_positive"])
         
     | 
| 
       185 
     | 
    
         
            -
            #       end
         
     | 
| 
       186 
     | 
    
         
            -
            #       puts connotative_categories_list.inspect
         
     | 
| 
       187 
     | 
    
         
            -
            #       connotative_categories_list
         
     | 
| 
       188 
     | 
    
         
            -
            #     end
         
     | 
| 
       189 
     | 
    
         
            -
            # 
         
     | 
| 
       190 
     | 
    
         
            -
            #     def self.find(id)
         
     | 
| 
       191 
     | 
    
         
            -
            #       resp = Lymbix::request("connotative_categories/#{id}")
         
     | 
| 
       192 
     | 
    
         
            -
            #       connotative_category = JSON.load(resp)
         
     | 
| 
       193 
     | 
    
         
            -
            #       ConnotativeCategory.new(connotative_category["id"], connotative_category["name"], connotative_category["is_positive"])
         
     | 
| 
       194 
     | 
    
         
            -
            #     end
         
     | 
| 
       195 
     | 
    
         
            -
            #   end
         
     | 
| 
       196 
     | 
    
         
            -
            # 
         
     | 
| 
       197 
     | 
    
         
            -
            #   #--------------------------------------------------------------------------
         
     | 
| 
       198 
     | 
    
         
            -
            #   # DataPoint
         
     | 
| 
       199 
     | 
    
         
            -
            #   #==========================================================================
         
     | 
| 
       200 
     | 
    
         
            -
            # 
         
     | 
| 
       201 
     | 
    
         
            -
            #   DataPoint = BaseObject.new(:id, :word_id, :definition_id, :category_id, :data, :created_at, :updated_at, :user_id)
         
     | 
| 
       202 
     | 
    
         
            -
            # 
         
     | 
| 
       203 
     | 
    
         
            -
            #   class DataPoint
         
     | 
| 
       204 
     | 
    
         
            -
            #     def save
         
     | 
| 
       205 
     | 
    
         
            -
            #       resp = Lymbix::request("data_points", "post", {:word_id => self["word_id"], :definition_id => self["definition_id"], :category_id => self["category_id"], :data => self["data"], :user_id => self["user_id"]})
         
     | 
| 
       206 
     | 
    
         
            -
            #       data_point = JSON.load(resp)
         
     | 
| 
       207 
     | 
    
         
            -
            #       DataPoint.new(data_point["id"], data_point["word_id"], data_point["definition_id"], data_point["category_id"], data_point["data"], data_point["created_at"], data_point["updated_at"], data_point["user_id"])
         
     | 
| 
       208 
     | 
    
         
            -
            #     end
         
     | 
| 
       209 
     | 
    
         
            -
            # 
         
     | 
| 
       210 
     | 
    
         
            -
            #     def self.find(data_point_id)
         
     | 
| 
       211 
     | 
    
         
            -
            #       resp = Lymbix::request("data_points/#{data_point_id}")
         
     | 
| 
       212 
     | 
    
         
            -
            #       data_point = JSON.load(resp)
         
     | 
| 
       213 
     | 
    
         
            -
            #       DataPoint.new(data_point["id"], data_point["word_id"], data_point["definition_id"], data_point["category_id"], data_point["data"], data_point["created_at"], data_point["updated_at"], data_point["user_id"])
         
     | 
| 
       214 
     | 
    
         
            -
            #     end
         
     | 
| 
       215 
     | 
    
         
            -
            # 
         
     | 
| 
       216 
     | 
    
         
            -
            #   end
         
     | 
| 
       217 
     | 
    
         
            -
            # 
         
     | 
| 
       218 
     | 
    
         
            -
            # end
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'lymbix/data_point'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: lymbix
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 29
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 3
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 7
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.3.7
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Patrick Roy
         
     |