yahag 0.0.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.
- data/.document +4 -0
- data/.gitignore +30 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +9 -0
- data/lib/yahag.rb +8 -0
- data/lib/yahag/app.rb +65 -0
- data/lib/yahag/version.rb +5 -0
- data/spec/app_spec.rb +10 -0
- data/spec/spec_helper.rb +11 -0
- data/yahag.gemspec +25 -0
- metadata +127 -0
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.rbc
|
4
|
+
*.swp
|
5
|
+
*~
|
6
|
+
|
7
|
+
.\#*
|
8
|
+
\#*
|
9
|
+
|
10
|
+
.bundle
|
11
|
+
.config
|
12
|
+
.DS_Store
|
13
|
+
|
14
|
+
coverage
|
15
|
+
|
16
|
+
Gemfile.lock
|
17
|
+
InstalledFiles
|
18
|
+
|
19
|
+
pkg
|
20
|
+
tmp
|
21
|
+
|
22
|
+
.yardoc
|
23
|
+
_yardoc
|
24
|
+
rdoc
|
25
|
+
doc
|
26
|
+
|
27
|
+
spec/reports
|
28
|
+
test/tmp
|
29
|
+
test/version_tmp
|
30
|
+
lib/bundler/man
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Max Riveiro
|
2
|
+
|
3
|
+
MIT License
|
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
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Yahag
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
gem 'yahag'
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Or install it yourself as:
|
14
|
+
|
15
|
+
$ gem install yahag
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@hockey = Yahag::App.new do
|
21
|
+
app_id 'your HockeyApp Application ID'
|
22
|
+
app_token 'your HockeyApp [API Token](https://rink.hockeyapp.net/manage/auth_tokens "API Tokens")'
|
23
|
+
app_secret 'your HockeyApp Application Secret'
|
24
|
+
end
|
25
|
+
|
26
|
+
@hockey.list_users
|
27
|
+
@hockey.add_user 'some@email.su'
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
37
|
+
|
38
|
+
## Copyright
|
39
|
+
|
40
|
+
Copyright (c) 2013 Max Riveiro. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
data/lib/yahag.rb
ADDED
data/lib/yahag/app.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
module Yahag
|
6
|
+
class App
|
7
|
+
include HTTParty
|
8
|
+
|
9
|
+
attr_reader :app_id, :app_secret, :app_token
|
10
|
+
|
11
|
+
base_uri 'https://rink.hockeyapp.net/api/2'
|
12
|
+
parser Proc.new { |body| MultiJson.load(body, symbolize_keys: true) }
|
13
|
+
|
14
|
+
debug_output $stdout if ENV['DEBUG']
|
15
|
+
|
16
|
+
def initialize(&block)
|
17
|
+
# super
|
18
|
+
instance_eval(&block) if block_given?
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_users
|
22
|
+
get("/apps/#{@app_id}/app_users")[:app_users]
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_user(email = nil)
|
26
|
+
body = { email: email, secret: @app_secret }
|
27
|
+
|
28
|
+
get("/apps/#{@app_id}/app_users/check", body).code != 404
|
29
|
+
end
|
30
|
+
|
31
|
+
# first_name: options[:first_name],
|
32
|
+
# last_name: options[:last_name],
|
33
|
+
# message: options[:message],
|
34
|
+
# role: options[:role],
|
35
|
+
# tags: options[:tags]
|
36
|
+
|
37
|
+
def add_user(email = nil, options = {})
|
38
|
+
body = { email: email }.merge(options)
|
39
|
+
.delete_if { |_, v| v.nil? }
|
40
|
+
|
41
|
+
post("/apps/#{@app_id}/app_users", body)
|
42
|
+
end
|
43
|
+
|
44
|
+
def delete_user(user_id = nil)
|
45
|
+
delete("/apps/#{@app_id}/app_users/#{user_id}").status == 200
|
46
|
+
end
|
47
|
+
|
48
|
+
%w(app_id app_secret app_token).each do |method|
|
49
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
50
|
+
def #{method}(value)
|
51
|
+
@#{method} = value
|
52
|
+
end
|
53
|
+
RUBY
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
%w(get post delete).each do |method|
|
58
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
59
|
+
def #{method}(path, body = nil)
|
60
|
+
self.class.#{method}(path, body: body, headers: { 'X-HockeyAppToken' => @app_token })
|
61
|
+
end
|
62
|
+
RUBY
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/spec/app_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
require 'rspec'
|
6
|
+
require 'yahag'
|
7
|
+
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
end
|
data/yahag.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yahag/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'yahag'
|
8
|
+
gem.version = Yahag::VERSION
|
9
|
+
gem.authors = ['Max Riveiro']
|
10
|
+
gem.email = ['kavu13@gmail.com']
|
11
|
+
gem.description = 'Yahag is just a little gem for HockeyApp API endpoints. For now it supports only Team endpoint.'
|
12
|
+
gem.summary = 'Yahag is Yet Another HockeyApp Gem'
|
13
|
+
gem.homepage = "https://github.com/kavu/yahag"
|
14
|
+
gem.license = "MIT"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.test_files = gem.files.grep(%r{^(spec)/})
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.12.0'
|
21
|
+
gem.add_development_dependency 'yard', '~> 0.8.3'
|
22
|
+
gem.add_development_dependency 'redcarpet', '~> 2.2.2'
|
23
|
+
|
24
|
+
gem.add_dependency 'httparty', '~> 0.10.0'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yahag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Max Riveiro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
prerelease: false
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.12.0
|
22
|
+
none: false
|
23
|
+
type: :development
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 2.12.0
|
29
|
+
none: false
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: yard
|
32
|
+
prerelease: false
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.8.3
|
38
|
+
none: false
|
39
|
+
type: :development
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.8.3
|
45
|
+
none: false
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: redcarpet
|
48
|
+
prerelease: false
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.2.2
|
54
|
+
none: false
|
55
|
+
type: :development
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.2.2
|
61
|
+
none: false
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: httparty
|
64
|
+
prerelease: false
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.10.0
|
70
|
+
none: false
|
71
|
+
type: :runtime
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.10.0
|
77
|
+
none: false
|
78
|
+
description: Yahag is just a little gem for HockeyApp API endpoints. For now it supports
|
79
|
+
only Team endpoint.
|
80
|
+
email:
|
81
|
+
- kavu13@gmail.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .document
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- Gemfile
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- lib/yahag.rb
|
94
|
+
- lib/yahag/app.rb
|
95
|
+
- lib/yahag/version.rb
|
96
|
+
- spec/app_spec.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
- yahag.gemspec
|
99
|
+
homepage: https://github.com/kavu/yahag
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
none: false
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
none: false
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.8.23
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Yahag is Yet Another HockeyApp Gem
|
124
|
+
test_files:
|
125
|
+
- spec/app_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
has_rdoc:
|