Module: UniOne::Client::Unsubscribed

Included in:
UniOne::Client
Defined in:
lib/unione/client/unsubscribed.rb

Instance Method Summary collapse

Instance Method Details

#check_unsubscribed(address) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/unione/client/unsubscribed.rb', line 17

def check_unsubscribed(address)
  params = { address: address }
  post 'unsubscribed/check.json', params
  validate_response({
    'type' => 'object', 'required' => ['status', 'address', 'is_unsubscribed'], 'properties' => {
      'status' => {'type' => 'string'},
      'address' => {'type' => 'string'},
      'is_unsubscribed' => {'type' => 'boolean'}}
  })
end

#list_unsubscribed(date_from) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/unione/client/unsubscribed.rb', line 28

def list_unsubscribed(date_from)
  params = { date_from: date_from }
  post 'unsubscribed/list.json', params
  validate_response({
    'type' => 'object', 'required' => ['status', 'unsubscribed'], 'properties' => {
      'status' => {'type' => 'string'},
      'unsubscribed' => {
        'items' => {'type' => 'object'}, 'required' => ['address', 'unsubscribed_on'], 'properties' => {
          'address' => {'type' => 'string'},
          'unsubscribed_on' => {'type' => 'string'}
        }}}
  })
end

#unsubscribe(address) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/unione/client/unsubscribed.rb', line 6

def unsubscribe(address)
  params = { address: address }
  post 'unsubscribed/set.json', params
  validate_response({
    'type' => 'object', 'required' => ['status', 'address', 'message'], 'properties' => {
      'status' => {'type' => 'string'},
      'address' => {'type' => 'string'},
      'message' => {'type' => 'string'}}
  })
end