streak-ruby 0.0.1 → 0.0.2
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 +8 -8
- data/README.md +40 -4
- data/lib/streak.rb +2 -0
- data/lib/streak/box.rb +2 -3
- data/lib/streak/file.rb +13 -0
- data/lib/streak/search.rb +8 -0
- data/lib/streak/version.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/streak/file_spec.rb +25 -0
- data/spec/streak/search_spec.rb +15 -0
- metadata +8 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                YzZhMDMwYTUyZmNmMGE1ZGIxMjI0NTIyYmM1Yjk3Njc1YjY0NmQ3ZA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZDI5NDg3YTE3ZTY5NDgxYjliMTljMjY0Mjg2ODJmYWRmNzNkM2QwNQ==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                MzBjZGI2NzRlNTZjN2IzYWE4OWQ3NThkMTA0MTIyMDM1Y2I3MjZkYTNkMDE1
         | 
| 10 | 
            +
                ZGMzZmY1MmNhOGZiODkxODY1OTZhZTM5OTYzY2QxMmFiYzhhMjk1MjY1MjNj
         | 
| 11 | 
            +
                YTdmMjExNjhhOTE5ZjZjZWM5ODc3MmQ0NTE2NGE2YTA5MjFhNWU=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                YjE0OTA2MjIxOGQwNzQ5NTExYjFjYmVmN2VmNDIwZTY5NjlkOTdkMzIwMTEy
         | 
| 14 | 
            +
                MjY4YWZjZTdiOTY3ZmY5NjJhNTNiZmZiODhmYTE4YTdkOTUyMzM2YTgxNDdh
         | 
