Module: Gitabu

Defined in:
lib/gitabu.rb,
lib/gitabu/run.rb,
lib/gitabu/items.rb,
lib/gitabu/client.rb,
lib/gitabu/builder.rb,
lib/gitabu/scraper.rb,
lib/gitabu/version.rb,
lib/gitabu/generator.rb,
lib/gitabu/api/v3/git.rb,
lib/gitabu/api/v3/apps.rb,
lib/gitabu/api/v3/meta.rb,
lib/gitabu/api/v3/orgs.rb,
lib/gitabu/api/v3/scim.rb,
lib/gitabu/http_client.rb,
lib/gitabu/api/v3/gists.rb,
lib/gitabu/api/v3/pages.rb,
lib/gitabu/api/v3/pulls.rb,
lib/gitabu/api/v3/repos.rb,
lib/gitabu/api/v3/teams.rb,
lib/gitabu/api/v3/users.rb,
lib/gitabu/api/v3/checks.rb,
lib/gitabu/api/v3/emojis.rb,
lib/gitabu/api/v3/issues.rb,
lib/gitabu/api/v3/search.rb,
lib/gitabu/api/v3/actions.rb,
lib/gitabu/api/v3/billing.rb,
lib/gitabu/api/v3/commits.rb,
lib/gitabu/api/v3/metrics.rb,
lib/gitabu/api/v3/activity.rb,
lib/gitabu/api/v3/branches.rb,
lib/gitabu/api/v3/licenses.rb,
lib/gitabu/api/v3/markdown.rb,
lib/gitabu/api/v3/packages.rb,
lib/gitabu/api/v3/projects.rb,
lib/gitabu/api/v3/releases.rb,
lib/gitabu/api/v3/webhooks.rb,
lib/gitabu/api/v3/gitignore.rb,
lib/gitabu/api/v3/reactions.rb,
lib/gitabu/api/v3/codespaces.rb,
lib/gitabu/api/v3/dependabot.rb,
lib/gitabu/api/v3/migrations.rb,
lib/gitabu/api/v3/rate_limit.rb,
lib/gitabu/api/v3/deploy_keys.rb,
lib/gitabu/api/v3/deployments.rb,
lib/gitabu/api/v3/interactions.rb,
lib/gitabu/api/v3/code_scanning.rb,
lib/gitabu/api/v3/collaborators.rb,
lib/gitabu/api/v3/secret_scanning.rb,
lib/gitabu/api/v3/codes_of_conduct.rb,
lib/gitabu/api/v3/enterprise_admin.rb

Overview

Ruby gem that helps you work with Github API.

Defined Under Namespace

Modules: Api Classes: Builder, Client, Error, Generator, HttpClient, Items, Run, Scraper

Constant Summary collapse

BASE_URL =
"https://api.github.com/"
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configurationObject



20
21
22
23
24
# File 'lib/gitabu.rb', line 20

def self.configuration
  @configuration ||= OpenStruct.new(
    version: nil
  )
end

.configure {|configuration| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/gitabu.rb', line 26

def self.configure
  yield(configuration)
end

.hash_or_array(val) ⇒ Object



54
55
56
# File 'lib/gitabu.rb', line 54

def self.hash_or_array(val)
  val.is_a?(Hash) || val.is_a?(Array)
end

.to_ostruct(input) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/gitabu.rb', line 30

def self.to_ostruct(input)
  result = {}

  if input.is_a?(Hash)
    result["result_type"] = input.class
    result["result_keys"] = input.keys

    input.each do |key, value|
      result[key] = hash_or_array(value) ? to_ostruct(value) : OpenStruct.new(value: value, result_type: value.class)
    end
  end

  if input.is_a?(Array)
    result["result_type"] = input.class
    result["result_array_size"] = input.size

    input.each.with_index do |value, index|
      result["value_at_#{index}"] = hash_or_array(value) ? to_ostruct(value) : OpenStruct.new(value: value, result_type: value.class)
    end
  end

  OpenStruct.new(result)
end