pipeline_deals 0.3.0 → 0.4.0
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/README.md +3 -1
- data/lib/pipeline_deals.rb +12 -10
- data/lib/pipeline_deals/resource.rb +6 -11
- data/lib/pipeline_deals/resources/account.rb +9 -0
- data/lib/pipeline_deals/version.rb +1 -1
- data/spec/pipeline_deals_spec.rb +18 -0
- data/spec/spec_helper.rb +4 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a67900528bf5064dfa64ec512223b71339038570
|
4
|
+
data.tar.gz: deb94273d3dc4f75a8dcd556d931fe931ab03f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66474587c6d5a7caafa88d5e6f266255dbde36e366da28b8ae37b96d30614f2a1bf3312fb2cb6eb66e00d2296d1167f1d829fcba518da4fb19c9a9bc3e32aad6
|
7
|
+
data.tar.gz: 7e5f7cb83b235555c53813c452b7cafedb97ae2dc9ec89c62c87f8a8987b7d64932001cd9a4bddc9bce479ce508836480f2bbef03a1d807c2d95e0c0d7947cc7
|
data/README.md
CHANGED
@@ -21,7 +21,9 @@ Or install it yourself as:
|
|
21
21
|
First and foremost, register your api key:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
PipelineDeals.
|
24
|
+
PipelineDeals.configure do |config|
|
25
|
+
config.api_key = 'abcd1234'
|
26
|
+
end
|
25
27
|
```
|
26
28
|
|
27
29
|
## Getting a single deal, person, or company:
|
data/lib/pipeline_deals.rb
CHANGED
@@ -7,19 +7,21 @@ require_relative 'pipeline_deals/resources/definitions'
|
|
7
7
|
Dir[File.dirname(__FILE__) + '/resources/*.rb'].each {|file| p "requring #{file}"; require file }
|
8
8
|
|
9
9
|
module PipelineDeals
|
10
|
-
|
11
|
-
|
12
|
-
end
|
10
|
+
class << self
|
11
|
+
attr_accessor :app_key, :api_key, :app_version
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def site
|
14
|
+
PipelineDeals::Resource.site
|
15
|
+
end
|
16
|
+
|
17
|
+
def site=(site)
|
18
|
+
PipelineDeals::Resource.site = site
|
19
|
+
end
|
17
20
|
|
18
|
-
def self.app_key
|
19
|
-
@app_key
|
20
21
|
end
|
21
22
|
|
22
|
-
def self.
|
23
|
-
|
23
|
+
def self.configure
|
24
|
+
yield self
|
25
|
+
true
|
24
26
|
end
|
25
27
|
end
|
@@ -4,30 +4,25 @@ module PipelineDeals
|
|
4
4
|
self.prefix = "/api/v3/"
|
5
5
|
self.collection_parser = PipelineDeals::Collection
|
6
6
|
|
7
|
-
|
8
7
|
def self.find(*arguments)
|
9
8
|
scope = arguments.slice!(0)
|
10
9
|
options = arguments.slice!(0) || {}
|
11
10
|
|
12
|
-
|
13
|
-
self.add_params(options, api_key: PipelineDeals.api_key)
|
11
|
+
add_keys(options[:params] ||= {})
|
14
12
|
|
15
13
|
super(scope, options)
|
16
14
|
end
|
17
15
|
|
18
16
|
def save
|
19
|
-
|
20
|
-
prefix_options[:api_key] = PipelineDeals.api_key
|
17
|
+
PipelineDeals::Resource.add_keys(prefix_options)
|
21
18
|
self.include_root_in_json = true
|
22
19
|
super
|
23
20
|
end
|
24
21
|
|
25
|
-
def self.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
options.merge!({params: params})
|
30
|
-
end
|
22
|
+
def self.add_keys(hash)
|
23
|
+
hash[:app_key] = PipelineDeals.app_key if PipelineDeals.app_key
|
24
|
+
hash[:app_version] = PipelineDeals.app_version if PipelineDeals.app_version
|
25
|
+
hash[:api_key] = PipelineDeals.api_key
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PipelineDeals do
|
4
|
+
describe '#configure' do
|
5
|
+
it 'honors api_key=' do
|
6
|
+
PipelineDeals.configure {|c| c.api_key = 'xyz' }
|
7
|
+
expect(PipelineDeals.api_key).to eq 'xyz'
|
8
|
+
end
|
9
|
+
it 'honors app_key=' do
|
10
|
+
PipelineDeals.configure {|c| c.app_key = 'xyz' }
|
11
|
+
expect(PipelineDeals.app_key).to eq 'xyz'
|
12
|
+
end
|
13
|
+
it 'honors site=' do
|
14
|
+
PipelineDeals.configure {|c| c.site = 'http://localhost:3000' }
|
15
|
+
expect(PipelineDeals::Resource.site.to_s).to eq 'http://localhost:3000'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,8 +14,10 @@ require 'support/has_calendar_entries'
|
|
14
14
|
require 'support/has_people'
|
15
15
|
require 'support/has_deals'
|
16
16
|
|
17
|
-
PipelineDeals
|
18
|
-
|
17
|
+
PipelineDeals.configure do |c|
|
18
|
+
c.site = ENV['PIPELINEDEALS_URL'] || "http://localhost:3000"
|
19
|
+
c.api_key = ENV['PIPELINEDEALS_API_KEY'] || 'iJHyFkMUBSfjUovt29'
|
20
|
+
end
|
19
21
|
|
20
22
|
#ActiveResource::Base.logger = Logger.new(STDOUT)
|
21
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipeline_deals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Ammons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/pipeline_deals/collection.rb
|
86
86
|
- lib/pipeline_deals/resource.rb
|
87
87
|
- lib/pipeline_deals/resources.rb
|
88
|
+
- lib/pipeline_deals/resources/account.rb
|
88
89
|
- lib/pipeline_deals/resources/calendar_entry.rb
|
89
90
|
- lib/pipeline_deals/resources/company.rb
|
90
91
|
- lib/pipeline_deals/resources/company_custom_field_label.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- spec/pipeline_deals/custom_fields_spec.rb
|
153
154
|
- spec/pipeline_deals/deals_spec.rb
|
154
155
|
- spec/pipeline_deals/people_spec.rb
|
156
|
+
- spec/pipeline_deals_spec.rb
|
155
157
|
- spec/spec_helper.rb
|
156
158
|
- spec/support/has_calendar_entries.rb
|
157
159
|
- spec/support/has_deals.rb
|
@@ -230,6 +232,7 @@ test_files:
|
|
230
232
|
- spec/pipeline_deals/custom_fields_spec.rb
|
231
233
|
- spec/pipeline_deals/deals_spec.rb
|
232
234
|
- spec/pipeline_deals/people_spec.rb
|
235
|
+
- spec/pipeline_deals_spec.rb
|
233
236
|
- spec/spec_helper.rb
|
234
237
|
- spec/support/has_calendar_entries.rb
|
235
238
|
- spec/support/has_deals.rb
|