active_campaign 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,5 @@ require 'spec_helper'
2
2
 
3
3
  module ActiveCampaign
4
4
  describe Client do
5
-
6
5
  end
7
- end
6
+ end
@@ -1,54 +1,21 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
- require 'pry'
4
- require "codeclimate-test-reporter"
5
- formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
6
-
7
- if ENV['CODECLIMATE_REPO_TOKEN']
8
- formatters << CodeClimate::TestReporter::Formatter
9
- CodeClimate::TestReporter.start
10
- end
1
+ require_relative 'support/coverage'
11
2
 
12
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
13
- SimpleCov.start
14
-
15
- require "active_campaign"
3
+ require 'pry'
16
4
  require 'rspec'
17
- require 'webmock/rspec'
18
-
19
- WebMock.disable_net_connect!(:allow => ['coveralls.io', 'codeclimate.com'])
5
+ require 'active_campaign'
20
6
 
21
7
  RSpec.configure do |config|
22
- config.treat_symbols_as_metadata_keys_with_true_values = true
23
8
  config.filter_run focus: true
24
- config.order = "random"
9
+ config.order = 'random'
25
10
  config.run_all_when_everything_filtered = true
26
11
  config.expect_with :rspec do |c|
27
12
  c.syntax = :expect
28
13
  end
29
- end
30
-
31
- require 'vcr'
32
- VCR.configure do |c|
33
- c.configure_rspec_metadata!
34
- c.filter_sensitive_data('<API_KEY>') do
35
- ENV['ACTIVE_CAMPAIGN_API_KEY']
36
- end
37
14
 
38
- c.filter_sensitive_data('<API_ENDPOINT>') do
39
- ENV['ACTIVE_CAMPAIGN_API_ENDPOINT']
15
+ config.before(:suite) do
16
+ HTTPI.log = false
17
+ HTTPI.log_level = :fatal
40
18
  end
41
-
42
- c.default_cassette_options = {
43
- serialize_with: :json,
44
-
45
- preserve_exact_body_bytes: true,
46
- decode_compressed_response: true,
47
- record: ENV['CI'] ? :none : :once
48
- }
49
- c.cassette_library_dir = 'spec/cassettes'
50
- c.hook_into :webmock
51
- c.ignore_hosts 'codeclimate.com'
52
19
  end
53
20
 
54
21
  def test_api_endpoint
@@ -61,14 +28,8 @@ end
61
28
 
62
29
  def initialize_new_client
63
30
  before do
64
- @client = ActiveCampaign::Client.new(
65
- mash: true,
66
- debug: true,
67
- api_endpoint: test_api_endpoint,
68
- api_key: test_api_key,
69
- log_level: :debug,
70
- log: true
71
- )
31
+ initialize_active_campaign
32
+ @client = ActiveCampaign::Client.new
72
33
  end
73
34
  end
74
35
 
@@ -76,10 +37,10 @@ def initialize_active_campaign
76
37
  ActiveCampaign.configure do |config|
77
38
  config.api_endpoint = test_api_endpoint
78
39
  config.api_key = test_api_key
79
- config.api_output = "json"
80
- config.debug = true
81
- config.log_level = :debug
82
- config.log = true
40
+ config.api_output = 'json'
41
+ config.debug = false
42
+ config.log_level = :fatal
43
+ config.log = false
83
44
  config.mash = true
84
45
  end
