foodpairing 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/foodpairing.rb +47 -0
  3. metadata +120 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da04d1393982e95128fab653ebcde3803c612380
4
+ data.tar.gz: bed3d1333c2c8f920e3f34c78c0403f5832533cc
5
+ SHA512:
6
+ metadata.gz: 82ae26836329a9061da1e35bc35d47f1a30872bd5263ea14d76a977d5aeb76e5336cdc52328f6fd2526a8ceb2c0bab82f5eedac4596a565e7f17b73679ab5e47
7
+ data.tar.gz: 8afb97bf9a2d386b9b79450ccb53b41ce8084416a14d5c2c90eddbe8fec34d6f678072025b76e010db4a97b24f245ba7d1213a24cbe06a8023d8c963c43b1c01
@@ -0,0 +1,47 @@
1
+ require "httparty"
2
+ require "json"
3
+ #require 'dotenv'
4
+ #Dotenv.load('variables.env')
5
+
6
+ class Foodpairing
7
+
8
+ def self.get_ingredient_by_id(id)
9
+ response = HTTParty.get("https://api.foodpairing.com/ingredients/#{id}", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
10
+ @ingredient = JSON.parse(response.body)
11
+ end
12
+
13
+ def self.get_all_ingredients
14
+ response = HTTParty.get("https://api.foodpairing.com/ingredients/", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
15
+ @ingredients = JSON.parse(response.body)
16
+ end
17
+
18
+ def self.search_ingredients_by_name(name)
19
+ response = HTTParty.get("https://api.foodpairing.com/ingredients?q=#{name}", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
20
+ @ingredients = JSON.parse(response.body)
21
+ end
22
+
23
+ def self.get_pairings_for_ingredient(id)
24
+ @pairings_array = []
25
+ response = HTTParty.get("https://api.foodpairing.com/ingredients/#{id}/pairings", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
26
+ @pairings_object = JSON.parse(response.body)
27
+ @pairings_object.each do |pairing|
28
+ @pairings_array.push(pairing["_links"]["ingredient"]["name"])
29
+ end
30
+ @pairings_array
31
+ end
32
+
33
+ def self.get_ingredient_nutrients(id)
34
+ response = HTTParty.get("https://api.foodpairing.com/ingredients/#{id}/nutrients", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
35
+ @nutrients = JSON.parse(response.body)
36
+ end
37
+
38
+ def self.get_all_brands
39
+ response = HTTParty.get("https://api.foodpairing.com/brands", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
40
+ @brands = JSON.parse(response.body)
41
+ end
42
+
43
+ def self.get_brand_by_id(id)
44
+ response = HTTParty.get("https://api.foodpairing.com/brands/#{id}", headers: { 'X-Application-ID' => ENV['XApplicationID'], 'X-Application-Key' => ENV['XApplicationKey'] })
45
+ @brand = JSON.parse(response.body)
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: foodpairing
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Logan Gingerich
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.1.1
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '2.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.1.1
75
+ - !ruby/object:Gem::Dependency
76
+ name: webmock
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.1'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.1'
89
+ description: A rubygem wrapper for the Foodpairing API
90
+ email: loganpgingerich@gmail.com
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - lib/foodpairing.rb
96
+ homepage: http://rubygems.org/gems/foodpairing
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.5.1
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Foodpairing API Wrapper
120
+ test_files: []