jace_beleren 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2fe5300e3448dc2bcd58e7540a08771386972528
4
+ data.tar.gz: 913576dacdb2b81a8bc5b15d26d2c5806f5af602
5
+ SHA512:
6
+ metadata.gz: ac0c6a35a67affaf916799f28bd0ee9e4c6ffce5d93cec15f236667483c0af59bf9674784a68f7d7bd5f935a56417f5e345aa1f6074483dd44dc6347fff20449
7
+ data.tar.gz: 0c63e78b791e31009af1876ca1a2f711e8ce97d4e8e580ddea112aeaf3c196915e4080a5055fdb44a5eb07076121ff5c1cd9e8095f74ed6c12f96f860450dd7c
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jace_beleren.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Lucas Aragno
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,71 @@
1
+ # Jace Beleren
2
+
3
+ ![jace](http://www.wizards.com/mtg/images/daily/wallpapers/WP_JacetheMindSculptor_2560x1600.jpg)
4
+
5
+ `jace_beleren` is a gem that wraps the `api.deckbrew.com` API
6
+
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'jace_beleren'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install jace_beleren
23
+
24
+ ## Usage
25
+
26
+ **Instantiate a client**
27
+
28
+ require 'jace_beleren'
29
+ @client = JaceBeleren::API.new
30
+
31
+ **Get all the cards**
32
+
33
+ @client.get_all_cards
34
+
35
+ **Get a specific card**
36
+
37
+ @client.get_card('gold-myr')
38
+
39
+ **Get sets**
40
+
41
+ @client.get_sets
42
+
43
+ **Get types**
44
+
45
+ @client.get_types
46
+
47
+ **Get super types**
48
+
49
+ @client.get_supertypes
50
+
51
+ **Get sub types**
52
+
53
+ @client.get_subtypes
54
+
55
+ **Get colors**
56
+
57
+ @client.get_colors
58
+
59
+ **Search for cards**
60
+
61
+ @client.search('gold')
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lucas-aragno/jace_beleren.
66
+
67
+
68
+ ## License
69
+
70
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
71
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jace_beleren"
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
@@ -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
Binary file
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jace_beleren/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jace_beleren"
8
+ spec.version = JaceBeleren::VERSION
9
+ spec.authors = ["Lucas Aragno"]
10
+ spec.email = ["lucas.aragno@moove-it.com"]
11
+
12
+ spec.summary = %q{ gem that wraps a magic the gathering card database }
13
+ spec.description = %q{ ruby wrapper for deckbrew }
14
+ spec.homepage = "http://github.com/lucas-aragno/jace_beleren"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.10"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "minitest"
28
+ end
@@ -0,0 +1,5 @@
1
+ require 'jace_beleren/version'
2
+ require 'jace_beleren/api'
3
+
4
+ module JaceBeleren
5
+ end
@@ -0,0 +1,61 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module JaceBeleren
5
+ class API
6
+ def initialize
7
+ @base_url = 'http://api.deckbrew.com/mtg'
8
+ @client = Net::HTTP
9
+ end
10
+
11
+ def get_all_cards(options)
12
+ uri = options.keys.size > 0 ? '/cards?' : '/cards'
13
+ options.map do |k, v|
14
+ uri += "#{k}=#{v}"
15
+ uri += '&' unless k == options.keys.last
16
+ end
17
+ do_request_for uri
18
+ end
19
+
20
+ def get_card(id)
21
+ uri = "/cards/#{id}"
22
+ do_request_for uri
23
+ end
24
+
25
+ def get_sets
26
+ uri = "/sets"
27
+ do_request_for uri
28
+ end
29
+
30
+ def get_types
31
+ uri = "/types"
32
+ do_request_for uri
33
+ end
34
+
35
+ def get_supertypes
36
+ uri = "/supertypes"
37
+ do_request_for uri
38
+ end
39
+
40
+ def get_subtypes
41
+ uri = "/subtypes"
42
+ do_request_for uri
43
+ end
44
+
45
+ def get_colors
46
+ uri = "/colors"
47
+ do_request_for uri
48
+ end
49
+
50
+ def search(query)
51
+ uri = "/cards/typeahead?q=#{query}"
52
+ do_request_for uri
53
+ end
54
+
55
+ private
56
+
57
+ def do_request_for(uri)
58
+ JSON.parse @client.get URI(@base_url + uri)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,3 @@
1
+ module JaceBeleren
2
+ VERSION = "1.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jace_beleren
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lucas Aragno
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-21 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: minitest
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
+ description: " ruby wrapper for deckbrew "
56
+ email:
57
+ - lucas.aragno@moove-it.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - jace_beleren-1.0.0.gem
71
+ - jace_beleren.gemspec
72
+ - lib/jace_beleren.rb
73
+ - lib/jace_beleren/api.rb
74
+ - lib/jace_beleren/version.rb
75
+ homepage: http://github.com/lucas-aragno/jace_beleren
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.5.2
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: gem that wraps a magic the gathering card database
99
+ test_files: []