85
- end
46
+ end
@@ -0,0 +1,12 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ require 'codeclimate-test-reporter'
4
+ formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
5
+
6
+ if ENV['CODECLIMATE_REPO_TOKEN']
7
+ formatters << CodeClimate::TestReporter::Formatter
8
+ CodeClimate::TestReporter.start
9
+ end
10
+
11
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
12
+ SimpleCov.start
@@ -0,0 +1,27 @@
1
+ require 'vcr'
2
+ VCR.configure do |c|
3
+ c.configure_rspec_metadata!
4
+ c.default_cassette_options = {
5
+ match_requests_on: [
6
+ :method,
7
+ VCR.request_matchers.uri_without_param(
8
+ :timestamp, :body_md5, :auth_signature, :auth_timestamp, :auth_key
9
+ )
10
+ ],
11
+ serialize_with: :json,
12
+ preserve_exact_body_bytes: true,
13
+ decode_compressed_response: true,
14
+ record: ENV['RECORD_VCR'] || ENV['CI'] ? :none : :once
15
+ }
16
+ c.ignore_localhost = true
17
+ c.cassette_library_dir = 'spec/cassettes'
18
+ c.hook_into :webmock
19
+ c.ignore_hosts 'codeclimate.com'
20
+ c.filter_sensitive_data('<API_KEY>') do
21
+ ENV['ACTIVE_CAMPAIGN_API_KEY']
22
+ end
23
+
24
+ c.filter_sensitive_data('<API_ENDPOINT>') do
25
+ ENV['ACTIVE_CAMPAIGN_API_ENDPOINT']
26
+ end
27
+ end
@@ -0,0 +1,2 @@
1
+ require 'webmock/rspec'
2
+ WebMock.disable_net_connect!(allow: ['coveralls.io', 'codeclimate.com'])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpi
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: multi_json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: A simple ruby wrapper for the ActiveCampaign API
42
70
  email:
43
71
  - mikael@zoolutions.se
@@ -45,9 +73,11 @@ executables: []
45
73
  extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
76
+ - ".codeclimate.yml"
48
77
  - ".coveralls.yml"
49
78
  - ".gitignore"
50
79
  - ".rspec"
80
+ - ".rubocop.yml"
51
81
  - ".ruby-version"
52
82
  - ".travis.yml"
53
83
  - Gemfile
@@ -55,15 +85,14 @@ files:
55
85
  - README.md
56
86
  - Rakefile
57
87
  - active_campaign.gemspec
88
+ - circle.yml
58
89
  - lib/active_campaign.rb
59
- - lib/active_campaign/.DS_Store
60
90
  - lib/active_campaign/client.rb
61
91
  - lib/active_campaign/client/campaigns.rb
62
92
  - lib/active_campaign/client/contacts.rb
63
93
  - lib/active_campaign/client/lists.rb
64
94
  - lib/active_campaign/client/messages.rb
65
- - lib/active_campaign/configurable.rb
66
- - lib/active_campaign/default.rb
95
+ - lib/active_campaign/configuration.rb
67
96
  - lib/active_campaign/error.rb
68
97
  - lib/active_campaign/version.rb
69
98
  - spec/active_campaign_spec.rb
@@ -78,6 +107,9 @@ files:
78
107
  - spec/fixtures/contact_view.json
79
108
  - spec/fixtures/list_view.json
80
109
  - spec/spec_helper.rb
110
+ - spec/support/coverage.rb
111
+ - spec/support/vcr.rb
112
+ - spec/support/webmock.rb
81
113
  homepage: ''
82
114
  licenses:
83
115
  - MIT
@@ -98,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
130
  version: '0'
99
131
  requirements: []
100
132
  rubyforge_project:
101
- rubygems_version: 2.2.0.rc.1
133
+ rubygems_version: 2.4.6
102
134
  signing_key:
103
135
  specification_version: 4
104
136
  summary: See http://www.activecampaign.com/api/overview.php for more information
@@ -115,4 +147,7 @@ test_files:
115
147
  - spec/fixtures/contact_view.json
116
148
  - spec/fixtures/list_view.json
117
149
  - spec/spec_helper.rb
150
+ - spec/support/coverage.rb
151
+ - spec/support/vcr.rb
152
+ - spec/support/webmock.rb
118
153
  has_rdoc:
