Module: Driftrock::Service::Api::Puller

Includes:
Driftrock::Service::Api
Defined in:
lib/driftrock-service/api/puller.rb

Defined Under Namespace

Modules: URLs

Instance Method Summary collapse

Methods included from Driftrock::Service::Api

#get, #post, #put

Instance Method Details



36
37
38
39
40
41
42
43
44
45
# File 'lib/driftrock-service/api/puller.rb', line 36

def advert_states(channel, date, company_id, profile_id, states)
  post(URLs::ADVERT_STATES+"/#{channel}", 
    {
      date: date.strftime(datetime_format),
      company_id: company_id,
      profile_id: profile_id,
      advert_states: states
    }
  )
end

#conversion_states(channel, date, company_id, profile_id, states) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/driftrock-service/api/puller.rb', line 47

def conversion_states(channel, date, company_id, profile_id, states)
  post(URLs::CONVERSION_STATES+"/#{channel}", 
    {
      date: date.strftime(datetime_format),
      company_id: company_id,
      profile_id: profile_id,
      conversion_states: states
    }
  )

end

#datetime_formatObject



59
60
61
# File 'lib/driftrock-service/api/puller.rb', line 59

def datetime_format
  "%Y-%m-%d %H:%M:%S %z"
end

#refresh_token(channel, company_id, profile_id, access_token, refresh_token, expires_in, expires_at) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/driftrock-service/api/puller.rb', line 21

def refresh_token(channel, company_id, profile_id, 
                  access_token, refresh_token,
                  expires_in, expires_at
                 )
  post(URLs::TOKENS+"/refreshed/#{channel}", 
       {
         company_id: company_id,
         profile_id: profile_id,
         access_token: access_token,
         refresh_token: refresh_token,
         expires_in: expires_in,
         expires_at: expires_at.strftime(datetime_format)
       })
end

#temp_auth_tokens(channel) ⇒ Object



17
18
19
# File 'lib/driftrock-service/api/puller.rb', line 17

def temp_auth_tokens(channel)
  get(URLs::TOKENS+"/#{channel}/temp")
end

#tokens(channel) ⇒ Object



13
14
15
# File 'lib/driftrock-service/api/puller.rb', line 13

def tokens(channel)
  get(URLs::TOKENS+"/#{channel}")
end