banana_stand 0.0.1
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/.gitignore +51 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +138 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/banana_stand.gemspec +41 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/banana_stand.rb +5 -0
- data/lib/banana_stand/client.rb +67 -0
- data/lib/banana_stand/models/base.rb +34 -0
- data/lib/banana_stand/models/event.rb +9 -0
- data/lib/banana_stand/version.rb +3 -0
- metadata +159 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5f2f54dcb7f84b91ab30581f66c7f52d28ec7abf
|
|
4
|
+
data.tar.gz: 87d34b48bd58a1a1230787b069767f9989abf818
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 0aa3ba6d5a9be2bf135b458267fff6cd016e144341981222def55634af4d842faa1b82d4d928772e9525e14a4cba47493ec32572517fa4e5b68b42f49c4d223e
|
|
7
|
+
data.tar.gz: 1268638865a4f46e093e66d618f2a60ea25ab9f728cb7f4ada12395c437f7b471cb939ca64adccdbae70ea243e8ca79026ec1594fc4edf71a754bfe4acdcfe8c
|
data/.gitignore
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
# Used by dotenv library to load environment variables.
|
|
14
|
+
# .env
|
|
15
|
+
|
|
16
|
+
## Specific to RubyMotion:
|
|
17
|
+
.dat*
|
|
18
|
+
.repl_history
|
|
19
|
+
build/
|
|
20
|
+
*.bridgesupport
|
|
21
|
+
build-iPhoneOS/
|
|
22
|
+
build-iPhoneSimulator/
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
25
|
+
#
|
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
29
|
+
#
|
|
30
|
+
# vendor/Pods/
|
|
31
|
+
|
|
32
|
+
## Documentation cache and generated files:
|
|
33
|
+
/.yardoc/
|
|
34
|
+
/_yardoc/
|
|
35
|
+
/doc/
|
|
36
|
+
/rdoc/
|
|
37
|
+
|
|
38
|
+
## Environment normalization:
|
|
39
|
+
/.bundle/
|
|
40
|
+
/vendor/bundle
|
|
41
|
+
/lib/bundler/man/
|
|
42
|
+
|
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
45
|
+
# Gemfile.lock
|
|
46
|
+
# .ruby-version
|
|
47
|
+
# .ruby-gemset
|
|
48
|
+
|
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
|
+
.rvmrc
|
|
51
|
+
.idea
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at najibkaake@gmail.com. All
|
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
45
|
+
version 1.3.0, available at
|
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
47
|
+
|
|
48
|
+
[homepage]: http://contributor-covenant.org
|
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
banana_stand (0.0.1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
actionmailer (4.2.6)
|
|
10
|
+
actionpack (= 4.2.6)
|
|
11
|
+
actionview (= 4.2.6)
|
|
12
|
+
activejob (= 4.2.6)
|
|
13
|
+
mail (~> 2.5, >= 2.5.4)
|
|
14
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
15
|
+
actionpack (4.2.6)
|
|
16
|
+
actionview (= 4.2.6)
|
|
17
|
+
activesupport (= 4.2.6)
|
|
18
|
+
rack (~> 1.6)
|
|
19
|
+
rack-test (~> 0.6.2)
|
|
20
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
21
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
22
|
+
actionview (4.2.6)
|
|
23
|
+
activesupport (= 4.2.6)
|
|
24
|
+
builder (~> 3.1)
|
|
25
|
+
erubis (~> 2.7.0)
|
|
26
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
28
|
+
activejob (4.2.6)
|
|
29
|
+
activesupport (= 4.2.6)
|
|
30
|
+
globalid (>= 0.3.0)
|
|
31
|
+
activemodel (4.2.6)
|
|
32
|
+
activesupport (= 4.2.6)
|
|
33
|
+
builder (~> 3.1)
|
|
34
|
+
activerecord (4.2.6)
|
|
35
|
+
activemodel (= 4.2.6)
|
|
36
|
+
activesupport (= 4.2.6)
|
|
37
|
+
arel (~> 6.0)
|
|
38
|
+
activesupport (4.2.6)
|
|
39
|
+
i18n (~> 0.7)
|
|
40
|
+
json (~> 1.7, >= 1.7.7)
|
|
41
|
+
minitest (~> 5.1)
|
|
42
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
43
|
+
tzinfo (~> 1.1)
|
|
44
|
+
arel (6.0.3)
|
|
45
|
+
builder (3.2.2)
|
|
46
|
+
concurrent-ruby (1.0.1)
|
|
47
|
+
diff-lcs (1.2.5)
|
|
48
|
+
erubis (2.7.0)
|
|
49
|
+
globalid (0.3.6)
|
|
50
|
+
activesupport (>= 4.1.0)
|
|
51
|
+
httparty (0.14.0)
|
|
52
|
+
multi_xml (>= 0.5.2)
|
|
53
|
+
i18n (0.7.0)
|
|
54
|
+
json (1.8.3)
|
|
55
|
+
loofah (2.0.3)
|
|
56
|
+
nokogiri (>= 1.5.9)
|
|
57
|
+
mail (2.6.4)
|
|
58
|
+
mime-types (>= 1.16, < 4)
|
|
59
|
+
mime-types (3.0)
|
|
60
|
+
mime-types-data (~> 3.2015)
|
|
61
|
+
mime-types-data (3.2016.0221)
|
|
62
|
+
mini_portile2 (2.0.0)
|
|
63
|
+
minitest (5.8.4)
|
|
64
|
+
multi_xml (0.6.0)
|
|
65
|
+
nokogiri (1.6.7.2)
|
|
66
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
67
|
+
rack (1.6.4)
|
|
68
|
+
rack-test (0.6.3)
|
|
69
|
+
rack (>= 1.0)
|
|
70
|
+
rails (4.2.6)
|
|
71
|
+
actionmailer (= 4.2.6)
|
|
72
|
+
actionpack (= 4.2.6)
|
|
73
|
+
actionview (= 4.2.6)
|
|
74
|
+
activejob (= 4.2.6)
|
|
75
|
+
activemodel (= 4.2.6)
|
|
76
|
+
activerecord (= 4.2.6)
|
|
77
|
+
activesupport (= 4.2.6)
|
|
78
|
+
bundler (>= 1.3.0, < 2.0)
|
|
79
|
+
railties (= 4.2.6)
|
|
80
|
+
sprockets-rails
|
|
81
|
+
rails-deprecated_sanitizer (1.0.3)
|
|
82
|
+
activesupport (>= 4.2.0.alpha)
|
|
83
|
+
rails-dom-testing (1.0.7)
|
|
84
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
|
85
|
+
nokogiri (~> 1.6.0)
|
|
86
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
|
87
|
+
rails-html-sanitizer (1.0.3)
|
|
88
|
+
loofah (~> 2.0)
|
|
89
|
+
railties (4.2.6)
|
|
90
|
+
actionpack (= 4.2.6)
|
|
91
|
+
activesupport (= 4.2.6)
|
|
92
|
+
rake (>= 0.8.7)
|
|
93
|
+
thor (>= 0.18.1, < 2.0)
|
|
94
|
+
rake (10.5.0)
|
|
95
|
+
rspec (3.4.0)
|
|
96
|
+
rspec-core (~> 3.4.0)
|
|
97
|
+
rspec-expectations (~> 3.4.0)
|
|
98
|
+
rspec-mocks (~> 3.4.0)
|
|
99
|
+
rspec-core (3.4.4)
|
|
100
|
+
rspec-support (~> 3.4.0)
|
|
101
|
+
rspec-expectations (3.4.0)
|
|
102
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
103
|
+
rspec-support (~> 3.4.0)
|
|
104
|
+
rspec-mocks (3.4.1)
|
|
105
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
106
|
+
rspec-support (~> 3.4.0)
|
|
107
|
+
rspec-support (3.4.1)
|
|
108
|
+
sprockets (3.6.0)
|
|
109
|
+
concurrent-ruby (~> 1.0)
|
|
110
|
+
rack (> 1, < 3)
|
|
111
|
+
sprockets-rails (3.0.4)
|
|
112
|
+
actionpack (>= 4.0)
|
|
113
|
+
activesupport (>= 4.0)
|
|
114
|
+
sprockets (>= 3.0.0)
|
|
115
|
+
sqlite3 (1.3.11)
|
|
116
|
+
temping (3.3.1)
|
|
117
|
+
activerecord (>= 3.1)
|
|
118
|
+
activesupport (>= 3.1)
|
|
119
|
+
thor (0.19.1)
|
|
120
|
+
thread_safe (0.3.5)
|
|
121
|
+
tzinfo (1.2.2)
|
|
122
|
+
thread_safe (~> 0.1)
|
|
123
|
+
|
|
124
|
+
PLATFORMS
|
|
125
|
+
ruby
|
|
126
|
+
|
|
127
|
+
DEPENDENCIES
|
|
128
|
+
banana_stand!
|
|
129
|
+
bundler
|
|
130
|
+
httparty (~> 0.14.0)
|
|
131
|
+
rails (>= 4.0.0)
|
|
132
|
+
rake (~> 10.0)
|
|
133
|
+
rspec (~> 3.4)
|
|
134
|
+
sqlite3 (~> 1.3.11)
|
|
135
|
+
temping (~> 3.3.0)
|
|
136
|
+
|
|
137
|
+
BUNDLED WITH
|
|
138
|
+
1.14.4
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Banana Stand
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Jay El-Kaake
|
|
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
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Banana Stand API Gem
|
|
2
|
+
Provides a Ruby interface to interact with the Banana Stand API.
|
|
3
|
+
|
|
4
|
+
# Usage and Installation
|
|
5
|
+
***Please see https://www.bananastand.io/resources/ruby_gem for instructions***
|
|
6
|
+
|
|
7
|
+
# TODO
|
|
8
|
+
* Add automated tests and hook into travis
|
|
9
|
+
* Update the `BananaStand::Client` so that it lets `BananaStand::Models::Base` class handle model instantiation
|
|
10
|
+
|
|
11
|
+
# License
|
|
12
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
13
|
+
|
|
14
|
+
# Tips
|
|
15
|
+
* Because we're using `method_missing` for attribute data accessors, if the API call fails or doesn't find anything then it will give a "method missing" error instead of `nil`. This can be confusing, so keep it in mind.
|
|
16
|
+
|
|
17
|
+
# Contributing
|
|
18
|
+
### How to contribute
|
|
19
|
+
To contribute to the repository:
|
|
20
|
+
|
|
21
|
+
1. Fork the repository.
|
|
22
|
+
2. Clone the forked repository locally.
|
|
23
|
+
3. Create a branch descriptive of your work. For example "my_new_feature_xyz".
|
|
24
|
+
4. When you're done work, push up that branch to **your own forked repository** (not the main one).
|
|
25
|
+
5. Visit https://github.com/bananastandio/gem and you'll see an option to create a pull request from your forked branch to the master. Create a pull request.
|
|
26
|
+
6. Fill out the pull request template with everything it asks for and assign the pull request to someone to review.
|
|
27
|
+
7. Set the reviewee as yourself and the requested reviewer as whomever you want to review your PR.
|
|
28
|
+
8. Once the PR merges into master then it is ready for production and should be treated as such. It will be deployed to staging within minutes.
|
|
29
|
+
|
|
30
|
+
### Getting your PR approved
|
|
31
|
+
A few key things to note:
|
|
32
|
+
* PRs must be approved by all requested reviewers before you can merge.
|
|
33
|
+
* After you implement changes requested from a reviewer then post back with a :recycle: to say something like `:recyle: Ready for you to look again at it please.`. **Note:** If you do not do this then you PR may not ever get re-reviewed after comments are taken into acocunt.
|
|
34
|
+
* If a PR comment starts with a :beer: then it is just a suggestion and preference of the reviewer and the comment is NON-blocking. That is, your PR may still be approved with these comments.
|
|
35
|
+
* If a PR comment starts with a :tipping_hand_man: then it is just informative and requires no action. It's like a "FYI"
|
|
36
|
+
* All other PR comments probably need to be addressed unless otherwise agreed by the reviewer.
|
|
37
|
+
* After a PR has been approved then you are free to merge.
|
|
38
|
+
* PR reviews will happen ASAP but generally within 24 hours.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Design and Code Standards
|
|
42
|
+
#### General Standards
|
|
43
|
+
Configure your IDE or code editor with the following:
|
|
44
|
+
* Use 4 spaces - NOT tabs.
|
|
45
|
+
* Add new line at the end of every file.
|
|
46
|
+
|
|
47
|
+
#### Ruby Style
|
|
48
|
+
Follow the [Community-driven Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide).
|
|
49
|
+
|
|
50
|
+
##### Other Considerations
|
|
51
|
+
1. Keep methods and classes small and sweet. [Follow SRP](https://en.wikipedia.org/wiki/Single_responsibility_principle).
|
|
52
|
+
2. If you're adding a lot of comments in your code you probably should consider whether or not that code should be broken up into multiple methods. This is 95% the case.
|
|
53
|
+
3. Use yardoc syntax for method docs. You only need to document public methods (private methods can be doc'd optionally)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'banana_stand/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "banana_stand"
|
|
8
|
+
spec.version = BananaStand::VERSION
|
|
9
|
+
spec.authors = ["Jay El-Kaake"]
|
|
10
|
+
spec.email = ["hi@bananastand.io"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Provides a Ruby interface to interact with the Banana Stand developer API.}
|
|
13
|
+
spec.description = %q{Provides a Ruby interface to interact with the Banana Stand API. See https://www.bananastand.io/resources for more help.}
|
|
14
|
+
spec.homepage = "https://www.github.com/bananastandio/gem"
|
|
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'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
# else
|
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency "rails", ">= 4.0.0"
|
|
31
|
+
|
|
32
|
+
spec.add_development_dependency "bundler"
|
|
33
|
+
spec.add_development_dependency "temping", "~> 3.3.0"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "rspec", '~> 3.4'
|
|
36
|
+
spec.add_development_dependency "sqlite3", '~> 1.3.11'
|
|
37
|
+
spec.add_runtime_dependency 'httparty'
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "banana"
|
|
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
|
data/bin/setup
ADDED
data/lib/banana_stand.rb
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
module BananaStand
|
|
4
|
+
class Client
|
|
5
|
+
include ::HTTParty
|
|
6
|
+
attr_accessor :api_url
|
|
7
|
+
|
|
8
|
+
def initialize(public_key, secret_key = nil)
|
|
9
|
+
@public_key = public_key
|
|
10
|
+
@secret_key = secret_key
|
|
11
|
+
@api_url = 'https://app.bananastand.io/api/v1/'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def events(page = 1)
|
|
15
|
+
# TODO: Move this into Models::Base
|
|
16
|
+
self.class.get("#{api_url}#{Models::Event.resource_path}.json?page=#{page}", headers: headers).map do |event_data|
|
|
17
|
+
::BananaStand::Models::Event.new(event_data, self)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def delete_resource(path)
|
|
22
|
+
self.class.delete("#{api_url}#{path}", headers: headers)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def find_event(id)
|
|
26
|
+
Models::Event.new(self.class.get("#{api_url}#{Models::Event.resource_path}/#{id}.json", headers: headers), self)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def product_page_html(product_id, visitor_id = nil)
|
|
30
|
+
request_url = "#{api_url}stores/#{@public_key}/content/product_page.html"
|
|
31
|
+
request_url = request_url + "?product_id=#{product_id}"
|
|
32
|
+
request_url = request_url + "&visitor_id=#{visitor_id}" if visitor_id.present?
|
|
33
|
+
self.class.get(request_url, headers: headers.merge('Content-Type' => 'text/html'))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def push_view_event(product_id, visitor_id, customer_id = nill)
|
|
37
|
+
push_event('view', product_id, visitor_id, customer_id)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def push_add_to_cart_event(product_id, visitor_id, customer_id = nill)
|
|
41
|
+
push_event('add_to_cart', product_id, visitor_id, customer_id)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def push_order_event(product_id, visitor_id, customer_id = nill)
|
|
45
|
+
push_event('order', product_id, visitor_id, customer_id)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def push_event(event_code, product_id, visitor_id, customer_id = nil)
|
|
49
|
+
customer_id ||= 0 # 0 means unknown customer ID
|
|
50
|
+
request_url = "#{api_url}stores/#{@public_key}/push_event/#{event_code}/"
|
|
51
|
+
request_url = request_url + "p/#{product_id}/c/#{customer_id}.png"
|
|
52
|
+
request_url = request_url + "?visitor_id=#{visitor_id}" if visitor_id.present?
|
|
53
|
+
self.class.get(request_url, headers: headers)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def headers
|
|
59
|
+
{
|
|
60
|
+
'X-Api-Client' => 'Banana Stand Ruby Gem',
|
|
61
|
+
'X-Secret-Key' => @secret_key,
|
|
62
|
+
'X-Public-Key' => @public_key,
|
|
63
|
+
'Content-Type' => 'application/json'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module BananaStand
|
|
2
|
+
module Models
|
|
3
|
+
class Base
|
|
4
|
+
attr_accessor :client
|
|
5
|
+
def initialize(data, client = nil)
|
|
6
|
+
@data = data || {}
|
|
7
|
+
|
|
8
|
+
@client = client if client.present?
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def method_missing(method)
|
|
12
|
+
if @data[method.to_s].present?
|
|
13
|
+
@data[method.to_s]
|
|
14
|
+
else
|
|
15
|
+
super
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def respond_to?(method, include_private = false)
|
|
20
|
+
@data[method.to_s].present? || super(method, include_private)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def delete!
|
|
24
|
+
client.delete_resource("#{self.class.resource_path}/#{self.id}.json")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def self.resource_path
|
|
30
|
+
raise NotImplementedError, "resource_path must be implemented by derived models"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: banana_stand
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jay El-Kaake
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-03-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 4.0.0
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 4.0.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: temping
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.3.0
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 3.3.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '10.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '10.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.4'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.4'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: sqlite3
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 1.3.11
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 1.3.11
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: httparty
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
description: Provides a Ruby interface to interact with the Banana Stand API. See
|
|
112
|
+
https://www.bananastand.io/resources for more help.
|
|
113
|
+
email:
|
|
114
|
+
- hi@bananastand.io
|
|
115
|
+
executables: []
|
|
116
|
+
extensions: []
|
|
117
|
+
extra_rdoc_files: []
|
|
118
|
+
files:
|
|
119
|
+
- ".gitignore"
|
|
120
|
+
- CODE_OF_CONDUCT.md
|
|
121
|
+
- Gemfile
|
|
122
|
+
- Gemfile.lock
|
|
123
|
+
- LICENSE
|
|
124
|
+
- LICENSE.txt
|
|
125
|
+
- README.md
|
|
126
|
+
- Rakefile
|
|
127
|
+
- banana_stand.gemspec
|
|
128
|
+
- bin/console
|
|
129
|
+
- bin/setup
|
|
130
|
+
- lib/banana_stand.rb
|
|
131
|
+
- lib/banana_stand/client.rb
|
|
132
|
+
- lib/banana_stand/models/base.rb
|
|
133
|
+
- lib/banana_stand/models/event.rb
|
|
134
|
+
- lib/banana_stand/version.rb
|
|
135
|
+
homepage: https://www.github.com/bananastandio/gem
|
|
136
|
+
licenses:
|
|
137
|
+
- MIT
|
|
138
|
+
metadata: {}
|
|
139
|
+
post_install_message:
|
|
140
|
+
rdoc_options: []
|
|
141
|
+
require_paths:
|
|
142
|
+
- lib
|
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
|
+
requirements:
|
|
145
|
+
- - ">="
|
|
146
|
+
- !ruby/object:Gem::Version
|
|
147
|
+
version: '0'
|
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
requirements: []
|
|
154
|
+
rubyforge_project:
|
|
155
|
+
rubygems_version: 2.6.10
|
|
156
|
+
signing_key:
|
|
157
|
+
specification_version: 4
|
|
158
|
+
summary: Provides a Ruby interface to interact with the Banana Stand developer API.
|
|
159
|
+
test_files: []
|