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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion_yak (0.0.8)
4
+ motion_yak (0.0.9)
5
5
  bubble-wrap
6
6
 
7
7
  GEM
@@ -7,5 +7,21 @@ module MotionYak
7
7
  def api_key
8
8
  @@api_key
9
9
  end
10
+
11
+ def callback=(c)
12
+ @@callback = c
13
+ end
14
+
15
+ def callback
16
+ @@callback
17
+ end
18
+
19
+ def push=(c)
20
+ @@push = c
21
+ end
22
+
23
+ def push
24
+ @@push
25
+ end
10
26
  end
11
27
  end
@@ -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, data)
10
- BW::HTTP.put(url, {payload: data}) do |response|
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, data)
16
- BW::HTTP.post(url, {payload: data}) do |response|
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)
@@ -1,5 +1,5 @@
1
1
  module MotionYak
2
- VERSION = '0.0.8' unless defined?(MotionYak::VERSION)
2
+ VERSION = '0.0.9' unless defined?(MotionYak::VERSION)
3
3
  MIN_MOTION_VERSION = '1.24'
4
4
 
5
5
  module_function
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.8
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: -3778607916468827869
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: -3778607916468827869
93
+ hash: 2984735006160720046
92
94
  requirements: []
93
95
  rubyforge_project:
94
96
  rubygems_version: 1.8.21