unbounce 0.1.1 → 0.1.2

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
- SHA1:
3
- metadata.gz: 365f5ba76e565bdffb3d80470dbf718f5ac4947c
4
- data.tar.gz: 88435ca63a70dddc565133cd26c2a977834db775
2
+ SHA256:
3
+ metadata.gz: 8c47feff54e30c7e3f465550a1e1c3c1a575827005719b64b1754304c7b1e83c
4
+ data.tar.gz: 84c0b8059712bd65b58356fb38f2db373941512992e05ad3ab1fb59bfb61ec77
5
5
  SHA512:
6
- metadata.gz: 87c7d42c808659ea1479e133aaaab8425e8dfeb2cb2f8b4f8059b8180980adb003a093247f6c4fc69a5eda93ce5ae66e27db2b002fbe4a6fd12c08ed4174a957
7
- data.tar.gz: d7b7742e3c2ca41100009ff52271602ab24f04e6459865c5015ef27aa4bdd2394ae0ed301afb4520c2c49bb8efed116f017ef1f973f091c2d1f1f5392598f9bd
6
+ metadata.gz: 621c43316378a6ba68ce8058776dfcb01225afbfb68b8995c9ec408375332158ff13d97dfe7c1f2d2e3d5b3b7ef69bcc4e0116ce51d1d23fcdebfb21cad9ebb5
7
+ data.tar.gz: 3519b44b65b80b0df13b163a1c6c66fc686638bff246b287ea2a3dc21030a1457bdb01408ce178256805d92717cb3e5973f83ac15462c5ff5c9db508473f7ad1
data/.gitignore CHANGED
@@ -1,16 +1,16 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- test.rb
14
- *.gem
15
-
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ test.rb
14
+ *.gem
15
+
16
16
  Gemfile.lock
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.0
5
- before_install: gem install bundler -v 1.16.0
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.16.0
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +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 mhoskison@etnainteractive.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/
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 mhoskison@etnainteractive.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 CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in unbounce.gemspec
6
- gemspec
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in unbounce.gemspec
6
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Michael Hoskison
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Michael Hoskison
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,155 +1,155 @@
1
- # unbounce
2
-
3
- Simple GEM to access the Unbounce API. (https://unbounce.com/)
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'unbounce'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install unbounce
20
-
21
- ## Usage
22
-
23
- ### Setting Connection
24
-
25
- ###### Required value
26
- * key: Your Unbounce API key.
27
- ###### Optional
28
- * api_url:
29
- Defaults to https://api.unbounce.com
30
- * api_version:
31
- Defaults to 0.4
32
-
33
- ```ruby
34
- opts = {key: "<Your unbounce API Key>"}
35
- testcon = Unbounce::Api.new(:key => opts[:key])
36
- ```
37
-
38
- ### Query Parameters
39
-
40
- ###### sort_order
41
- * asc - Default
42
- * desc
43
- ###### count
44
- When true, don't return the response's collection attribute.
45
- ###### from
46
- Limit results to those created after from. Example: 2014-12-31T00:00:00.000Z
47
- ###### to
48
- Limit results to those created before to. Example: 2014-12-31T23:59:59.999Z
49
- ###### offset
50
- Omit the first offset number of results. Example: 3
51
- ###### limit
52
- Only return limit number of results. Example: 100, Default set to Maximum of 1000
53
- ###### with_stats
54
- When true, include page stats for the collection.
55
- ###### role
56
- Restricts the scope of the returned pages. one of viewer, author
57
- ###### include_sub_pages
58
- When true, include sub page form fields in the response
59
-
60
- ### Get Accounts
61
- Retrieve the accounts collection.
62
-
63
- Supported Params:
64
- * sort_order
65
-
66
- ```ruby
67
- testcon.get_accounts
68
- ```
69
-
70
- ### Get Pages
71
- ###### All Pages
72
- Retrieve a list of all pages.
73
-
74
- Supported Params:
75
- * sort_order
76
- * count
77
- * from
78
- * to
79
- * offset
80
- * limit
81
- * with_stats
82
- * role
83
-
84
- ```ruby
85
- testcon.get_pages()
86
- ```
87
- ###### All Pages for specific account
88
- ```ruby
89
- opts = {account_id: <account_id>}
90
- testcon.get_pages(opts)
91
- ```
92
- ###### Specific page
93
- ```ruby
94
- opts = {page_id: <page_id>}
95
- testcon.get_pages(opts)
96
- ```
97
- ###### Page Form Fields
98
- Retrieve a full list of all form fields across all page variants of a specific page.
99
-
100
- Supported Params:
101
- * sort_order
102
- * count
103
- * include_sub_pages
104
-
105
- ```ruby
106
- opts = {page_id: <page_id>, form_fields: true}
107
- testcon.get_pages(opts)
108
- ```
109
-
110
- ### Get Leads
111
- ###### All for page
112
- Retrieve a list of all leads for a given page.
113
-
114
- Supported Params:
115
- * sort_order
116
- * count
117
- * from
118
- * to
119
- * offset
120
- * limit
121
-
122
- ```ruby
123
- opts = {page_id: <page_id>}
124
- testcon.get_leads(opts)
125
- ```
126
- ###### Single Lead
127
- Retrieve a single lead.
128
-
129
- ```ruby
130
- opts = {lead_id: <lead_id>}
131
- testcon.get_leads(opts)
132
- ```
133
-
134
-
135
- ## Version History
136
- # v0.1.0
137
- Initial work for retrieving accounts, pages, and leads.
138
-
139
- ## Development
140
-
141
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
142
-
143
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec 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).
144
-
145
- ## Contributing
146
-
147
- Bug reports and pull requests are welcome on GitHub at https://github.com/mhoskiso/unbounce. 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.
148
-
149
- ## License
150
-
151
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
152
-
153
- ## Code of Conduct
154
-
155
- Everyone interacting in the Unbounce project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mhoskiso/unbounce/blob/master/CODE_OF_CONDUCT.md).
1
+ # unbounce
2
+
3
+ Simple GEM to access the Unbounce API. (https://unbounce.com/)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'unbounce'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install unbounce
20
+
21
+ ## Usage
22
+
23
+ ### Setting Connection
24
+
25
+ ###### Required value
26
+ * key: Your Unbounce API key.
27
+ ###### Optional
28
+ * api_url:
29
+ Defaults to https://api.unbounce.com
30
+ * api_version:
31
+ Defaults to 0.4
32
+
33
+ ```ruby
34
+ opts = {key: "<Your unbounce API Key>"}
35
+ testcon = Unbounce::Api.new(:key => opts[:key])
36
+ ```
37
+
38
+ ### Query Parameters
39
+
40
+ ###### sort_order
41
+ * asc - Default
42
+ * desc
43
+ ###### count
44
+ When true, don't return the response's collection attribute.
45
+ ###### from
46
+ Limit results to those created after from. Example: 2014-12-31T00:00:00.000Z
47
+ ###### to
48
+ Limit results to those created before to. Example: 2014-12-31T23:59:59.999Z
49
+ ###### offset
50
+ Omit the first offset number of results. Example: 3
51
+ ###### limit
52
+ Only return limit number of results. Example: 100, Default set to Maximum of 1000
53
+ ###### with_stats
54
+ When true, include page stats for the collection.
55
+ ###### role
56
+ Restricts the scope of the returned pages. one of viewer, author
57
+ ###### include_sub_pages
58
+ When true, include sub page form fields in the response
59
+
60
+ ### Get Accounts
61
+ Retrieve the accounts collection.
62
+
63
+ Supported Params:
64
+ * sort_order
65
+
66
+ ```ruby
67
+ testcon.get_accounts
68
+ ```
69
+
70
+ ### Get Pages
71
+ ###### All Pages
72
+ Retrieve a list of all pages.
73
+
74
+ Supported Params:
75
+ * sort_order
76
+ * count
77
+ * from
78
+ * to
79
+ * offset
80
+ * limit
81
+ * with_stats
82
+ * role
83
+
84
+ ```ruby
85
+ testcon.get_pages()
86
+ ```
87
+ ###### All Pages for specific account
88
+ ```ruby
89
+ opts = {account_id: <account_id>}
90
+ testcon.get_pages(opts)
91
+ ```
92
+ ###### Specific page
93
+ ```ruby
94
+ opts = {page_id: <page_id>}
95
+ testcon.get_pages(opts)
96
+ ```
97
+ ###### Page Form Fields
98
+ Retrieve a full list of all form fields across all page variants of a specific page.
99
+
100
+ Supported Params:
101
+ * sort_order
102
+ * count
103
+ * include_sub_pages
104
+
105
+ ```ruby
106
+ opts = {page_id: <page_id>, form_fields: true}
107
+ testcon.get_pages(opts)
108
+ ```
109
+
110
+ ### Get Leads
111
+ ###### All for page
112
+ Retrieve a list of all leads for a given page.
113
+
114
+ Supported Params:
115
+ * sort_order
116
+ * count
117
+ * from
118
+ * to
119
+ * offset
120
+ * limit
121
+
122
+ ```ruby
123
+ opts = {page_id: <page_id>}
124
+ testcon.get_leads(opts)
125
+ ```
126
+ ###### Single Lead
127
+ Retrieve a single lead.
128
+
129
+ ```ruby
130
+ opts = {lead_id: <lead_id>}
131
+ testcon.get_leads(opts)
132
+ ```
133
+
134
+
135
+ ## Version History
136
+ # v0.1.0
137
+ Initial work for retrieving accounts, pages, and leads.
138
+
139
+ ## Development
140
+
141
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
142
+
143
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec 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).
144
+
145
+ ## Contributing
146
+
147
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mhoskiso/unbounce. 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.
148
+
149
+ ## License
150
+
151
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
152
+
153
+ ## Code of Conduct
154
+
155
+ Everyone interacting in the Unbounce project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mhoskiso/unbounce/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "unbounce"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "unbounce"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,3 +1,3 @@
1
- module Unbounce
2
- VERSION = "0.1.1"
3
- end
1
+ module Unbounce
2
+ VERSION = "0.1.2"
3
+ end
data/lib/unbounce.rb CHANGED
@@ -1,146 +1,146 @@
1
- require 'bundler/setup'
2
- require "unbounce/version"
3
- require 'json'
4
- require 'ostruct'
5
- require 'rest-client'
6
- require "base64"
7
-
8
- module Unbounce
9
- class Api
10
-
11
- MAX_RESULT_LIMIT = '1000'
12
-
13
- def initialize(opts = {})
14
- api_version = opts[:api_version].nil? ? "application/vnd.unbounce.api.v0.4+json" : "application/vnd.unbounce.api.v#{opts[:api_version]}+json"
15
- @headers = {Accept: api_version}
16
- @url = opts[:api_url].nil? ? "https://api.unbounce.com" : opts[:api_url]
17
- @auth = 'Basic ' + Base64.encode64(opts[:key]).chomp
18
- @account_id = opts[:account_id].to_s if opts[:account_id]
19
-
20
- # -H "Accept: application/vnd.unbounce.api.v0.4+json"
21
- end
22
-
23
- def set_account_id(opts = {})
24
- @account_id = opts[:account_id].to_s
25
- end
26
-
27
- def parse_json(response)
28
- body = JSON.parse(response.to_str) if response.code == 200
29
- OpenStruct.new(code: response.code, body: body)
30
- end
31
-
32
- def set_params(opts = {})
33
- params = {}
34
- #Result params
35
- params[:path] = opts[:path] if opts[:path]
36
- params[:sort_order] = opts[:sort_order] if opts[:sort_order] && (opts[:sort_order] == "asc" || opts[:sort_order] == "desc") # asc, desc
37
- params[:count] = true if opts[:count] # When true, don't return the response's collection attribute.
38
- params[:include_sub_pages] = true if opts[:include_sub_pages] # When true, include sub page form fields in the response
39
-
40
- #Page params
41
- params[:from] = opts[:from] if opts[:from] # Limit results to those created after from. Example: 2014-12-31T00:00:00.000Z
42
- params[:to] = opts[:to] if opts[:to] # Limit results to those created before to. Example: 2014-12-31T23:59:59.999Z
43
- params[:offset] = opts[:offset] if opts[:offset] # Omit the first offset number of results. Example: 3
44
- params[:limit] = (opts[:limit] != nil && opts[:limit].to_i < MAX_RESULT_LIMIT.to_i && opts[:limit].to_i > 0 ) ? opts[:limit] : MAX_RESULT_LIMIT # Only return limit number of results. Example: 100
45
- params[:with_stats] = opts[:with_stats] if opts[:with_stats] # When true, include page stats for the collection.
46
- params[:role] = opts[:role] if opts[:role] # Restricts the scope of the returned pages. one of viewer, author
47
-
48
- return params
49
- end
50
-
51
- def get_responses(opts = {})
52
- params = set_params(opts)
53
- response = parse_json(RestClient.get(@url+params[:path], params: params,Authorization: @auth, headers: @headers)).body
54
-
55
- more = response["metadata"]["next"].nil? ? nil : response["metadata"]["next"]["href"]
56
-
57
- while more
58
- more_response = parse_json(RestClient.get(more,Authorization: @auth, headers: @headers)).body
59
-
60
- if more_response["leads"]
61
- response["leads"].push(more_response["leads"])
62
- response["leads"].flatten!
63
- end
64
-
65
- if more_response["domains"]
66
- response["domains"].push(more_response["domains"])
67
- response["domains"].flatten!
68
- end
69
-
70
- if more_response["pages"]
71
- response["pages"].push(more_response["pages"])
72
- response["pages"].flatten!
73
- end
74
-
75
- if more_response["page_groups"]
76
- response["page_groups"].push(more_response["page_groups"])
77
- response["page_groups"].flatten!
78
- end
79
-
80
- if more_response["sub_accounts"]
81
- response["sub_accounts"].push(more_response["sub_accounts"])
82
- response["sub_accounts"].flatten!
83
- end
84
-
85
- if more_response["accounts"]
86
- response["accounts"].push(more_response["accounts"])
87
- response["accounts"].flatten!
88
- end
89
-
90
- if more_response["form_fields"]
91
- response["form_fields"].push(more_response["form_fields"])
92
- response["form_fields"].flatten!
93
- end
94
-
95
- more = more_response["metadata"]["next"].nil? ? nil : more_response["metadata"]["next"]["href"]
96
- end
97
-
98
- return response
99
- end
100
-
101
- # Account
102
- def get_accounts(opts = {})
103
- opts[:path] = "/accounts"
104
-
105
- if opts[:account_id]
106
- opts[:path] = opts[:path] + "/#{opts[:account_id]}/pages"
107
- else
108
- # opts[:data] = "accounts"
109
- end
110
-
111
- return get_responses(opts)
112
- end
113
-
114
- # Pages
115
- def get_pages(opts = {})
116
- opts[:path] = "/pages"
117
-
118
- if opts[:account_id]
119
- opts[:path] = "/accounts/#{opts[:account_id]}/pages"
120
- elsif opts[:page_id]
121
- opts[:path] = opts[:path] + "/#{opts[:page_id]}"
122
- opts[:path] = opts[:path] + "/form_fields" if opts[:form_fields] == true
123
- else
124
- # opts[:data] = "pages"
125
- end
126
-
127
- return get_responses(opts)
128
- end
129
-
130
- # Leads
131
- def get_leads(opts = {})
132
-
133
- if opts[:page_id]
134
- opts[:path] = "/pages/#{opts[:page_id]}/leads"
135
- # opts[:data] = "leads"
136
- elsif opts[:lead_id]
137
- opts[:path] = "/leads/#{opts[:lead_id]}"
138
- end
139
-
140
- return get_responses(opts)
141
- end
142
-
143
-
144
-
145
- end
146
- end
1
+ require 'bundler/setup'
2
+ require "unbounce/version"
3
+ require 'json'
4
+ require 'ostruct'
5
+ require 'rest-client'
6
+ require "base64"
7
+
8
+ module Unbounce
9
+ class Api
10
+
11
+ MAX_RESULT_LIMIT = '1000'
12
+
13
+ def initialize(opts = {})
14
+ api_version = opts[:api_version].nil? ? "application/vnd.unbounce.api.v0.4+json" : "application/vnd.unbounce.api.v#{opts[:api_version]}+json"
15
+ @headers = {Accept: api_version}
16
+ @url = opts[:api_url].nil? ? "https://api.unbounce.com" : opts[:api_url]
17
+ @auth = 'Basic ' + Base64.encode64(opts[:key]).chomp
18
+ @account_id = opts[:account_id].to_s if opts[:account_id]
19
+
20
+ # -H "Accept: application/vnd.unbounce.api.v0.4+json"
21
+ end
22
+
23
+ def set_account_id(opts = {})
24
+ @account_id = opts[:account_id].to_s
25
+ end
26
+
27
+ def parse_json(response)
28
+ body = JSON.parse(response.to_str) if response.code == 200
29
+ OpenStruct.new(code: response.code, body: body)
30
+ end
31
+
32
+ def set_params(opts = {})
33
+ params = {}
34
+ #Result params
35
+ params[:path] = opts[:path] if opts[:path]
36
+ params[:sort_order] = opts[:sort_order] if opts[:sort_order] && (opts[:sort_order] == "asc" || opts[:sort_order] == "desc") # asc, desc
37
+ params[:count] = true if opts[:count] # When true, don't return the response's collection attribute.
38
+ params[:include_sub_pages] = true if opts[:include_sub_pages] # When true, include sub page form fields in the response
39
+
40
+ #Page params
41
+ params[:from] = opts[:from] if opts[:from] # Limit results to those created after from. Example: 2014-12-31T00:00:00.000Z
42
+ params[:to] = opts[:to] if opts[:to] # Limit results to those created before to. Example: 2014-12-31T23:59:59.999Z
43
+ params[:offset] = opts[:offset] if opts[:offset] # Omit the first offset number of results. Example: 3
44
+ params[:limit] = (opts[:limit] != nil && opts[:limit].to_i < MAX_RESULT_LIMIT.to_i && opts[:limit].to_i > 0 ) ? opts[:limit] : MAX_RESULT_LIMIT # Only return limit number of results. Example: 100
45
+ params[:with_stats] = opts[:with_stats] if opts[:with_stats] # When true, include page stats for the collection.
46
+ params[:role] = opts[:role] if opts[:role] # Restricts the scope of the returned pages. one of viewer, author
47
+
48
+ return params
49
+ end
50
+
51
+ def get_responses(opts = {})
52
+ params = set_params(opts)
53
+ response = parse_json(RestClient.get(@url+params[:path], params: params,Authorization: @auth, headers: @headers)).body
54
+
55
+ more = response["metadata"]["next"].nil? ? nil : response["metadata"]["next"]["href"]
56
+
57
+ while more
58
+ more_response = parse_json(RestClient.get(more,Authorization: @auth, headers: @headers)).body
59
+
60
+ if more_response["leads"]
61
+ response["leads"].push(more_response["leads"])
62
+ response["leads"].flatten!
63
+ end
64
+
65
+ if more_response["domains"]
66
+ response["domains"].push(more_response["domains"])
67
+ response["domains"].flatten!
68
+ end
69
+
70
+ if more_response["pages"]
71
+ response["pages"].push(more_response["pages"])
72
+ response["pages"].flatten!
73
+ end
74
+
75
+ if more_response["page_groups"]
76
+ response["page_groups"].push(more_response["page_groups"])
77
+ response["page_groups"].flatten!
78
+ end
79
+
80
+ if more_response["sub_accounts"]
81
+ response["sub_accounts"].push(more_response["sub_accounts"])
82
+ response["sub_accounts"].flatten!
83
+ end
84
+
85
+ if more_response["accounts"]
86
+ response["accounts"].push(more_response["accounts"])
87
+ response["accounts"].flatten!
88
+ end
89
+
90
+ if more_response["form_fields"]
91
+ response["form_fields"].push(more_response["form_fields"])
92
+ response["form_fields"].flatten!
93
+ end
94
+
95
+ more = more_response["metadata"]["next"].nil? ? nil : more_response["metadata"]["next"]["href"]
96
+ end
97
+
98
+ return response
99
+ end
100
+
101
+ # Account
102
+ def get_accounts(opts = {})
103
+ opts[:path] = "/accounts"
104
+
105
+ if opts[:account_id]
106
+ opts[:path] = opts[:path] + "/#{opts[:account_id]}/pages"
107
+ else
108
+ # opts[:data] = "accounts"
109
+ end
110
+
111
+ return get_responses(opts)
112
+ end
113
+
114
+ # Pages
115
+ def get_pages(opts = {})
116
+ opts[:path] = "/pages"
117
+
118
+ if opts[:account_id]
119
+ opts[:path] = "/accounts/#{opts[:account_id]}/pages"
120
+ elsif opts[:page_id]
121
+ opts[:path] = opts[:path] + "/#{opts[:page_id]}"
122
+ opts[:path] = opts[:path] + "/form_fields" if opts[:form_fields] == true
123
+ else
124
+ # opts[:data] = "pages"
125
+ end
126
+
127
+ return get_responses(opts)
128
+ end
129
+
130
+ # Leads
131
+ def get_leads(opts = {})
132
+
133
+ if opts[:page_id]
134
+ opts[:path] = "/pages/#{opts[:page_id]}/leads"
135
+ # opts[:data] = "leads"
136
+ elsif opts[:lead_id]
137
+ opts[:path] = "/leads/#{opts[:lead_id]}"
138
+ end
139
+
140
+ return get_responses(opts)
141
+ end
142
+
143
+
144
+
145
+ end
146
+ end
data/unbounce.gemspec CHANGED
@@ -1,39 +1,39 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "unbounce/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "unbounce"
8
- spec.version = Unbounce::VERSION
9
- spec.authors = ["Michael Hoskison"]
10
- spec.email = ["mhoskison@etnainteractive.com"]
11
-
12
- spec.summary = %q{Used to access the Unbounce api}
13
- spec.description = %q{Unbounce API}
14
- spec.homepage = "https://github.com/mhoskiso/unbounce.git"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "bundler", "~> 1.16"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "rspec", "~> 3.0"
36
-
37
- spec.add_dependency "rest-client", "~> 2.0.2"
38
- spec.add_dependency "json", "~> 2.1.0"
39
- end
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "unbounce/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "unbounce"
8
+ spec.version = Unbounce::VERSION
9
+ spec.authors = ["Michael Hoskison"]
10
+ spec.email = ["mhoskison@etnainteractive.com"]
11
+
12
+ spec.summary = %q{Used to access the Unbounce api}
13
+ spec.description = %q{Unbounce API}
14
+ spec.homepage = "https://github.com/mhoskiso/unbounce.git"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 2.3.3"
34
+ spec.add_development_dependency "rake", "~> 13.0.6"
35
+ spec.add_development_dependency "rspec", "~> 3.12"
36
+
37
+ spec.add_dependency "rest-client", "~> 2.1.0"
38
+ spec.add_dependency "json", "~> 2.6.3"
39
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unbounce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoskison
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,70 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.3.3
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.3.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 13.0.6
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 13.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '3.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '3.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rest-client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.0.2
61
+ version: 2.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.0.2
68
+ version: 2.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.1.0
75
+ version: 2.6.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.1.0
82
+ version: 2.6.3
83
83
  description: Unbounce API
84
84
  email:
85
85
  - mhoskison@etnainteractive.com
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.8
123
+ rubygems_version: 3.3.3
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Used to access the Unbounce api