motion_yak 0.0.10 → 0.0.11

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.10)
4
+ motion_yak (0.0.11)
5
5
  bubble-wrap
6
6
 
7
7
  GEM
@@ -23,5 +23,9 @@ module MotionYak
23
23
  def push
24
24
  @@push
25
25
  end
26
+
27
+ def push_params
28
+ (@@push ? "True" : "False")
29
+ end
26
30
  end
27
31
  end
@@ -6,19 +6,19 @@ module MotionYak
6
6
  block.call(json)
7
7
  end
8
8
  end
9
- def self.put(url, params)
9
+ def self.put(url, params, &block)
10
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, params)
15
+ def self.post(url, params, &block)
16
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, params)
21
+ def self.delete(url, params, &block)
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.10' unless defined?(MotionYak::VERSION)
2
+ VERSION = '0.0.11' unless defined?(MotionYak::VERSION)
3
3
  MIN_MOTION_VERSION = '1.24'
4
4
 
5
5
  module_function
data/lib/motion_yak.rb CHANGED
@@ -29,10 +29,36 @@ module MotionYak
29
29
  [self.base_url, MotionYak.key, 'json', url].join('/')
30
30
  end
31
31
 
32
- def self.new_domain(domain)
33
- params = {'Domain' => domain, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push}
32
+ def self.new_domain(domain, &block)
33
+ params = {'Domain' => domain, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
34
34
  MotionYak::Request.post self.api_url('register/domain/'), params do |json|
35
- p json
35
+ block.call(json)
36
+ end
37
+ end
38
+
39
+ def self.new_address(address, &block)
40
+ params = {'Address' => address, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
41
+ MotionYak::Request.post self.api_url('register/address/'), params do |json|
42
+ block.call(json)
43
+ end
44
+ end
45
+
46
+ def self.send_email(options, &block)
47
+ params = {}
48
+ params['FromAddress'] = options[:from]
49
+ params['FromName'] = options[:from_name]
50
+ params['SenderAddress'] = options[:sender_address]
51
+ params['ToAddress'] = options[:to]
52
+ params['ReplyToAddress'] = options[:reply_address]
53
+ params['CcAddress'] = options[:cc]
54
+ params['BccAddress'] = options[:bcc]
55
+ params['Subject'] = options[:subject]
56
+ params['HtmlBody'] = options[:html]
57
+ params['TextBody'] = options[:text]
58
+ params['Headers'] = options[:headers]
59
+ params['Attachments'] = options[:attachments]
60
+ MotionYak::Request.post self.api_url('send/email/'), params do |json|
61
+ block.call(json)
36
62
  end
37
63
  end
38
64
  end
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.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: -3148663432097962409
69
+ hash: 3681157174053445989
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: -3148663432097962409
78
+ hash: 3681157174053445989
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.21