closeio 0.0.2 → 0.0.3
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/closeio.rb +1 -1
 - data/lib/closeio/base.rb +22 -5
 - data/lib/closeio/lead.rb +4 -0
 - data/lib/closeio/version.rb +1 -1
 - metadata +2 -3
 - data/lib/closeio/activity.rb +0 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ea6a4a1f762b4139125b1fc84086e9daaadc347f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e11a5d85462411c9193bc89fe6f76efaea38e277
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: da7ce63b158ff8efb8ecbd11d78fcf5bab73ce7930d38cf949774e772b336058b27063d899a52eb5808f5bd83de6f2ac99eba12e3fcde11da8b0933710226872
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c444b4a271959194a30eb71393e5f02a8a089f2eceb7442af910b8143d3f25c247777ffe0079fcbd75a7a65f40851b1ec3fb2a4bc1cc2ac3bd9e86a6acec1f27
         
     | 
    
        data/lib/closeio.rb
    CHANGED
    
    
    
        data/lib/closeio/base.rb
    CHANGED
    
    | 
         @@ -21,6 +21,11 @@ module Closeio 
     | 
|
| 
       21 
21 
     | 
    
         
             
                  end
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
                def save
         
     | 
| 
      
 25 
     | 
    
         
            +
                  res = put("#{resource_path}#{self.id}", body: opts.to_json)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  res.ok? ? res : bad_response(res)
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       24 
29 
     | 
    
         
             
                class << self
         
     | 
| 
       25 
30 
     | 
    
         
             
                  def bad_response response
         
     | 
| 
       26 
31 
     | 
    
         
             
                    if response.class == HTTParty::Response
         
     | 
| 
         @@ -45,24 +50,36 @@ module Closeio 
     | 
|
| 
       45 
50 
     | 
    
         
             
                    res.success? ? new(res) : bad_response(res)
         
     | 
| 
       46 
51 
     | 
    
         
             
                  end
         
     | 
| 
       47 
52 
     | 
    
         | 
| 
      
 53 
     | 
    
         
            +
                  #
         
     | 
| 
      
 54 
     | 
    
         
            +
                  # Closeio::Lead.update '39292', name: "Bluth Company", contacts: [{name: "Buster Bluth", emails: [{email: "cartographer@bluthcompany.com"}]}]
         
     | 
| 
      
 55 
     | 
    
         
            +
                  #
         
     | 
| 
       48 
56 
     | 
    
         
             
                  def update id, opts={}
         
     | 
| 
       49 
     | 
    
         
            -
                    put "#{resource_path}#{id}", body: opts.to_json
         
     | 
| 
      
 57 
     | 
    
         
            +
                    put "#{resource_path}#{id}/", body: opts.to_json
         
     | 
| 
       50 
58 
     | 
    
         
             
                  end
         
     | 
| 
       51 
59 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                  def destroy
         
     | 
| 
      
 60 
     | 
    
         
            +
                  def destroy id
         
     | 
| 
       53 
61 
     | 
    
         
             
                    if res['data'].is_a? Array
         
     | 
| 
       54 
62 
     | 
    
         
             
                      raise "Yo I'm an array"
         
     | 
| 
       55 
63 
     | 
    
         
             
                    else
         
     | 
| 
       56 
     | 
    
         
            -
                      delete "#{resource_path}#{id}"
         
     | 
| 
      
 64 
     | 
    
         
            +
                      delete "#{resource_path}#{id}/"
         
     | 
| 
       57 
65 
     | 
    
         
             
                    end
         
     | 
| 
       58 
     | 
    
         
            -
                    
         
     | 
| 
       59 
66 
     | 
    
         
             
                  end
         
     | 
| 
       60 
67 
     | 
    
         | 
| 
       61 
68 
     | 
    
         
             
                  def find id
         
     | 
| 
       62 
     | 
    
         
            -
                    res = get "#{resource_path}#{id}"
         
     | 
| 
      
 69 
     | 
    
         
            +
                    res = get "#{resource_path}#{id}/"
         
     | 
| 
       63 
70 
     | 
    
         
             
                    res.ok? ? new(res) : bad_response(res)
         
     | 
| 
       64 
71 
     | 
    
         
             
                  end
         
     | 
| 
       65 
72 
     | 
    
         | 
| 
      
 73 
     | 
    
         
            +
                  def where opts={}
         
     | 
| 
      
 74 
     | 
    
         
            +
                    res = get(resource_path, query: opts)
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                    if res.success?
         
     | 
| 
      
 77 
     | 
    
         
            +
                      res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
         
     | 
| 
      
 78 
     | 
    
         
            +
                    else
         
     | 
| 
      
 79 
     | 
    
         
            +
                      bad_response res
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
       66 
83 
     | 
    
         
             
                  def resource_path
         
     | 
| 
       67 
84 
     | 
    
         
             
                    klass = name.split('::').last.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase
         
     | 
| 
       68 
85 
     | 
    
         
             
                    return "/#{klass}/"
         
     | 
    
        data/lib/closeio/lead.rb
    CHANGED
    
    
    
        data/lib/closeio/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: closeio
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Taylor Brooks
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-12-02 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: crack
         
     | 
| 
         @@ -96,7 +96,6 @@ files: 
     | 
|
| 
       96 
96 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       97 
97 
     | 
    
         
             
            - closeio.gemspec
         
     | 
| 
       98 
98 
     | 
    
         
             
            - lib/closeio.rb
         
     | 
| 
       99 
     | 
    
         
            -
            - lib/closeio/activity.rb
         
     | 
| 
       100 
99 
     | 
    
         
             
            - lib/closeio/base.rb
         
     | 
| 
       101 
100 
     | 
    
         
             
            - lib/closeio/contact.rb
         
     | 
| 
       102 
101 
     | 
    
         
             
            - lib/closeio/email_template.rb
         
     | 
    
        data/lib/closeio/activity.rb
    DELETED