motion_yak 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/motion_yak/config.rb +16 -0
- data/lib/motion_yak/request.rb +7 -7
- data/lib/motion_yak/version.rb +1 -1
- data/lib/motion_yak.rb +26 -5
- data/pkg/motion_yak-0.0.8.gem +0 -0
- metadata +5 -3
data/Gemfile.lock
CHANGED
data/lib/motion_yak/config.rb
CHANGED
data/lib/motion_yak/request.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
module MotionYak
|
2
|
-
module Request
|
3
|
-
def self.get(url, &block)
|
2
|
+
module Request
|
3
|
+
def self.get(url, params, &block)
|
4
4
|
BW::HTTP.get(url) do |response|
|
5
5
|
json = BW::JSON.parse(response.body.to_str)
|
6
6
|
block.call(json)
|
7
7
|
end
|
8
8
|
end
|
9
|
-
def self.put(url,
|
10
|
-
BW::HTTP.put(url, {payload:
|
9
|
+
def self.put(url, params)
|
10
|
+
BW::HTTP.put(url, {payload: params}) do |response|
|
11
11
|
json = BW::JSON.parse(response.body.to_str)
|
12
12
|
block.call(json)
|
13
13
|
end
|
14
14
|
end
|
15
|
-
def self.post(url,
|
16
|
-
BW::HTTP.post(url, {payload:
|
15
|
+
def self.post(url, params)
|
16
|
+
BW::HTTP.post(url, {payload: params}) do |response|
|
17
17
|
json = BW::JSON.parse(response.body.to_str)
|
18
18
|
block.call(json)
|
19
19
|
end
|
20
20
|
end
|
21
|
-
def self.delete(url)
|
21
|
+
def self.delete(url, params)
|
22
22
|
BW::HTTP.delete(url) do |response|
|
23
23
|
json = BW::JSON.parse(response.body.to_str)
|
24
24
|
block.call(json)
|
data/lib/motion_yak/version.rb
CHANGED
data/lib/motion_yak.rb
CHANGED
@@ -8,10 +8,31 @@ Motion::Project::App.setup do |app|
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
module MotionYak
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
11
|
require 'motion_yak/request'
|
16
12
|
require 'motion_yak/config'
|
17
|
-
require 'motion_yak/json'
|
13
|
+
require 'motion_yak/json'
|
14
|
+
|
15
|
+
module MotionYak
|
16
|
+
def self.config(api_key)
|
17
|
+
MotionYak::Config.api_key = api_key
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.key
|
21
|
+
MotionYak::Config.api_key
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.base_url
|
25
|
+
'https://api.emailyak.com/v1'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.api_url(url)
|
29
|
+
[self.base_url, MotionYak.key, 'json', url].join('/')
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.new_domain(domain)
|
33
|
+
params = {'Domain' => domain, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push}
|
34
|
+
MotionYak::Request.post self.api_url('register/domain/'), params do |json|
|
35
|
+
p json
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion_yak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -47,6 +47,7 @@ extra_rdoc_files:
|
|
47
47
|
- pkg/motion_yak-0.0.5.gem
|
48
48
|
- pkg/motion_yak-0.0.6.gem
|
49
49
|
- pkg/motion_yak-0.0.7.gem
|
50
|
+
- pkg/motion_yak-0.0.8.gem
|
50
51
|
files:
|
51
52
|
- Gemfile
|
52
53
|
- Gemfile.lock
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- pkg/motion_yak-0.0.5.gem
|
66
67
|
- pkg/motion_yak-0.0.6.gem
|
67
68
|
- pkg/motion_yak-0.0.7.gem
|
69
|
+
- pkg/motion_yak-0.0.8.gem
|
68
70
|
homepage: http://github.com/ballantyne/motion_yak
|
69
71
|
licenses: []
|
70
72
|
post_install_message:
|
@@ -79,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
81
|
version: '0'
|
80
82
|
segments:
|
81
83
|
- 0
|
82
|
-
hash:
|
84
|
+
hash: 2984735006160720046
|
83
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
86
|
none: false
|
85
87
|
requirements:
|
@@ -88,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
90
|
version: '0'
|
89
91
|
segments:
|
90
92
|
- 0
|
91
|
-
hash:
|
93
|
+
hash: 2984735006160720046
|
92
94
|
requirements: []
|
93
95
|
rubyforge_project:
|
94
96
|
rubygems_version: 1.8.21
|