| 15 | 
            +
                NTI3MmZkNjBkNTVlOThkZGQ3OGYzNTlhY2M0Njc2N2E0YzEzYWM=
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            # Streak
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            Ruby bindings for the Streak API [www.streak.com/api/](http://www.streak.com/api/). Streak is a CRM in your Gmail inbox.
         | 
| 4 4 |  | 
| 5 5 | 
             
            ## Installation
         | 
| 6 6 |  | 
| 7 7 | 
             
            Add this line to your application's Gemfile:
         | 
| 8 8 |  | 
| 9 | 
            -
                gem 'streak'
         | 
| 9 | 
            +
                gem 'streak-ruby'
         | 
| 10 10 |  | 
| 11 11 | 
             
            And then execute:
         | 
| 12 12 |  | 
| @@ -14,11 +14,47 @@ And then execute: | |
| 14 14 |  | 
| 15 15 | 
             
            Or install it yourself as:
         | 
| 16 16 |  | 
| 17 | 
            -
                $ gem install streak
         | 
| 17 | 
            +
                $ gem install streak-ruby
         | 
| 18 18 |  | 
| 19 19 | 
             
            ## Usage
         | 
| 20 20 |  | 
| 21 | 
            -
             | 
| 21 | 
            +
            Configure your api key:
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                Streak.api_key = '7941e92da6247ab955aab91ec479a4a2'
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            Retrieve all pipelines:
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                Streak::Pipeline.all
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            Retrieve one pipeline:
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                Streak::Pipeline.find(pipeline_key)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            Create a box:
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                Streak::Box.create(pipeline_key, { :name => 'My customer' })
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            Update the value of box field:
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                Streak::FieldValue.update(box_key, field_key, :value => value)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            See the complete Streak API reference here: [http://www.streak.com/api/](http://www.streak.com/api/)
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            This gem currently supports:
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            * User
         | 
| 46 | 
            +
            * Pipelines
         | 
| 47 | 
            +
            * Boxes
         | 
| 48 | 
            +
            * Stages
         | 
| 49 | 
            +
            * Fields
         | 
| 50 | 
            +
            * Reminders (TODO)
         | 
| 51 | 
            +
            * Files (TODO)
         | 
| 52 | 
            +
            * Threads (TODO)
         | 
| 53 | 
            +
            * Comments (TODO)
         | 
| 54 | 
            +
            * Snippets (TODO)
         | 
| 55 | 
            +
            * Search (TODO)
         | 
| 56 | 
            +
            * Newsfeed (TODO)
         | 
| 57 | 
            +
             | 
| 22 58 |  | 
| 23 59 | 
             
            ## Contributing
         | 
| 24 60 |  | 
    
        data/lib/streak.rb
    CHANGED
    
    
    
        data/lib/streak/box.rb
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            module Streak
         | 
| 2 2 | 
             
              class Box < StreakObject
         | 
| 3 | 
            -
                def self.all(pipeline_key=nil)
         | 
| 3 | 
            +
                def self.all(pipeline_key=nil, params={})
         | 
| 4 4 | 
             
                  path = pipeline_key ? "/pipelines/#{pipeline_key}/boxes" : "/boxes"
         | 
| 5 | 
            -
                  res = Streak.request(:get, path)
         | 
| 5 | 
            +
                  res = Streak.request(:get, path, params)
         | 
| 6 6 | 
             
                  convert_to_streak_object(res, Box)
         | 
| 7 7 | 
             
                end
         | 
| 8 8 |  | 
| @@ -22,4 +22,3 @@ module Streak | |
| 22 22 | 
             
                end
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
            end
         | 
| 25 | 
            -
             | 
    
        data/lib/streak/file.rb
    ADDED
    
    | @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            module Streak
         | 
| 2 | 
            +
              class File < StreakObject
         | 
| 3 | 
            +
                def self.all(box_key)
         | 
| 4 | 
            +
                  res = Streak.request(:get, "/boxes/#{box_key}/files")
         | 
| 5 | 
            +
                  convert_to_streak_object(res, File)
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def self.get_link(file_key)
         | 
| 9 | 
            +
                  res = Streak.request(:get, "/files/#{file_key}/link")
         | 
| 10 | 
            +
                  convert_to_streak_object(res, File)
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
    
        data/lib/streak/version.rb
    CHANGED
    
    
    
        data/spec/spec_helper.rb
    CHANGED
    
    
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            describe Streak::File do
         | 
| 2 | 
            +
              let!(:api) { Streak.mock_rest_client = double('RestClient') }
         | 
| 3 | 
            +
              let(:box) { test_box }
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              describe ".all" do
         | 
| 6 | 
            +
                it "should call the api" do
         | 
| 7 | 
            +
                  api.should_receive(:get).
         | 
| 8 | 
            +
                    with(Streak.api_url("/boxes/box_key_1/files"), nil, nil).
         | 
| 9 | 
            +
                    and_return(test_response(box))
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  Streak::File.all("box_key_1")
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              describe ".get_link" do
         | 
| 16 | 
            +
                it "should call the api" do
         | 
| 17 | 
            +
                  api.should_receive(:get).
         | 
| 18 | 
            +
                    with(Streak.api_url("/files/box_key_1/link"), nil, nil).
         | 
| 19 | 
            +
                    and_return(test_response(box))
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  Streak::File.get_link("box_key_1")
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            describe Streak::Search do
         | 
| 2 | 
            +
              let!(:api) { Streak.mock_rest_client = double('RestClient') }
         | 
| 3 | 
            +
              let(:box) { test_box }
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              describe ".search" do
         | 
| 6 | 
            +
                it "should call the api" do
         | 
| 7 | 
            +
                  api.should_receive(:get).
         | 
| 8 | 
            +
                    with(Streak.api_url("/search?query=box_key_1"), nil, nil).
         | 
| 9 | 
            +
                    and_return(test_response(box))
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  Streak::Search.query("box_key_1")
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: streak-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - JS Boulanger
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-02-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rest-client
         | 
| @@ -100,7 +100,9 @@ files: | |
| 100 100 | 
             
            - lib/streak/box.rb
         | 
| 101 101 | 
             
            - lib/streak/field.rb
         | 
| 102 102 | 
             
            - lib/streak/field_value.rb
         | 
| 103 | 
            +
            - lib/streak/file.rb
         | 
| 103 104 | 
             
            - lib/streak/pipeline.rb
         | 
| 105 | 
            +
            - lib/streak/search.rb
         | 
| 104 106 | 
             
            - lib/streak/stage.rb
         | 
| 105 107 | 
             
            - lib/streak/streak_error.rb
         | 
| 106 108 | 
             
            - lib/streak/streak_object.rb
         | 
| @@ -111,7 +113,9 @@ files: | |
| 111 113 | 
             
            - spec/streak/box_spec.rb
         | 
| 112 114 | 
             
            - spec/streak/field_spec.rb
         | 
| 113 115 | 
             
            - spec/streak/field_value_spec.rb
         | 
| 116 | 
            +
            - spec/streak/file_spec.rb
         | 
| 114 117 | 
             
            - spec/streak/pipeline_spec.rb
         | 
| 118 | 
            +
            - spec/streak/search_spec.rb
         | 
| 115 119 | 
             
            - spec/streak/stage_spec.rb
         | 
| 116 120 | 
             
            - spec/streak/streak_object_spec.rb
         | 
| 117 121 | 
             
            - spec/streak/user_spec.rb
         | 
| @@ -145,7 +149,9 @@ test_files: | |
| 145 149 | 
             
            - spec/streak/box_spec.rb
         | 
| 146 150 | 
             
            - spec/streak/field_spec.rb
         | 
| 147 151 | 
             
            - spec/streak/field_value_spec.rb
         | 
| 152 | 
            +
            - spec/streak/file_spec.rb
         | 
| 148 153 | 
             
            - spec/streak/pipeline_spec.rb
         | 
| 154 | 
            +
            - spec/streak/search_spec.rb
         | 
| 149 155 | 
             
            - spec/streak/stage_spec.rb
         | 
| 150 156 | 
             
            - spec/streak/streak_object_spec.rb
         | 
| 151 157 | 
             
            - spec/streak/user_spec.rb
         |