Class: StarkInfra::MerchantCategory
- Inherits:
-
StarkCore::Utils::SubResource
- Object
- StarkCore::Utils::SubResource
- StarkInfra::MerchantCategory
- Defined in:
- lib/merchantcategory/merchantcategory.rb
Overview
# MerchantCategory object
MerchantCategory’s codes and types are used to define categories filters in IssuingRules.
A MerchantCategory filter must define exactly one parameter between code and type. A type, such as ‘food’, ‘services’, etc., defines an entire group of merchant codes, whereas a code only specifies a specific MCC.
## Parameters (conditionally required):
-
code [string, default nil]: category’s code. ex: ‘veterinaryServices’, ‘fastFoodRestaurants’
-
type [string, default nil]: category’s type. ex: ‘pets’, ‘food’
Attributes (return-only):
-
name [string]: category’s name. ex: ‘Veterinary services’, ‘Fast food restaurants’
-
number [string]: category’s number. ex: ‘742’, ‘5814’
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.query(search: nil, user: nil) ⇒ Object
# Retrieve MerchantCategories.
- .resource ⇒ Object
Instance Method Summary collapse
-
#initialize(code:, type:, name: nil, number: nil) ⇒ MerchantCategory
constructor
A new instance of MerchantCategory.
Constructor Details
#initialize(code:, type:, name: nil, number: nil) ⇒ MerchantCategory
Returns a new instance of MerchantCategory.
24 25 26 27 28 29 |
# File 'lib/merchantcategory/merchantcategory.rb', line 24 def initialize(code:, type:, name: nil, number: nil) @code = code @type = type @name = name @number = number end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
23 24 25 |
# File 'lib/merchantcategory/merchantcategory.rb', line 23 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/merchantcategory/merchantcategory.rb', line 23 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
23 24 25 |
# File 'lib/merchantcategory/merchantcategory.rb', line 23 def number @number end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'lib/merchantcategory/merchantcategory.rb', line 23 def type @type end |
Class Method Details
.query(search: nil, user: nil) ⇒ Object
# Retrieve MerchantCategories
Receive a generator of MerchantCategory objects available in the Stark Infra API
## Parameters (optional):
-
search [string, default nil]: keyword to search for code, name, number or short_code
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
generator of MerchantCategory objects with updated attributes
41 42 43 44 45 46 47 |
# File 'lib/merchantcategory/merchantcategory.rb', line 41 def self.query(search: nil, user: nil) StarkInfra::Utils::Rest.get_stream( search: search, user: user, **resource ) end |
.resource ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/merchantcategory/merchantcategory.rb', line 49 def self.resource { resource_name: 'MerchantCategory', resource_maker: proc { |json| MerchantCategory.new( code: json['code'], type: json['type'], name: json['name'], number: json['number'] ) } } end |