@@ -1,66 +0,0 @@
1
- module ActiveCampaign
2
-
3
- # Configuration options for {Client}, defaulting to values
4
- # in {Default}
5
- module Configurable
6
-
7
- CONFIG_KEYS = [
8
- :api_key,
9
- :api_path,
10
- :api_output,
11
- :api_endpoint,
12
- :user_agent,
13
- :log,
14
- :log_level,
15
- :logger,
16
- :mash,
17
- ]
18
-
19
- attr_accessor(*CONFIG_KEYS)
20
-
21
- class << self
22
-
23
- # List of configurable keys for {ActiveCampaign::Client}
24
- # @return [Array] of option keys
25
- def keys
26
- @keys ||= CONFIG_KEYS
27
- end
28
- end
29
-
30
- # Set configuration options using a block
31
- def configure
32
- yield self
33
- end
34
-
35
- # Reset configuration options to default values
36
- def reset!
37
- ActiveCampaign::Configurable.keys.each do |key|
38
- instance_variable_set(:"@#{key}", ActiveCampaign::Default.options[key])
39
- end
40
-
41
- HTTPI.logger = self.logger if self.logger
42
- HTTPI.log = self.log
43
- HTTPI.log_level = self.log_level
44
-
45
- self
46
- end
47
- alias setup reset!
48
-
49
- def api_endpoint
50
- File.join(@api_endpoint, "")
51
- end
52
-
53
- # Base URL for generated web URLs
54
- #
55
- # @return [String] Default: https://www.activecampaign.com/
56
- def web_endpoint
57
- File.join(@web_endpoint, "")
58
- end
59
-
60
- private
61
-
62
- def options
63
- Hash[ActiveCampaign::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
64
- end
65
- end
66
- end
@@ -1,81 +0,0 @@
1
- require 'active_campaign/version'
2
-
3
- module ActiveCampaign
4
-
5
- # Default configuration options for {Client}
6
- module Default
7
-
8
- # Default API endpoint
9
- API_ENDPOINT = "https://subdomain.activehosted.com".freeze
10
-
11
- API_PATH = "admin/api.php".freeze
12
-
13
- # Default User Agent header string
14
- USER_AGENT = "ActiveCampaign Ruby Gem #{ActiveCampaign::VERSION}".freeze
15
-
16
- # Default media type
17
- API_OUTPUT = "json"
18
-
19
- # Default WEB endpoint
20
- WEB_ENDPOINT = "http://www.activecampaign.com/".freeze
21
-
22
- class << self
23
-
24
- # Configuration options
25
- # @return [Hash]
26
- def options
27
- Hash[ActiveCampaign::Configurable.keys.map{|key| [key, send(key)]}]
28
- end
29
-
30
- # Default API endpoint from ENV or {API_ENDPOINT}
31
- # @return [String]
32
- def api_endpoint
33
- ENV['ACTIVE_CAMPAIGN_API_ENDPOINT'] || "#{API_ENDPOINT}/#{api_path}"
34
- end
35
-
36
- # Default API endpoint from ENV or {API_ENDPOINT}
37
- # @return [String]
38
- def api_path
39
- API_PATH
40
- end
41
-
42
- # Default GitHub username for Basic Auth from ENV
43
- # @return [String]
44
- def api_key
45
- ENV['ACTIVE_CAMPAIGN_API_KEY']
46
- end
47
-
48
- def log
49
- false
50
- end
51
-
52
- def logger
53
- nil
54
- end
55
-
56
- def log_level
57
- :warn
58
- end
59
-
60
- def debug
61
- false
62
- end
63
-
64
- def mash
65
- false
66
- end
67
-
68
- # Default media api_output from ENV or {API_OUTPUT}
69
- # @return [String]
70
- def api_output
71
- ENV['ACTIVE_CAMPAIGN_API_OUTPUT'] || API_OUTPUT
72
- end
73
-
74
- # Default User-Agent header string from ENV or {USER_AGENT}
75
- # @return [String]
76
- def user_agent
77
- ENV['ACTIVE_CAMPAIGN_USER_AGENT'] || USER_AGENT
78
- end
79
- end
80
- end
81
- end