marketo_api 0.0.7.pre.alpha
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 +7 -0
- data/.codeclimate.yml +2 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +57 -0
- data/.travis.yml +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Guardfile +13 -0
- data/LICENSE +22 -0
- data/README.md +75 -0
- data/Rakefile +6 -0
- data/bin/_guard-core +17 -0
- data/bin/console +12 -0
- data/bin/guard +17 -0
- data/bin/rake +17 -0
- data/bin/rspec +17 -0
- data/bin/setup +6 -0
- data/exe/.keep +0 -0
- data/lib/marketo_api.rb +45 -0
- data/lib/marketo_api/abstract_client.rb +15 -0
- data/lib/marketo_api/api/activities.rb +64 -0
- data/lib/marketo_api/api/base.rb +63 -0
- data/lib/marketo_api/api/campaigns.rb +70 -0
- data/lib/marketo_api/api/leads.rb +86 -0
- data/lib/marketo_api/api/sales.rb +19 -0
- data/lib/marketo_api/api/stats.rb +54 -0
- data/lib/marketo_api/client.rb +8 -0
- data/lib/marketo_api/concerns/authentication.rb +20 -0
- data/lib/marketo_api/concerns/base.rb +49 -0
- data/lib/marketo_api/concerns/caching.rb +24 -0
- data/lib/marketo_api/concerns/connection.rb +75 -0
- data/lib/marketo_api/concerns/verbs.rb +60 -0
- data/lib/marketo_api/config.rb +131 -0
- data/lib/marketo_api/middleware.rb +27 -0
- data/lib/marketo_api/middleware/authentication.rb +64 -0
- data/lib/marketo_api/middleware/authentication/token.rb +12 -0
- data/lib/marketo_api/middleware/authorization.rb +16 -0
- data/lib/marketo_api/middleware/caching.rb +26 -0
- data/lib/marketo_api/middleware/logger.rb +40 -0
- data/lib/marketo_api/middleware/raise_error.rb +47 -0
- data/lib/marketo_api/version.rb +3 -0
- data/marketo_api.gemspec +37 -0
- metadata +269 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e4a69bf5f1286d61ac226604d905bf1b3dee26b
|
4
|
+
data.tar.gz: 97b0aef343a1d57180b22583b7e6befaf8d85035
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62bc0d5a6185484f7e26de757177ba17776a418df1c3056714532d10198002a4a2580ea308be7ce4fedaf99366ee7bf97ba30e597bbc28087dc06f7e6ba9ae07
|
7
|
+
data.tar.gz: 1fdfb44bca20e8189c0c6023774d7f2a72a0f993765a8127940a0607305eeb85be5cdbc384e87612259c5eef41bb7774a2faa06548922ece95e1a48f0a6af60c
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
.DS_Store
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
test.rb
|
5
|
+
.bundle
|
6
|
+
.config
|
7
|
+
.yardoc
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
.rspec
|
20
|
+
.ruby-version
|
21
|
+
*.swp
|
22
|
+
junk.rb
|
23
|
+
Gemfile.lock
|
24
|
+
tags
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# For all options see https://github.com/bbatsov/rubocop/tree/master/config
|
2
|
+
|
3
|
+
inherit_from: .rubocop_todo.yml
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
Rails:
|
7
|
+
Enabled: false
|
8
|
+
Include:
|
9
|
+
- Rakefile
|
10
|
+
Exclude:
|
11
|
+
- .*/**/*
|
12
|
+
|
13
|
+
# Limit lines to 80 characters.
|
14
|
+
LineLength:
|
15
|
+
Max: 90
|
16
|
+
|
17
|
+
ClassLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
ModuleLength:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Avoid methods longer than 30 lines of code
|
24
|
+
MethodLength:
|
25
|
+
CountComments: false # count full line comments?
|
26
|
+
Max: 87
|
27
|
+
|
28
|
+
# Avoid single-line methods.
|
29
|
+
SingleLineMethods:
|
30
|
+
AllowIfMethodIsEmpty: true
|
31
|
+
|
32
|
+
StringLiterals:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
GlobalVars:
|
36
|
+
Enabled: false # We use them Redis + StatsD (though maybe we shouldn't?)
|
37
|
+
|
38
|
+
# Wants underscores in all large numbers. Pain in the ass for things like
|
39
|
+
# unix timestamps.
|
40
|
+
NumericLiterals:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# Wants you to use the same argument names for every reduce. This seems kinda
|
44
|
+
# naff compared to naming them semantically
|
45
|
+
SingleLineBlockParams:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/SignalException:
|
49
|
+
EnforcedStyle: 'only_raise'
|
50
|
+
|
51
|
+
# Use trailing rather than leading dots on multi-line call chains
|
52
|
+
Style/DotPosition:
|
53
|
+
EnforcedStyle: trailing
|
54
|
+
|
55
|
+
# Allow non-ASCII characters (e.g. £) in comments
|
56
|
+
Style/AsciiComments:
|
57
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at oss@marketo.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
guard 'rspec', cmd: 'bundle exec rspec', all_on_start: false, all_after_pass: false do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch('spec/spec_helper.rb') { "spec" }
|
4
|
+
|
5
|
+
watch(%r{^lib/marketo_api/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
6
|
+
watch(%r{^lib/marketo_api/(.+)\.rb$}) { |m| "spec/integration/#{m[1]}_spec.rb" }
|
7
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
8
|
+
end
|
9
|
+
|
10
|
+
# guard :rubocop, all_on_start: false do
|
11
|
+
# watch(%r{.+\.rb$})
|
12
|
+
# watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
13
|
+
# end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Marketo, Inc. <oss@marketo.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Marketo API
|
2
|
+
[](https://travis-ci.org/toutapp/marketo_api)
|
3
|
+
[](https://codeclimate.com/github/toutapp/marketo_api)
|
4
|
+
|
5
|
+
> IMPORTANT: This is an **alpha** stage gem and is **not** ready for production use
|
6
|
+
|
7
|
+
`MarketoApi` is a ruby wrapper for the Marketo RESTful API endpoints inspired by [Restforce gem](https://github.com/restforce/restforce).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'marketo_api'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install marketo_api
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
client = MarketoApi::Client.new(...)
|
33
|
+
```
|
34
|
+
|
35
|
+
- TODO - MarketoApi Docs
|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
40
|
+
|
41
|
+
To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `marketo_api/version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
42
|
+
|
43
|
+
## Testing
|
44
|
+
|
45
|
+
- To run the test suite, run `bin/rake`
|
46
|
+
- Check Coverage by running `open coverage/index.html` from the gem root
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/toutapp/marketo_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
(The MIT License)
|
55
|
+
|
56
|
+
Copyright (c) 2017 Marketo, Inc. <oss@marketo.com>
|
57
|
+
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
+
a copy of this software and associated documentation files (the
|
60
|
+
'Software'), to deal in the Software without restriction, including
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
64
|
+
the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be
|
67
|
+
included in all copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
72
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
73
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
74
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
75
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/_guard-core
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application '_guard-core' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("guard", "_guard-core")
|
data/bin/console
ADDED
data/bin/guard
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'guard' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("guard", "guard")
|
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rspec' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/exe/.keep
ADDED
File without changes
|
data/lib/marketo_api.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require 'marketo_api/version'
|
6
|
+
require 'marketo_api/config'
|
7
|
+
|
8
|
+
module MarketoApi
|
9
|
+
autoload :AbstractClient, 'marketo_api/abstract_client'
|
10
|
+
autoload :Middleware, 'marketo_api/middleware'
|
11
|
+
autoload :Client, 'marketo_api/client'
|
12
|
+
|
13
|
+
module Concerns
|
14
|
+
autoload :Authentication, 'marketo_api/concerns/authentication'
|
15
|
+
autoload :Connection, 'marketo_api/concerns/connection'
|
16
|
+
autoload :Caching, 'marketo_api/concerns/caching'
|
17
|
+
autoload :Verbs, 'marketo_api/concerns/verbs'
|
18
|
+
autoload :Base, 'marketo_api/concerns/base'
|
19
|
+
end
|
20
|
+
|
21
|
+
module API
|
22
|
+
autoload :Base, 'marketo_api/api/base'
|
23
|
+
autoload :Leads, 'marketo_api/api/leads'
|
24
|
+
autoload :Sales, 'marketo_api/api/sales'
|
25
|
+
autoload :Stats, 'marketo_api/api/stats'
|
26
|
+
autoload :Activities, 'marketo_api/api/activities'
|
27
|
+
autoload :Campaigns, 'marketo_api/api/campaigns'
|
28
|
+
end
|
29
|
+
|
30
|
+
Error = Class.new(StandardError)
|
31
|
+
ServerError = Class.new(Error)
|
32
|
+
AuthenticationError = Class.new(Error)
|
33
|
+
UnauthorizedError = Class.new(Error)
|
34
|
+
APIVersionError = Class.new(Error)
|
35
|
+
|
36
|
+
# Add .tap method in Ruby 1.8
|
37
|
+
module CoreExtensions
|
38
|
+
def tap
|
39
|
+
yield self
|
40
|
+
self
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
Object.send :include, MarketoApi::CoreExtensions unless Object.respond_to? :tap
|
45
|
+
end
|