tagalys 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d506d35c0645d7a0f47600e9ed9dcaa815356c02
4
- data.tar.gz: ef74a6ca39784a99a6d41e975b89a91d84ed3fd0
3
+ metadata.gz: edd123d806a0f779666bc68b802d39cfe52302f5
4
+ data.tar.gz: cb7cc44fa17ca389b838dc3ab30085944313f61e
5
5
  SHA512:
6
- metadata.gz: 7f3832a70cd4adc016ddfc42debfccf5fee5cb6ce2d37b011c8c96810ff523ed9ae81bbda4a6c97e82edd705f3b1d33935f308bf59c39cd030d21b30e8b4aef1
7
- data.tar.gz: 49908f6ee074600638464b2c3a6958f7e8ca9f6a2df644aed780b3d62ed74f033749e1315389247d2100b001b2e895159ad31c4aa2fd7731d9101e1d5f86c41b
6
+ metadata.gz: 6c471d89d92ac531d7ee39627a694c8239f2d83fb20656bc1188c2fd1513fbafcdff18ef941e45b91636011791065fe883f7c119f54d61f7206b978b71b34c64
7
+ data.tar.gz: b900680a514f96a5d12bb2d443f739ac3b38f47afd41eeef2864af09be6ee66f13b7a7d1334224d01b084516d0704f6084aac722a61454d81bdd13b7b05db7bd
data/lib/tagalys.rb CHANGED
@@ -1,9 +1,24 @@
1
- class Tagalys
1
+ require 'tagalys/configuration'
2
+
3
+ module Tagalys
2
4
  class << self
5
+ attr_accessor :configuration
3
6
  require 'net/http'
4
7
  require 'uri'
5
8
  require 'json'
6
9
 
10
+ def configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+
14
+ def reset
15
+ @configuration = Configuration.new
16
+ end
17
+
18
+ def configure
19
+ yield(configuration)
20
+ end
21
+
7
22
  def search(query=nil, filters=nil)
8
23
  return { status: "Either query or filter should be present" } if query == nil && filters == nil
9
24
  return { status: "Filter should be a hash" } if filters && filters.class != Hash
@@ -68,9 +83,9 @@ class Tagalys
68
83
 
69
84
  def identification
70
85
  {
71
- client_code: "ED8FFD720193B471",
72
- store_id: "1",
73
- api_key: "3a257e305b32e7b4fa70b5e999730d5a"
86
+ client_code: configuration.client_code,
87
+ store_id: configuration.store_id,
88
+ api_key: configuration.api_key
74
89
  }
75
90
  end
76
91
 
@@ -0,0 +1,11 @@
1
+ module Tagalys
2
+ class Configuration
3
+ attr_accessor :client_code, :store_id, :api_key
4
+
5
+ def initialize
6
+ @client_code = nil
7
+ @store_id = nil
8
+ @api_key = nil
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagalys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anbazhagan Palani
@@ -17,6 +17,7 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/tagalys.rb
20
+ - lib/tagalys/configuration.rb
20
21
  homepage: https://github.com/commutatus/tagalys
21
22
  licenses:
22
23
  - MIT