Class: GitPunch::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/git_punch/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



7
8
9
# File 'lib/git_punch/client.rb', line 7

def initialize
  @user = User.from_config
end

Instance Method Details

#get(url) ⇒ Object



21
22
23
# File 'lib/git_punch/client.rb', line 21

def get url
  self.class.get url, content_type: 'application/json'
end

#post(url, body) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/git_punch/client.rb', line 11

def post url, body
  request = {
    body: body,
    basic_auth: user.credentials,
    content_type: 'application/json'
  }

  self.class.post url, request
end