streak-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2RiZmU2ZGRmNmRhZTNiOTU1NmI0MzY2MjM1M2ZjMWIyYTE1N2NhMg==
4
+ YzZhMDMwYTUyZmNmMGE1ZGIxMjI0NTIyYmM1Yjk3Njc1YjY0NmQ3ZA==
5
5
  data.tar.gz: !binary |-
6
- Yzc3MTRmYjlkZjk1YTQyYjFjZTVlY2FlYTY4OWI0MThmYjQxZGUzOQ==
6
+ ZDI5NDg3YTE3ZTY5NDgxYjliMTljMjY0Mjg2ODJmYWRmNzNkM2QwNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTRkOGIzNDE4MWY5MzE2YzI5MzA4ODY1ZDk4ZDU1NjkxNDBhYzcxZDI1MjUw
10
- MGEzN2E4YzUxZWE0MTZlODhjOTk3YzliMDNmMzFiMmZlMmQwMjE5MzQ4YzU4
11
- ODdjYTE5ZDU1MDc1OGI5OTYyOGU4NGJmZWUzMzk5MzFhYjlkM2M=
9
+ MzBjZGI2NzRlNTZjN2IzYWE4OWQ3NThkMTA0MTIyMDM1Y2I3MjZkYTNkMDE1
10
+ ZGMzZmY1MmNhOGZiODkxODY1OTZhZTM5OTYzY2QxMmFiYzhhMjk1MjY1MjNj
11
+ YTdmMjExNjhhOTE5ZjZjZWM5ODc3MmQ0NTE2NGE2YTA5MjFhNWU=
12
12
  data.tar.gz: !binary |-
13
- YzJhNDE0YjBhZDYwYWY1OGU0ZWQ3YWIxNTUxOTQxZDI1ODZiMGUzOTYwZjQ5
14
- NmQxMjExOWYxMmNjODE1NmQ5MDRkYmVmYjAxYTBmNzI2NDkzN2FkNjdlNDQy
15
- MTExYzAyZjY0NGIxMGM1N2I0YTljNTFlZTI4YWZiN2FlNjYzMjE=
13
+ YjE0OTA2MjIxOGQwNzQ5NTExYjFjYmVmN2VmNDIwZTY5NjlkOTdkMzIwMTEy
14
+ MjY4YWZjZTdiOTY3ZmY5NjJhNTNiZmZiODhmYTE4YTdkOTUyMzM2YTgxNDdh
15
+ NTI3MmZkNjBkNTVlOThkZGQ3OGYzNTlhY2M0Njc2N2E0YzEzYWM=
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Streak
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
 
@@ -13,6 +13,8 @@ require "streak/field_value"
13
13
  require "streak/pipeline"
14
14
  require "streak/stage"
15
15
  require "streak/user"
16
+ require "streak/search"
17
+ require "streak/file"
16
18
 
17
19
  module Streak
18
20
  @api_base = "https://www.streak.com/api/v1"
@@ -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
-
@@ -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
@@ -0,0 +1,8 @@
1
+ module Streak
2
+ class Search < StreakObject
3
+ def self.query(s_query)
4
+ res = Streak.request(:get, "/search", {query: s_query})
5
+ convert_to_streak_object(res, Search)
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Streak
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -164,4 +164,3 @@ def test_user(params={})
164
164
  "key" => "agptYWlsZm9vZ2FlciYLEgxPcmdhbml6YXRpb24iCnN0cmVhay5jb20MCxIEVXNlchgBDA"
165
165
  }.merge(params)
166
166
  end
167
-
@@ -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.1
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: 2013-12-16 00:00:00.000000000 Z
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