closeio 0.0.13 → 0.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f53ca3aad24b38e5acc395d3a9299510079167f4
4
- data.tar.gz: 105504bdba1a1479106f37e3476de34eae5cfba6
3
+ metadata.gz: 8e0648bd0375689ef1853b50f5601027b23cd14f
4
+ data.tar.gz: 4bd978aa34f085e457e4e039fcfb6ddc8679af10
5
5
  SHA512:
6
- metadata.gz: 06428ec1051bf46dcb5024a19b25a56dad97e3a3f78170ddf13bd8a1ca44e9271558985e5d70866494e718d04d1f48ead771f1bac1d83318d09bbbd4040f1a22
7
- data.tar.gz: 5485cdfe61ede112131bbc58224c7748eb29e3c641fa0a1694090f2244c0d7233701a431018f2db0d1e1ca9984125a71f0b5f15612bd7418b94a73509baddd85
6
+ metadata.gz: b587454b09c9f58e222743b9adf6acbb8cd532e306f447c6b41b5c79106997af504617dc1fad24cd96bfb05c2ac5ffe04c441a2a963bf079cc1f71f4f0c86db8
7
+ data.tar.gz: 2239a9adf7de9bf17b499af45d718529845156aa0416882c387ff45d2674690d43e8883feed76532d27a155d2a72f3a719e902f249668495ef6db6f660d3e3e8
data/README.md CHANGED
@@ -13,6 +13,11 @@ Add this line to your application's Gemfile:
13
13
 
14
14
  # Add your Close.io api key as an ENV variable
15
15
  ENV['CLOSEIO_API_KEY']='xxxxxxxx'
16
+
17
+ # or if you're using Rails
18
+ 1. Create a `closeio.yml` file
19
+ 2. Set `api_key:` to your Closeio api key
20
+ 3. Place it in `/config/initializers/`
16
21
  ````
17
22
 
18
23
  ### Usage
data/lib/closeio.rb CHANGED
@@ -3,6 +3,7 @@ require 'ostruct'
3
3
  require 'forwardable'
4
4
 
5
5
  require 'closeio/base'
6
+ require 'closeio/bulk_action'
6
7
  require 'closeio/contact'
7
8
  require 'closeio/email_activity'
8
9
  require 'closeio/email_template'
@@ -18,4 +19,6 @@ require 'closeio/status_report'
18
19
  require 'closeio/saved_search'
19
20
  require 'closeio/task'
20
21
  require 'closeio/user'
21
- require 'closeio/version'
22
+ require 'closeio/version'
23
+ require 'closeio/config'
24
+ require 'closeio/railtie' if defined?(Rails)
@@ -0,0 +1,25 @@
1
+ module Closeio
2
+ class BulkAction < Base
3
+ def initialize(query, value)
4
+ @query = query
5
+ @value = value
6
+ @path = "#{resource_path}edit/"
7
+ end
8
+
9
+ def clear_custom_field
10
+ post(@path, body: {
11
+ query: @query,
12
+ type: "clear_custom_field",
13
+ custom_field_name: @value}.to_json
14
+ )
15
+ end
16
+
17
+ def set_lead_status
18
+ post(@path, body: {
19
+ query: @query,
20
+ type: "set_lead_status",
21
+ lead_status_id: @value}.to_json
22
+ )
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ module Closeio
2
+ module Config
3
+
4
+ class << self
5
+ attr_accessor :config
6
+ attr_accessor :api_key
7
+ end
8
+
9
+ %w(api_key).each do |method_name|
10
+ define_singleton_method(method_name) do
11
+ @config.fetch(method_name)
12
+ end
13
+ define_singleton_method("#{method_name}=") do |value|
14
+ if @config.blank?
15
+ @config = {method_name => value}
16
+ else
17
+ @config[method_name] = value
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -4,8 +4,12 @@ module Closeio
4
4
  return "/report/custom/"
5
5
  end
6
6
 
7
+ def self.search(organization_id, opt={})
8
+ get "#{resource_path}#{organization_id}/", query: opts
9
+ end
10
+
7
11
  def self.leads organization_id, opts={}
8
12
  get "#{resource_path}lead/#{organization_id}/", query: opts
9
13
  end
10
14
  end
11
- end
15
+ end
@@ -0,0 +1,12 @@
1
+ module Closeio
2
+ class Railtie < Rails::Railtie
3
+
4
+ initializer "setup closeio" do
5
+ config_file = Rails.root.join("config", "closeio.yml")
6
+ if config_file.file?
7
+ Closeio::Config.config = YAML.load(ERB.new(config_file.read).result)[Rails.env]
8
+ Closeio::Base.basic_auth Closeio::Config.api_key, ''
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Closeio
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-26 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crack
@@ -98,6 +98,8 @@ files:
98
98
  - closeio.gemspec
99
99
  - lib/closeio.rb
100
100
  - lib/closeio/base.rb
101
+ - lib/closeio/bulk_action.rb
102
+ - lib/closeio/config.rb
101
103
  - lib/closeio/contact.rb
102
104
  - lib/closeio/custom_report.rb
103
105
  - lib/closeio/email_activity.rb
@@ -109,6 +111,7 @@ files:
109
111
  - lib/closeio/opportunity_status.rb
110
112
  - lib/closeio/organization.rb
111
113
  - lib/closeio/paginated_list.rb
114
+ - lib/closeio/railtie.rb
112
115
  - lib/closeio/saved_search.rb
113
116
  - lib/closeio/status_report.rb
114
117
  - lib/closeio/task.rb
@@ -134,9 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
137
  version: '0'
135
138
  requirements: []
136
139
  rubyforge_project:
137
- rubygems_version: 2.3.0
140
+ rubygems_version: 2.0.14
138
141
  signing_key:
139
142
  specification_version: 4
140
143
  summary: A Ruby wrapper for the CloseIO API
141
144
  test_files: []
142
- has_rdoc: