Module: RallyUp::Partner

Includes:
RallyUp
Defined in:
lib/rally_up/partner.rb,
lib/rally_up/partner/user.rb,
lib/rally_up/partner/token.rb,
lib/rally_up/partner/campaign.rb,
lib/rally_up/partner/organization.rb,
lib/rally_up/partner/campaign_item.rb

Defined Under Namespace

Classes: Campaign, CampaignItem, Organization, Token, User

Constant Summary

Constants included from RallyUp

VERSION

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from RallyUp

included

Class Attribute Details

.domainObject

Returns the value of attribute domain.



8
9
10
# File 'lib/rally_up/partner.rb', line 8

def domain
  @domain
end

.loginObject

Returns the value of attribute login.



8
9
10
# File 'lib/rally_up/partner.rb', line 8

def 
  @login
end

.secretObject

Returns the value of attribute secret.



8
9
10
# File 'lib/rally_up/partner.rb', line 8

def secret
  @secret
end

.tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/rally_up/partner.rb', line 8

def token
  @token
end

Class Method Details

.request(method, path, domain: RallyUp::Partner.domain, params: {}, headers: {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rally_up/partner.rb', line 10

def request(method, path, domain: RallyUp::Partner.domain, params: {}, headers: {})
  set_token if RallyUp::Partner.token.nil? || RallyUp::Partner.token.expired?

  super(
    method,
    path,
    domain: domain,
    params: params,
    headers: headers.merge(
      'Authorization' => "Bearer #{RallyUp::Partner.token.access_token}",
      'Content-Type' => 'application/x-www-form-urlencoded'
    )
  )
end

.set_tokenObject



25
26
27
# File 'lib/rally_up/partner.rb', line 25

def set_token
  RallyUp::Partner::Token.retrieve(set: true)
end