teachable-jg 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a01d42c8c9f26ad0ccdcef82745486376fdb825
4
+ data.tar.gz: f8f4909f4f684d327c41de02f595f63ce586a3f7
5
+ SHA512:
6
+ metadata.gz: 756afde2e968ae61b5f625daad75b8595fe56658dc230e3019226186632c41bee7d2ebf62962b228e5ee4fb3d653db2a53db621864459363aa76928b0cf0a7dd
7
+ data.tar.gz: 7875b87e2d09f677833a9b6154bd6dd74304d770bfd238b32c3b8c162f1358c97de7df8f5380ad288587a2b07ccd768933646898026a2aaa6647dad744fa61c4
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in teachable-jg.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Teachable::Jg
2
+
3
+ A module for accessing valid endpoints of the Teachable Mock API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'teachable-jg'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install teachable-jg
20
+
21
+ To install using Bundler grab the latest stable version:
22
+
23
+ gem 'teachable-jg', '~> 0.0.1'
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/teachable-jg/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "teachable/jg"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ require "teachable/jg/version"
2
+ require 'teachable/jg/configuration'
3
+ require 'teachable/jg/client'
4
+
5
+ module Teachable
6
+ module Jg
7
+ extend Configuration
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ module Teachable
2
+ module Jg
3
+ class Client
4
+
5
+ # Define the same set of accessors as the Teachable module
6
+ attr_accessor *Configuration::VALID_CONFIG_KEYS
7
+
8
+ # self.base_uri "https://#{CREDENTIALS[:host]}/#{CREDENTIALS[:path]}/Accounts/#{CREDENTIALS[:account_id]}"
9
+
10
+
11
+ def initialize(_options={})
12
+ self.class.basic_auth(account_id, account_token)
13
+ end
14
+
15
+ def initialize(options={})
16
+ # Merge the config values from the module and those passed
17
+ # to the client.
18
+ merged_options = Teachable::Jg.options.merge(options)
19
+
20
+ # Copy the merged values to this client and ignore those
21
+ # not part of our configuration
22
+ Configuration::VALID_CONFIG_KEYS.each do |key|
23
+ send("#{key}=", merged_options[key])
24
+ end
25
+ end
26
+
27
+ end # Client
28
+ end
29
+ end
@@ -0,0 +1,42 @@
1
+ module Teachable
2
+ module Jg
3
+ module Configuration
4
+ VALID_CONNECTION_KEYS = [:endpoint, :user_agent, :method].freeze
5
+ VALID_OPTIONS_KEYS = [:api_key, :format].freeze
6
+ VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
7
+
8
+ DEFAULT_ENDPOINT = 'http://teachable.dev/api'
9
+ DEFAULT_METHOD = :get
10
+ DEFAULT_USER_AGENT = "Teachable API Ruby Gem #{Teachable::Jg::VERSION}".freeze
11
+
12
+ DEFAULT_API_KEY = nil
13
+ DEFAULT_FORMAT = :json
14
+
15
+ # Build accessor methods for every config options so we can do this, for example:
16
+ # Teachable::Jg.format = :xml
17
+ attr_accessor *VALID_CONFIG_KEYS
18
+
19
+ # Make sure we have the default values set when we get 'extended'
20
+ def self.extended(base)
21
+ base.reset
22
+ end
23
+
24
+ def options
25
+ Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
26
+ end
27
+
28
+ def reset
29
+ self.endpoint = DEFAULT_ENDPOINT
30
+ self.method = DEFAULT_METHOD
31
+ self.user_agent = DEFAULT_USER_AGENT
32
+
33
+ self.api_key = DEFAULT_API_KEY
34
+ self.format = DEFAULT_FORMAT
35
+ end
36
+
37
+ def configure
38
+ yield self
39
+ end
40
+ end # Configuration
41
+ end
42
+ end
@@ -0,0 +1,5 @@
1
+ module Teachable
2
+ module Jg
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'teachable/jg/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "teachable-jg"
8
+ spec.version = Teachable::Jg::VERSION
9
+ spec.authors = ["Joshua"]
10
+ spec.email = ["joshua.guthals@gmail.com"]
11
+
12
+ spec.summary = %q{A convenient wrapper for the valid endpoints of Teachable Mock API}
13
+ spec.description = %q{A convenient wrapper for the valid endpoints of Teachable Mock API}
14
+ spec.homepage = "https://www.cnn.com" # place holder for now
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ # if spec.respond_to?(:metadata)
22
+ # spec.metadata['allowed_push_host'] = "https://mygemserver.com" # place holder for now
23
+ # end
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.9"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "pry"
28
+ spec.add_development_dependency "rspec"
29
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teachable-jg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A convenient wrapper for the valid endpoints of Teachable Mock API
70
+ email:
71
+ - joshua.guthals@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - lib/teachable/jg.rb
85
+ - lib/teachable/jg/client.rb
86
+ - lib/teachable/jg/configuration.rb
87
+ - lib/teachable/jg/version.rb
88
+ - teachable-jg.gemspec
89
+ homepage: https://www.cnn.com
90
+ licenses: []
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.6.12
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: A convenient wrapper for the valid endpoints of Teachable Mock API
112
+ test_files: []