g5_facebook_api_client 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
 - data/lib/g5_facebook_api_client/base.rb +23 -21
 - data/lib/g5_facebook_api_client/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 095073cf2d3c4170b509fadcb09a2cd21469a273
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cba4b748b6c564642f03d2ebdef27fe26aa821f8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 200fd9e430c237bd3c248b756ef75335c92d23f533ae6be0f8bc438068dbf86b17fd8c694b394bca203f0d668b95b3bdef0b262bf149b890123097c4dba87ef1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 38f2873f1b63b375e6b85396396b7e7135c76eb85496a5a8f616e59bea31c510a42dd98cbb8f700e0811b30c4ec1e18e4c2249214a2bbcc6a4982750040d30ed
         
     | 
| 
         @@ -1,29 +1,31 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            module G5FacebookApiClient
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                def initialize(client_id, client_secret, page=nil)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  @client_id = client_id
         
     | 
| 
      
 5 
     | 
    
         
            +
                  @client_secret = client_secret
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @page = page
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
                def access_token
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @access_token ||=
         
     | 
| 
      
 11 
     | 
    
         
            +
                    G5FacebookApiClient::AccessToken.new(@client_id, @client_secret).fetch
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
       12 
13 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
                def parse(body)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  JSON.parse(body)
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                def get(url)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  HTTParty.get(encode(url)).body
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
                def post(url)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  HTTParty.post(encode(url)).body
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
                def encode(string)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  URI::encode(string)
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
       27 
29 
     | 
    
         
             
              end
         
     | 
| 
       28 
30 
     | 
    
         
             
            end
         
     | 
| 
       29 
31 
     | 
    
         |