hubspot 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/hubspot.rb +53 -4
- data/lib/hubspot/api/transaction_email/single_send.rb +37 -0
- data/lib/hubspot/delivery_method.rb +18 -0
- data/lib/hubspot/errors.rb +21 -0
- data/lib/hubspot/http_request.rb +44 -0
- data/lib/hubspot/http_response.rb +31 -0
- data/lib/hubspot/mailer.rb +18 -0
- data/lib/hubspot/object.rb +33 -0
- data/lib/hubspot/railtie.rb +13 -0
- data/lib/hubspot/transaction_email/delivery_method.rb +17 -0
- data/lib/hubspot/transaction_email/mailer.rb +12 -0
- data/lib/hubspot/version.rb +1 -1
- metadata +245 -158
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -158
- data/Rakefile +0 -38
- data/app/helpers/hubspot_helper.rb +0 -17
- data/app/models/hubspot/base.rb +0 -40
- data/app/models/hubspot/blog.rb +0 -35
- data/app/models/hubspot/blogs/blog_association.rb +0 -35
- data/app/models/hubspot/blogs/comment.rb +0 -5
- data/app/models/hubspot/blogs/post.rb +0 -12
- data/app/models/hubspot/blogs/posts/comment.rb +0 -23
- data/app/models/hubspot/connection.rb +0 -46
- data/app/models/hubspot/event.rb +0 -39
- data/app/models/hubspot/keyword.rb +0 -49
- data/app/models/hubspot/lead.rb +0 -26
- data/app/models/hubspot/performable/event.rb +0 -67
- data/lib/hubspot/action_controller_extensions.rb +0 -15
- data/lib/hubspot/engine.rb +0 -30
- data/lib/tasks/hubspot_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -56
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -2326
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/fixtures/vcr_cassettes/blog-comments.yml +0 -74
- data/test/fixtures/vcr_cassettes/blog-find.yml +0 -36
- data/test/fixtures/vcr_cassettes/blog-posts.yml +0 -75
- data/test/fixtures/vcr_cassettes/blogs-list.yml +0 -39
- data/test/fixtures/vcr_cassettes/event-create.yml +0 -36
- data/test/fixtures/vcr_cassettes/event-record.yml +0 -47
- data/test/fixtures/vcr_cassettes/events-list.yml +0 -41
- data/test/fixtures/vcr_cassettes/keyword-create.yml +0 -36
- data/test/fixtures/vcr_cassettes/keywords-list.yml +0 -385
- data/test/fixtures/vcr_cassettes/lead-find.yml +0 -103
- data/test/fixtures/vcr_cassettes/lead-update.yml +0 -239
- data/test/fixtures/vcr_cassettes/leads-list.yml +0 -190
- data/test/fixtures/vcr_cassettes/post-comments.yml +0 -72
- data/test/fixtures/vcr_cassettes/post-find.yml +0 -39
- data/test/hubspot_test.rb +0 -5
- data/test/test_helper.rb +0 -22
- data/test/unit/blog_test.rb +0 -37
- data/test/unit/event_test.rb +0 -21
- data/test/unit/keyword_test.rb +0 -22
- data/test/unit/lead_test.rb +0 -31
- data/test/unit/performable_event_test.rb +0 -22
- data/test/unit/post_test.rb +0 -20
@@ -1,39 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://api.hubapi.com/blog/v1/posts/6ca6fdc5-a81f-44db-a63b-f56ab2636c69.json?hapikey=demo&portalId=62515
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/json
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
-
User-Agent:
|
15
|
-
- Ruby
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: OK
|
20
|
-
headers:
|
21
|
-
Date:
|
22
|
-
- Wed, 04 Apr 2012 23:39:14 GMT
|
23
|
-
Content-Type:
|
24
|
-
- application/json;charset=UTF-8
|
25
|
-
Transfer-Encoding:
|
26
|
-
- chunked
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
Server:
|
30
|
-
- Apache-Coyote/1.1
|
31
|
-
body:
|
32
|
-
encoding: US-ASCII
|
33
|
-
string: ! '{"authorDisplayName":"testapi@hubspot.com","authorEmail":"testapi@hubspot.com","blogGuid":"0d61e4ca-e395-4c1c-8766-afaa48bf68db","body":"<b>This
|
34
|
-
is the content of the blog post<\/b>","createTimestamp":1333483438000,"draft":true,"guid":"6ca6fdc5-a81f-44db-a63b-f56ab2636c69","jsonUrl":"https://api.hubapi.com/blog/v1/posts/6ca6fdc5-a81f-44db-a63b-f56ab2636c69.json","lastUpdateTimestamp":1333483438000,"metaDescription":"test
|
35
|
-
metaDescription!","metaKeywords":"these are totally test keywords.","portalId":62515,"postAnalytics":null,"publishTimestamp":1333483438000,"sendNotifications":true,"summary":"This
|
36
|
-
is a test summary","tags":["tag2","tag1"],"title":"I am a test post","url":"http://demo.hubapi.com/blog-for-testing/bid/103902/"}'
|
37
|
-
http_version:
|
38
|
-
recorded_at: Wed, 04 Apr 2012 23:39:14 GMT
|
39
|
-
recorded_with: VCR 2.0.1
|
data/test/hubspot_test.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
require "rails/test_help"
|
6
|
-
require 'vcr'
|
7
|
-
|
8
|
-
Rails.backtrace_cleaner.remove_silencers!
|
9
|
-
|
10
|
-
# Load support files
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
-
|
13
|
-
# Load fixtures from the engine
|
14
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
15
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
16
|
-
end
|
17
|
-
|
18
|
-
VCR.configure do |c|
|
19
|
-
c.cassette_library_dir = File.expand_path("../fixtures/vcr_cassettes", __FILE__)
|
20
|
-
c.allow_http_connections_when_no_cassette = true
|
21
|
-
c.hook_into :webmock
|
22
|
-
end
|
data/test/unit/blog_test.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class BlogTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_should_return_blogs
|
6
|
-
VCR.use_cassette('blogs-list') do
|
7
|
-
blogs = Hubspot::Blog.find(:all, :params => { :max => 5 })
|
8
|
-
assert_equal 5, blogs.size
|
9
|
-
|
10
|
-
blog = blogs.first
|
11
|
-
assert_equal ["0d61e4ca-e395-4c1c-8766-afaa48bf68db", "Test Blog (content from customers.hubspot.com)", "demo.hubapi.com/CMS/UI/Modules/BizBlogger/rss.aspx?moduleId=584130&tabId=300291", "https://api.hubapi.com/blog/v1/0d61e4ca-e395-4c1c-8766-afaa48bf68db.json", "demo.hubapi.com/blog-for-testing"], Hubspot::Blog.known_attributes.map{|attribute| blog.send(attribute)}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_should_find_blog_by_guid
|
16
|
-
VCR.use_cassette('blog-find') do
|
17
|
-
blog = Hubspot::Blog.find("0d61e4ca-e395-4c1c-8766-afaa48bf68db")
|
18
|
-
assert_not_nil blog
|
19
|
-
assert_equal ["0d61e4ca-e395-4c1c-8766-afaa48bf68db", "Test Blog (content from customers.hubspot.com)", "demo.hubapi.com/CMS/UI/Modules/BizBlogger/rss.aspx?moduleId=584130&tabId=300291", "https://api.hubapi.com/blog/v1/0d61e4ca-e395-4c1c-8766-afaa48bf68db.json", "demo.hubapi.com/blog-for-testing"], Hubspot::Blog.known_attributes.map{|attribute| blog.send(attribute)}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_should_return_blog_posts
|
24
|
-
VCR.use_cassette('blog-posts') do
|
25
|
-
blog = Hubspot::Blog.find("0d61e4ca-e395-4c1c-8766-afaa48bf68db")
|
26
|
-
assert blog.posts(:max => 2).any?
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_should_return_blog_comments
|
31
|
-
VCR.use_cassette('blog-comments') do
|
32
|
-
blog = Hubspot::Blog.find("0d61e4ca-e395-4c1c-8766-afaa48bf68db")
|
33
|
-
assert blog.comments(:max => 2).any?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/test/unit/event_test.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class EventTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_should_return_events
|
6
|
-
VCR.use_cassette('events-list') do
|
7
|
-
events = Hubspot::Event.find(:all, :params => { :max => 5 })
|
8
|
-
assert_equal 5, events.size
|
9
|
-
|
10
|
-
event = events.first
|
11
|
-
assert_equal ["Atom Updated Atom-Powered Robots Run Amok", "iReach Distribution", "", 1333085425000], Hubspot::Event.known_attributes.map{|attribute| event.send(attribute)}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_should_create_events
|
16
|
-
VCR.use_cassette('event-create') do
|
17
|
-
assert_equal 201, Hubspot::Event.create(:eventType => 'new event', :description => 'test', :url => 'http://dev.hubspot.com', :createDate => '1323272544000')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/test/unit/keyword_test.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class KeywordTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_should_return_keywords
|
6
|
-
VCR.use_cassette('keywords-list') do
|
7
|
-
keywords = Hubspot::Keyword.find(:all, :params => { :max => 5 })
|
8
|
-
assert keywords.any?
|
9
|
-
|
10
|
-
keyword = keywords.first
|
11
|
-
assert_equal ["hapipy_test_keyword838"], Hubspot::Keyword.known_attributes.map{|attribute| keyword.send(attribute)}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_should_create_keywords
|
16
|
-
VCR.use_cassette('keyword-create') do
|
17
|
-
assert keyword = Hubspot::Keyword.create({ :keyword => { :keyword => 'sleutel' }})
|
18
|
-
assert_equal "1a33db71-3371-45c3-9e43-42ee24288d15", keyword.id
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
data/test/unit/lead_test.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class LeadTest < ActiveSupport::TestCase
|
4
|
-
def test_should_return_leads
|
5
|
-
VCR.use_cassette('leads-list') do
|
6
|
-
leads = Hubspot::Lead.find(:all, :params => { :max => 10 })
|
7
|
-
assert_equal 10, leads.size
|
8
|
-
|
9
|
-
lead = leads.first
|
10
|
-
assert_equal ["8a41f2f22906b93a012906b9438f0008", "", "rein", "Kanaki", "adrian@hubspot.com", "http://hubspot.com", "Proquest", "", "Maharashtra", "<a href=\"http://boston.com\">Boston</a>", "12", "etas unis", "321-123-3211", "1231231234", "123", "", "Devloper", "adrianmott", "123.321.123.321", 90.6981], Hubspot::Lead.known_attributes.map{|attribute| lead.send(attribute)}
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_should_find_lead_by_guid
|
15
|
-
VCR.use_cassette('lead-find') do
|
16
|
-
lead = Hubspot::Lead.find("8a41f2f22906b93a012906b9438f0008")
|
17
|
-
assert_not_nil lead
|
18
|
-
assert_equal ["8a41f2f22906b93a012906b9438f0008", "", "rein", "Kanaki", "adrian@hubspot.com", "http://hubspot.com", "Proquest", "", "Maharashtra", "<a href=\"http://boston.com\">Boston</a>", "12", "etas unis", "321-123-3211", "1231231234", "123", "", "Devloper", "adrianmott", "123.321.123.321", 90.6981], Hubspot::Lead.known_attributes.map{|attribute| lead.send(attribute)}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_should_update_lead
|
23
|
-
VCR.use_cassette('lead-update') do
|
24
|
-
lead = Hubspot::Lead.find("8a41f2f22906b93a012906b9438f0008")
|
25
|
-
assert lead.update_attributes(:firstName => 'John')
|
26
|
-
|
27
|
-
lead.reload
|
28
|
-
assert_equal ["8a41f2f22906b93a012906b9438f0008", "", "John", "Kanaki", "adrian@hubspot.com", "http://hubspot.com", "Proquest", "", "Maharashtra", "<a href=\"http://boston.com\">Boston</a>", "12", "etas unis", "321-123-3211", "1231231234", "123", "", "Devloper", "adrianmott", "123.321.123.321", 90.6981], Hubspot::Lead.known_attributes.map{|attribute| lead.send(attribute)}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class PerformableEventTest < ActiveSupport::TestCase
|
4
|
-
setup do
|
5
|
-
@event = Hubspot::Performable::Event.new('event-12345', Date.civil(2012), nil, 'http://example.com')
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_should_create_query_string
|
9
|
-
assert_equal "_a=demo&_l=http%3A%2F%2Fexample.com&_n=event-12345&_t=2012-01-01", @event.to_param
|
10
|
-
|
11
|
-
@event.custom_parameters = { :email => 'test@example.com' }
|
12
|
-
assert_equal "_a=demo&_l=http%3A%2F%2Fexample.com&_n=event-12345&_t=2012-01-01&email=test%40example.com", @event.to_param
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_should_record_events
|
16
|
-
VCR.use_cassette('event-record') do
|
17
|
-
@event.custom_parameters = { :email => 'test@example.com' }
|
18
|
-
assert_equal 200, @event.record
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
data/test/unit/post_test.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper.rb', __FILE__)
|
2
|
-
|
3
|
-
class PostTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_should_find_post_by_guid
|
6
|
-
VCR.use_cassette('post-find') do
|
7
|
-
post = Hubspot::Blogs::Post.find "6ca6fdc5-a81f-44db-a63b-f56ab2636c69", :params => { :blog_guid => "0d61e4ca-e395-4c1c-8766-afaa48bf68db" }
|
8
|
-
assert_not_nil post
|
9
|
-
assert_equal 'This is a test summary', post.summary
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_should_return_post_comments
|
14
|
-
VCR.use_cassette('post-comments') do
|
15
|
-
post = Hubspot::Blogs::Post.find "6ca6fdc5-a81f-44db-a63b-f56ab2636c69", :params => { :blog_guid => "0d61e4ca-e395-4c1c-8766-afaa48bf68db" }
|
16
|
-
assert post.comments(:max => 2).empty?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|